Extract source code from literate Haskell (LHS) files

This is of course very easy to do manually, but does a command line tool exist for extracting source code from literate Haskell files? Thanks, Peter

On Sep 30, 2007, at 14:39 , Peter Verswyvelen wrote:
This is of course very easy to do manually, but does a command line tool exist for extracting source code from literate Haskell files?
"unlit" in the GHC library directory? -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

This is of course very easy to do manually, but does a command line tool exist for extracting source code from literate Haskell files?
something like: sed -e '/^[^>]/d' -e 's/^>//g' < foo.lhs > foo.hs the first expression deletes lines not starting with ">". The second expression removes the ">" at the beginning of each line. or if you prefer to keep the comments: sed -e 's/^[^>]/-- /g' -e 's/^>//g' < foo.lhs > foo.hs the first expression puts "-- " at the start of each line without a ">".
Thanks, Peter
Tim Newsham http://www.thenewsh.com/~newsham/

On 9/30/07, Peter Verswyvelen
This is of course very easy to do manually, but does a command line tool exist for extracting source code from literate Haskell files?
There are a lot of good answers already. You can also use some GHC command line options. Please see: http://haskell.org/haddock/haddock-html-0.8/invoking.html#cpp Pekka

Hi Peter,
This is of course very easy to do manually, but does a command line tool exist for extracting source code from literate Haskell files?
Cpphs is the perfect tool to do this.
Thanks
Neil
On 9/30/07, Peter Verswyvelen
Thanks, Peter
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

This is of course very easy to do manually, but does a command line tool exist for extracting source code from literate Haskell files?
Cpphs is the perfect tool to do this.
In case the link is not immediately obvious, cpphs has the -unlit flag to remove the literate parts of the file, leaving pure code. Regards, Malcolm
participants (7)
-
Brandon S. Allbery KF8NH
-
Dominic Steinitz
-
Malcolm Wallace
-
Neil Mitchell
-
Pekka Karjalainen
-
Peter Verswyvelen
-
Tim Newsham