Adding repeatM / repeatM_ to Control.Monad

Are there any objections to adding abbreviations for repeatM = sequence.replicate and repeatM_ = sequence_.replicate to Control.Monad? I think they are convenient in the same way many others are. Volker -- http://www-i2.informatik.rwth-aachen.de/stolz/ *** PGP *** S/MIME

Wouldn't `replicateM` and `replicateM_` be more appropriate names? Dean On Wed, 28 Aug 2002, Volker Stolz wrote:
Are there any objections to adding abbreviations for repeatM = sequence.replicate and repeatM_ = sequence_.replicate to Control.Monad? I think they are convenient in the same way many others are.
Volker -- http://www-i2.informatik.rwth-aachen.de/stolz/ *** PGP *** S/MIME

On Wed, Aug 28, 2002 at 01:07:51PM -0400, Dean Herington wrote:
Wouldn't `replicateM` and `replicateM_` be more appropriate names?
You're right, that's what I've got in my private library, too. I just didn't type what was in my head. -- Volker Stolz * stolz@i2.informatik.rwth-aachen.de * PGP + S/MIME

The following is what I intend to commit. There's a gratuitious foldM_ as well. Index: Control/Monad.hs =================================================================== RCS file: /home/cvs/root/fptools/libraries/base/Control/Monad.hs,v retrieving revision 1.5 diff -r1.5 Monad.hs 29a30
, foldM_ -- :: (Monad m) => (a -> b -> m a) -> a -> [b] -> m ()
43a45,46
, replicateM -- :: (Monad m) => Int -> m a -> m [a] , replicateM_ -- :: (Monad m) => Int -> m a -> m ()
139a143,151
foldM_ :: (Monad m) => (a -> b -> m a) -> a -> [b] -> m () foldM_ f a xs = foldM f a xs >> return ()
replicateM :: (Monad m) => Int -> m a -> m [a] replicateM n x = sequence (replicate n x)
replicateM_ :: (Monad m) => Int -> m a -> m () replicateM_ n x = sequence_ (replicate n x)
-- plonk :: m a -> m () http://www-i2.informatik.rwth-aachen.de/stolz/ *** PGP *** S/MIME
participants (3)
-
Alastair Reid
-
Dean Herington
-
Volker Stolz