write literate haskell programs in typst cdn.oppi.li/typst-unlit.pdf
haskell typst

wording

Signed-off-by: oppiliappan <me@oppi.li>

oppi.li 79988ad1 d8aa995e

verified
+1 -1
+1 -1
typst-unlit.lhs
··· 15 15 16 16 A literate program is one where comments are first-class citizens, and code is explicitly demarcated, as opposed to a regular program, where comments are explicitly marked, and code is a first-class entity. 17 17 18 - GHC supports literate programming out of the box, by using a preprocessor to extract code from documents. This preprocessor is known as _unlit_ #footnote[https://gitlab.haskell.org/ghc/ghc/-/tree/master/utils/unlit]. GHC also supports _custom_ preprocessors, which can be passed in via the `-pgmL` flag. This very document you are reading, is one such preprocessor that allows embedding Haskell code inside typst files #footnote[This document needs itself to compile itself! This is why a bootstrap program is included.]. 18 + GHC supports literate programming out of the box, by using a preprocessor to extract code from documents. This preprocessor is known as _unlit_ #footnote[https://gitlab.haskell.org/ghc/ghc/-/tree/master/utils/unlit]. GHC also supports _custom_ preprocessors, which can be passed in via the `-pgmL` flag. This very document you are reading, is one such preprocessor program that allows extracting Haskell from Typst code (although it has been rendered to HTML, PDF or markdown depending on where you are reading it)#footnote[This document needs itself to compile itself! This is why a bootstrap program is included.]! 19 19 20 20 This recipe not only gives you a fish (the typst-unlit preprocessor), but also, teaches you how to fish (write your own preprocessors). 21 21