$ cabal install markdown-doctest
$ ./markdown-doctest <filename.md>
Note: The ghc environment file should exist.
3 type of codeblocks are parsed,
haskell
: Allhaskell
blocks are tangled into a common file and checked.haskell unshared
: These blocks are loaded independently and dont share anything.haskell docspec
: These blocks share the syntax of docspec and share the env.
markdown-doctest
will successfully validate this file.
import qualified Prelude as P
import qualified Prelude as P
main =
P.print "Hello, World!"
>>> import qualified Prelude as P
main =
P.print "Hello, World!"
>>> P.filter P.odd [1..10]
[1,3,5,7,9]