$ cabal install markdown-doctest
$ ./markdown-doctest <filename.md>
The ghc environment file should exist in the package being tested:
$ cabal build --write-ghc-environment-files=always
3 type of codeblocks are parsed,
haskell: Allhaskellblocks 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 Pimport qualified Prelude as P
main =
P.print "Hello, World!">>> import qualified Prelude as Pmain =
P.print "Hello, World!">>> P.filter P.odd [1..10]
[1,3,5,7,9]