Re: [Haskell-cafe] Language.Haskell and strings

2008-09-21 Thread Sukit Tretriluxana
I'm not a Haskell expert but here the solution to your problem that I can think of. import Data.List prettyStr :: Int - String - IO () prettyStr maxlen str = do putStr (\ ++ head brokenStr) mapM_ (\str - putStr (\\\n\\ ++ str)) (tail brokenStr) putStr \\n where brokenStr = map

Re: [Haskell-cafe] Language.Haskell and strings

2008-09-21 Thread Sterling Clover
A quick glance at the code reveals that there's an instance of Pretty like such: instance Pretty HsLiteral where pretty (HsInt i)= integer i pretty (HsChar c) = text (show c) pretty (HsString s) = text (show s) pretty (HsFrac r) = double

[Haskell-cafe] Language.Haskell and strings

2008-09-20 Thread Maurí­cio
Hi, I'm using Language.Haskell.* and would like to know if it's possible to pretty-print big strings like this: into something like this: \ \\ \\ \\ \\ \\ \ to respect the limit