Control.Monad proposal: Add whenJust

Henning Thielemann lemming at henning-thielemann.de
Thu May 16 10:51:53 CEST 2013


On Thu, 16 May 2013, Andreas Abel wrote:

>  import Prelude hiding (mapM)
>  import Control.Monad.Identity hiding (mapM)
>  import Control.Monad.State hiding (mapM)
>  import Control.Monad.Error hiding (mapM)
>  import Control.Monad.Reader hiding (mapM)
>
> I don't know why all these modules export a mapM that only works for lists, 
> rather than the generic mapM from Traversable.

1. Import of Control.Monad.State et.al. without qualification requires 
very small version ranges for mtl according to the PVP, which you 
certainly do not want.

2. Import with hiding is a very bad idea, too, since if mtl will be 
cleaned up and 'mapM' is no longer re-exported, your imports will break.

3. I switched to 'transformers' completely long ago. It does not re-export 
any monad helper functions.



More information about the Libraries mailing list