[Haskell-cafe] Extract source code from literate Haskell (LHS)
newsham at lava.net
Sun Sep 30 16:45:47 EDT 2007
> This is of course very easy to do manually, but does a command line tool
> exist for extracting source code from literate Haskell files?
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
More information about the Haskell-Cafe