literate Haskell newbie question
I am a newbie to literate Haskell and these are my two simple questions: How do I compile a literate haskell file foo.lhs (using ghc-6.6)? Is there a tool that translates foo.lhs to foo.hs? Surprisingly I don't find the answer in http://haskell.org/haskellwiki/Literate_programming whereas a lot about translation into tex-files can be found. Thanks, Immanuel
ghc handles lhs files based on their extension. You don't need to translate it to a different format. If you want to translate > notation lhs to hs on your own (I dunno why, just if you did), the sed/grep combo cat foo.lhs | grep -e "^>" | sed "s/^> //" would work just fine. On Friday 09 March 2007 09:23, Immanuel Normann wrote:
I am a newbie to literate Haskell and these are my two simple questions:
How do I compile a literate haskell file foo.lhs (using ghc-6.6)? Is there a tool that translates foo.lhs to foo.hs?
Surprisingly I don't find the answer in http://haskell.org/haskellwiki/Literate_programming whereas a lot about translation into tex-files can be found.
Thanks, Immanuel
cat foo.lhs | grep -e "^>" | sed "s/^> //"
Running for the Useless Use of cat Award? A simpler version would be: sed -n -e 's/^>//p <foo.lhs I don't guarantee that this will work correctly, tho. Maybe sed -n -e 's/^> //p <foo.lhs will work better? This said, the OP talked about TeX, so presumably he uses the other format, so maybe a better sed would be: sed -n -e '/^\\begin{code}/,/\\end{code}/{/^\\begin{code}/d;/^\\end{code}/d;p}' <foo.lhs -- Stefan
Immanuel Normann schrieb:
I am a newbie to literate Haskell and these are my two simple questions:
How do I compile a literate haskell file foo.lhs (using ghc-6.6)?
The same way, how you would translate foo.hs
Is there a tool that translates foo.lhs to foo.hs?
there is an "unlit" program under ghc's libdir (that you usually do not need): /usr/local/lib/ghc-6.6/unlit Cheers Christian
participants (4)
-
Christian Maeder -
Immanuel Normann -
Jefferson Heard -
Stefan Monnier