Ticket #3292 (closed proposal: fixed)
Add an 'ignore' function to Control.Monad
|Reported by:||guest||Owned by:|
|Type of failure:||None/Unknown||Difficulty:||Unknown|
|Test Case:||Blocked By:|
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 ())