[Haskell-cafe] Re: Composing monads
Hitesh
hitesh.jasani at gmail.com
Fri Nov 23 16:20:19 EST 2007
> main :: IO ()
> main = mapM_ ((putStrLn "") >*> putStrLn) $
> map show [1,2,3]
>
A couple other ways to do this code.
Without monad combinators
main = mapM_ putStrLn . ("":) . intersperse "" . map show $ [1..3]
With your combinator, but collapsing it so we don't map over the
collection twice.
main = mapM_ ((putStrLn "") >*> print) $ [1..3]
- Hitesh
More information about the Haskell-Cafe
mailing list