Proposal: Adding Kleisli composition to Control.Monad

Conor McBride ctm at cs.nott.ac.uk
Mon Nov 13 06:11:32 EST 2006


Hi

Just a remark, not necessarily an objection.

Don wrote:
> forever' act@ repeats the action infinitely.
> +forever     :: (Monad m) => m a -> m ()
> +forever a   = a >> forever a
>   

This forever operation is definable for any (Applicative m), not just 
(Monad m). Of course, there are plenty of other operators in the library 
whose types are restrictive in the same way. There's clearly a pragmatic 
issue here. As it is not currently the case that a Monad instance 
automatically yields an Applicative instance, it may be more convenient 
in the short term to stick with the more restrictive version here and 
generalise later, if ever it becomes pain-free to do so.

Cheers

Conor



More information about the Libraries mailing list