
23 Nov
2007
23 Nov
'07
1:24 p.m.
module Main (Main.main) where import Control.Monad import System.IO
(>*>) :: Monad m => m () -> (a -> m ()) -> (a -> m ()) (>*>) f f' = \a -> do{ f; f' a; }
main :: IO () main = mapM_ ((putStrLn "") >*> putStrLn) $ map show [1,2,3]
There is nothing wrong with that, but I would normally write: mapM_ (\a -> putStrLn "" >> putStrLn a) $ map show [1,2,3] ...i.e. I wouldn't be afraid of a lambda in a case like that. IME it's moderately common to have to do: mapM_ (\a -> some stuff >> something_with a >> some stuff) ll Jules