[Haskell-cafe] Extract source code from literate Haskell (LHS)
files
Tim Newsham
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?
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/
More information about the Haskell-Cafe
mailing list