gwernnet.cabal
gwernnet.cabal is the central build configuration for all Haskell code in the gwern.net build system.
Read this when Use this page when tracing the Haskell build pipeline, generators, metadata code, or backend utility behavior around gwernnet.
Overview
gwernnet.cabal is the central build configuration for all Haskell code in the gwern.net build system. It defines:
- A shared library (
gwernnet) exposing 53 modules for site generation - 13 executable tools for build and maintenance tasks
- Common dependencies and compiler options shared across all components
The configuration uses Cabal 3.0 features like common stanzas to reduce duplication and ensure consistent settings across all build targets.
Package Metadata
cabal-version: 3.0
name: gwernnet
version: 2026.6.1
license: CC0-1.0
author: Gwern Branwen
maintainer: Gwern Branwen
build-type: Simple
synopsis: Gwern.net build + maintenance tools (internal)
category: Web
The version follows a date-based scheme: YYYY.M.patch (e.g. 2026.6.1)
Library Modules
The library exposes 53 modules organized by function:
Core Build
| Module | Purpose |
|---|---|
Annotation | Main annotation/metadata system |
LinkMetadata | Link metadata processing |
LinkMetadataTypes | Type definitions for metadata |
Typography | Pandoc typography transforms |
Utils | Common utilities |
Annotation Scrapers
| Module | Purpose |
|---|---|
Annotation.Arxiv | arXiv paper metadata |
Annotation.Biorxiv | bioRxiv/medRxiv metadata |
Annotation.Gwernnet | Internal site metadata |
Annotation.OpenReview | OpenReview paper metadata |
Annotation.PDF | PDF document metadata |
Link Processing
| Module | Purpose |
|---|---|
LinkArchive | Archive.org integration |
LinkBacklink | Backlink generation |
LinkID | Link identification |
LinkIcon | Link type icons |
LinkLive | Live preview popups |
LinkMetadata | Link metadata processing |
Text Processing
| Module | Purpose |
|---|---|
Paragraph | Paragraph transforms |
Columns | List column layout |
Inflation | Dollar inflation adjustment |
Text.Regex | Vendored regex module |
Utext | Unicode-rich plain-text rendering |
Metadata Handling
| Module | Purpose |
|---|---|
Metadata.Author | Author name processing |
Metadata.Date | Date parsing/formatting |
Metadata.Format | Format detection |
Metadata.Title | Title processing |
Configuration Modules
All Config.* modules contain constants, test cases, and whitelists:
Config.GenerateSimilar,Config.Inflation,Config.InterwikiConfig.LinkArchive,Config.LinkID,Config.LinkMetadataConfig.LinkIcon,Config.LinkLive,Config.LinkSuggesterConfig.Metadata.Author,Config.Metadata.Format,Config.Metadata.TitleConfig.Misc,Config.Paragraph,Config.Tags,Config.Typography,Config.UtextConfig.XOfTheDay
Other Modules
| Module | Purpose |
|---|---|
Blog | Blog post generation |
Cycle | Cycle detection utilities |
GenerateSimilar | Similar link recommendations |
GTX | GTX file handling |
Image | Image processing |
Interwiki | Interwiki link expansion |
Query | Extract links/URLs from Pandoc documents |
Tags | Tag system |
Test | Test utilities |
Unique | Unique ID generation |
XOfTheDay | Daily featured content |
Executables
hakyll
Main site generator using Hakyll static site framework.
executable hakyll
import: exe-common
main-is: hakyll.hs
ghc-options: -threaded -rtsopts
preprocessMarkdown
Markdown preprocessing before Pandoc.
executable preprocessMarkdown
main-is: preprocessMarkdown.hs
build-depends: gwernnet
generateLinkBibliography
Creates bibliography pages from link metadata.
executable generateLinkBibliography
main-is: generateLinkBibliography.hs
ghc-options: -threaded -rtsopts
generateDirectory
Generates directory/index pages.
executable generateDirectory
main-is: generateDirectory.hs
ghc-options: -threaded -rtsopts
generateBacklinks
Creates backlink pages showing what links to each page.
executable generateBacklinks
main-is: generateBacklinks.hs
ghc-options: -threaded -rtsopts
checkMetadata
Validates metadata consistency.
executable checkMetadata
main-is: checkMetadata.hs
guessTag
Suggests tags for content.
executable guessTag
main-is: guessTag.hs
changeTag
Batch tag modification.
executable changeTag
main-is: changeTag.hs
ghc-options: -threaded -rtsopts
generateSimilarLinks
Creates "similar links" recommendations.
executable generateSimilarLinks
main-is: generateSimilarLinks.hs
ghc-options: -threaded -rtsopts
linkTitler
Adds title metadata to links.
executable linkTitler
main-is: linkTitler.hs
ghc-options: -threaded -rtsopts
redirectGuesser
Suggests nginx redirects for likely moved URLs.
executable redirectGuesser
main-is: redirectGuesser.hs
ghc-options: -threaded -rtsopts
linkSuggester
Generates link suggestions.
executable linkSuggester
main-is: linkSuggester.hs
ghc-options: -threaded -rtsopts
linkExtractor
Extracts links from Markdown.
executable linkExtractor
main-is: linkExtractor.hs
ghc-options: -threaded -rtsopts
Common Stanza
All components share dependencies and warning defaults via the gwern-common stanza:
common gwern-common
default-language: Haskell2010
ghc-options: -Wall
build-depends:
base, HTTP, aeson, array, async, ...
Executables import exe-common, which sets hs-source-dirs: app and depends on the gwernnet library. The library stanza sets hs-source-dirs: . and adds ghc-options: -O2.
Compiler Options
| Option | Purpose |
|---|---|
-O2 | Optimization level 2 for the library stanza |
-Wall | Enable all warnings |
-threaded | Enable threading (some executables) |
-rtsopts | Enable runtime options (some executables) |
Key Dependencies
Core
| Package | Purpose |
|---|---|
pandoc==3.1.3 | Document conversion |
pandoc-types | Pandoc AST types |
hakyll==4.16.2.0 | Static site generator |
Web/Network
| Package | Purpose |
|---|---|
HTTP | HTTP client |
http-conduit==2.3.8 | Streaming HTTP |
http-types | HTTP type definitions |
network-uri | URI parsing |
Data/Text
| Package | Purpose |
|---|---|
aeson | JSON parsing |
text | Text type |
bytestring | Binary data |
containers | Maps, sets |
vector | Efficient arrays |
Regex
| Package | Purpose |
|---|---|
regex-base | Regex abstraction |
regex-tdfa | TDFA regex engine |
Other
| Package | Purpose |
|---|---|
titlecase | Title case conversion |
tagsoup | HTML parsing |
edit-distance | String similarity |
cryptohash | Hashing |
Version Pins
Some dependencies have exact version pins to ensure reproducible builds:
hakyll==4.16.2.0
http-conduit==2.3.8
pandoc==3.1.3
Additionally, warp is bounded (warp<3.4.13) to work around a compilation failure in warp-3.4.13.
Building
cd build/
cabal build all # Build everything
cabal build hakyll # Build just hakyll
cabal run hakyll -- ... # Run with arguments
See Also
- hakyll.hs - Main site generator
- sync.sh - Build orchestration script
- Text.Regex - Vendored regex module
- LinkMetadata.hs - Core metadata system