
Ed, thanks for your code. However, I need to use something that fits inside the whole pretty-print engine. I would like to call parseModule in some string of Haskell code and get it nicely typed, with those big strings inside. Best, Maurício
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 (snd.unzip) $ groupBy (\_ (i,_) -> i `mod` maxlen /= 0) $ zip [0..] str
Ed
On Sat, Sep 20, 2008 at 4:14 PM, Maurício
mailto:briqueabraque@yahoo.com> wrote: Hi,
I'm using Language.Haskell.* and would like to know if it's possible to pretty-print big strings like this:
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
into something like this:
"aaaaaaaa\ \aaaaaaaa\ \aaaaaaaa\ \aaaaaaaa\ \aaaaaaaa\ \aaaaaaaa\ \aaaaaaaa"
to respect the limit on number of columns. Can you help me? Is it possible to do that?
Thanks, Maurício
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org mailto:Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
------------------------------------------------------------------------
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe