Proposal: Adding Kleisli composition to Control.Monad

Mattias Bengtsson moonlite at
Sun Nov 12 21:51:23 EST 2006

On Mon, 2006-11-13 at 13:15 +1100, Donald Bruce Stewart wrote:


> Along with the useful control combinator:
>     forever :: (Monad m) => m a -> m ()


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

I would personally rather see repeatM and repeatM_ like the
replicateM/replicateM_ pair already in Control.Monad.

I implement them like this:
repeatM  = sequence  . repeat
repeatM_ = sequence_ . repeat

Google CodeSearch tells me it's the way replicateM was implemented too:

Btw, i hope it is ok to give my opinion on this. Im asking since im not
a library developer or anything just a normal programmer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url :

More information about the Libraries mailing list