Signature of Control.Monad when and unless

Edward Kmett ekmett at
Fri Aug 24 15:22:13 CEST 2012

Personally, I would really like to see these added.

Alas, I missed the discussion the first time around, and I'm afraid if I
tried to raise the issue again the safety police will go through and
actively remove the 'a's from the remaining useful combinators I still
have. ;)

I do find it particularly obnoxious that I have to round trip through the
monad transformer stack just to rip off a type argument when couldn't use
if it wanted to in the first place.

Moreover, the 'void' type that actually wound up implemented doesn't help
at all if you only know you have a Monad and don't have the additional
Functor, (e.g. are writing a monad transformer), so even though void exists
you wind up having to use  'do x <- ...; return ()' in most library code


On Fri, Aug 24, 2012 at 5:12 AM, Oren Ben-Kiki <haskell-oren at>wrote:

> I understand why the normal signature is:
>     when :: Monad m => Bool -> m () -> m ()
>     unless :: Monad m => Bool -> m () -> m ()
> But why isn't there also:
>     when_ :: Monad m => Bool -> m a -> m ()
>     unless_ :: Monad m => Bool -> m a -> m ()
> That is, I agree that results shouldn't be discarded "by default", but it
> should be easy to get rid of them if they are unneeded.
> Thanks,
>     Oren Ben-Kiki
> _______________________________________________
> Libraries mailing list
> Libraries at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list