Control.Monad proposal: Add whenJust

Herbert Valerio Riedel hvr at gnu.org
Sun May 19 10:56:07 CEST 2013


On 2013-05-19 10:38:28 +0200, Henning Thielemann wrote:
> On Sun, 19 May 2013, Herbert Valerio Riedel wrote:
>
>> On 2013-05-18 16:08:33 +0200, Ian Lynagh wrote:
>>
>> [...]
>>
>>> I'd prefer to remove the monomorphic functions, but not to add anything
>>> to Prelude.
>>
>> +1
>
> I'd just leave Prelude as it is, in order to be able to introduce
> people to Haskell without doing any configuration. Experts can
> configure GHCi to import any default set of functions they like.

I'm not sure that beginners being introduced to Monad operations will
start using the

    sequence :: Monad m => [m a] -> m [a]
    sequence_ :: Monad m => [m a] -> m ()
    mapM :: Monad m => (a -> m b) -> [a] -> m [b]
    mapM_ :: Monad m => (a -> m b) -> [a] -> m ()

operations and not need an 'import Control.Monad' real soon afterwards
anyway IMHO

OTOH, having those four names above defined in the global Prelude
namespace makes it more cumbersome to introduce beginners to
Traversable/Foldable, as you'd have to explain them how to workaround
the symbol clashes by using qualified imports or Prelude-hiding
imports...

cheers,
  hvr



More information about the Libraries mailing list