--------------------------------------------------------------------- -- | -- Module : Control.Monad.GenericReplicate -- Copyright : Ken Takusagawa 2015 -- License : BSD-style -- -- Maintainer : kenta@mit.edu -- Stability : stable -- Portability : portable -- -- The monadic replicateM functions with repetition count generalized -- to any Integral type. --------------------------------------------------------------------- module Control.Monad.GenericReplicate ( genericReplicateM , genericReplicateM_ ) where{ import Data.List(genericReplicate); -- | The 'genericReplicateM' function is an overloaded version of -- 'Control.Monad.replicateM', which accepts any 'Integral' value as -- the number of repetitions. genericReplicateM :: (Monad m, Integral i) => i -> m a -> m [a]; genericReplicateM n = sequence . genericReplicate n; -- | The 'genericReplicateM_' function is an overloaded version of -- 'Control.Monad.replicateM_', which accepts any 'Integral' value as -- the number of repetitions. genericReplicateM_ :: (Monad m, Integral i) => i -> m a -> m (); genericReplicateM_ n = sequence_ . genericReplicate n; }