[Haskell-cafe] extracting a single declaration using haskell-src-ext
Maurizio Vitale
mrz.vtl at gmail.com
Tue Mar 17 16:12:56 UTC 2015
G'day!
Is there an easy way to extract a single declaration from an Haskell source
file and print it with the original formatting?
[I could live with pretty printing, but the default prettyPrint gives me a
very strange formatting where something like:
main = do
putStrLn "Hello"
becomes:
main = do putStrLn "Hello"]
The closest I've got is to parse the file with comments and then get inside
Module ...decls and do printExact with an empty comment list for the decl
I'm interested in. This gives me the original formatting and empty lines
where comments were that I can then remove.
But if there was anything already out there that just take a String for the
toplevel I'm interested in and convert that only, I'd love to know.
Thanks,
Maurizio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150317/3adcacb9/attachment.html>
More information about the Haskell-Cafe
mailing list