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
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to