replicateM :: Monad m => Int -> m a -> m [a]
replicateM = ...
it executes the monadic action n times, and stores the result for each time. This is semantically different from the replicateM in Contiguous, because no action is executed - the second argument is a pure value.
replicateM :: (PrimMonad m, Element arr b) => Int -> b -> m (Mutable arr (PrimState m) b)
I would think that to most users this would be confusing, because of most APIs using the semantics of the former for replicateM. I propose that we do the following:
change replicateM to replicateM :: Int -> m b -> m (Mutable arr (PrimState m) b)
replicateM usually looks like:
it executes the monadic action
n
times, and stores the result for each time. This is semantically different from thereplicateM
in Contiguous, because no action is executed - the second argument is a pure value.I would think that to most users this would be confusing, because of most APIs using the semantics of the former for
replicateM
. I propose that we do the following:replicateM
toreplicateM :: Int -> m b -> m (Mutable arr (PrimState m) b)
replicate :: Int -> b -> arr b
.