Control.Monad proposal: Add whenJust

Henning Thielemann lemming at henning-thielemann.de
Fri May 10 09:48:30 CEST 2013


On Fri, 10 May 2013, Niklas Hambüchen wrote:

> (Default base case clutter.)
>
>
>   import Data.Foldable
>
>   forM_ mUser $ \user -> do
>     putStrLn "Mailing!"
>     email user
>
> (Not too intuitive/well-named here and "Ambiguous occurrence forM_"
> clash with Control.Monad.)


I am against adding a new function to Control.Monad. You should always 
import with explicit identifier lists or with qualification in order to 
allow a larger range of imported library versions and then it makes no 
difference whether you write

   import Control.Monad (forM_)

or

   import Data.Foldable (forM_)


More information about the Libraries mailing list