#3292: Add an 'ignore' function to Control.Monad
-----------------------------+----------------------------------------------
Reporter:  guest             |          Owner:                  
    Type:  proposal          |         Status:  new             
Priority:  normal            |      Component:  libraries/base  
 Version:  6.10.2            |       Severity:  minor           
Keywords:                    |       Testcase:                  
      Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
-----------------------------+----------------------------------------------
 See http://www.haskell.org/pipermail/libraries/2009-June/thread.html#11880

 In short, add a 'ignore :: m a -> m ()' function to Control.Monad. This
 lets us do things like 'forkIO $ ignore stuff', as opposed to throwing
 around all sorts of '>> return ()'.

 This function could be widely used by many libraries & apps, and has been
 repeatedly invented and suggested (see the thread). So far no one has said
 a word against it.

 {{{
 - -- | 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 ())
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3292>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to