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
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
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