Thu Jun 11 21:29:53 EDT 2009 * Control.Monad: add 'ignore'
function Turns m a -> m (). Lets one call functions for their
side-effects without having to get rid of their return values
with '>> return ()'. Very useful in many contexts (parsing, IO
etc.). -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 New
patches: [Control.Monad: add 'ignore' function**20090612012953
Ignore-this: 427b39cba203a7414a1bdf0cdb83a0bc Turns m a -> m ().
Lets one call functions for their side-effects without having to
get rid of their return values with '>> return ()'. Very useful
in many contexts (parsing, IO etc.). ] hunk ./Control/Monad.hs
193 forever :: (Monad m) => m a -> m b forever a = a >> forever
a +-- | Convenience function. This is particularly good for
'forkIO' and 'forM_', +-- as they demand return types of 'IO
()', but most interesting IO functions +-- don't return void. So
one can wrap them with 'ignore' (essentially a call to 'unit').
+ignore :: Functor f => f a -> f () +ignore = fmap (const ()) +
-- ------------------