Ticket #3292 (closed proposal: fixed)
Add an 'ignore' function to Control.Monad
| Reported by: | guest | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Not GHC |
| Component: | libraries/base | Version: | 6.13 |
| Keywords: | Cc: | gwern0@… | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | None/Unknown | Difficulty: | Unknown |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
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 ())
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

