Proposal: genericReplicateM

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Proposal: genericReplicateM

Ken T Takusagawa
Overloaded versions of replicateM and replicateM_ for any
Integral type:

genericReplicateM :: (Monad m, Integral i) => i -> m a -> m [a]
genericReplicateM n = sequence . genericReplicate n

genericReplicateM_ :: (Monad m, Integral i) => i -> m a -> m ()
genericReplicateM_ n = sequence_ . genericReplicate n

--ken
_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: genericReplicateM

Ryan Scott
This sounds like a good idea to me. This might be a good thing to
bundle with a separate proposal [1] to generalize replicateM(_) to use
Applicative instead of Monad.

[1] https://ghc.haskell.org/trac/ghc/ticket/10168
_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries