[Haskell-cafe] Re: Returning a list element?

Dominic Steinitz dominic.steinitz at blueyonder.co.uk
Tue Mar 21 15:42:59 EST 2006


Robert Dockins <robdockins <at> fastmail.fm> writes:

> FYI, putStrLn will automatically insert a newline for you, and the  
> final 'return ()' is unnecessary.  My favorite idiom for this kind of  
> thing is:
> 
> mainMenu = putStr $ unlines
>    [ "line 1"
>    , "line 2"
>    , "line 3"
>    ]
> 
Or how about

mainMenu =
   sequence_ $ map putStrLn ["line1", "line2", "line3"]



More information about the Haskell-Cafe mailing list