Someone had a great idea of combining Literate Haskell and Markdown. Made sense to me, so I wanted to try it. But there is something Haskell doesn't like about the Markdown '#' header syntax:
Hello World
> main = putStrLn "hello, world"
works...
$ runhaskell hello_world.lhs
hello, world
While...
# Hello World #
> main = putStrLn "hello, world"
doesn't...
$ runhaskell hello_world.lhs
hello_world.lhs:1:3: lexical error at character 'H'
Is there there a definition of what is legal? The Haskell syntax only mentions Literate Haskell by example, and nothing to imply the Markdown syntax is invalid.
A '#' in the first column causes problems with GHCi, even with blank lines before and after code blocks. If you are using Pandoc, you can work around this problem by using underlining for headings.
Hello World ----------- > main = putStrLn "hello, world"
This is a known problem: http://hackage.haskell.org/trac/ghc/ticket/4836
Read this:
http://www.haskell.org/onlinereport/literate.html
It says that to avoid errors, you need a blank line between comments and code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With