[Haskell-cafe] Re: Returning a list element?
Dominic Steinitz
dominic.steinitz at blueyonder.co.uk
Wed Mar 22 03:20:24 EST 2006
Donald Bruce Stewart <dons <at> cse.unsw.edu.au> writes:
> > mainMenu =
> > sequence_ $ map putStrLn ["line1", "line2", "line3"]
>
> I argue if you want to sequence_ a map you should write mapM_:
>
> mapM_ putStrLn ["line1", "line2", "line3"]
Nice
>
> mapM is under-appreciated? More under-appreciated are line gaps:
>
> main = putStr "line1\n\
> \line2\n\
> \line3\n"
>
Or if you don't like hand writing in all the newlines you could use
putStrLn . concat . intersperse "\n"
More information about the Haskell-Cafe
mailing list