
30 Nov
2011
30 Nov
'11
4:40 a.m.
On 11/30/2011 02:11 PM, Liyang HU wrote:
This particular pattern crops up a lot for me. Does it for anyone else?
I (half-heartedly) propose adding to Control.Monad the following:
-- | A variation of 'when' for 'Maybe a'. whenJust :: (Monad m) => Maybe a -> (a -> m ()) -> m () whenJust = flip (maybe (return ()))
We already have it. See Data.Foldable.forM_