streamly icon indicating copy to clipboard operation
streamly copied to clipboard

Consider changing the signature of replicateM unfold

Open harendra-kumar opened this issue 3 years ago • 0 comments

replicateM :: Applicative m => Int -> Unfold m (m a) a

If the replication count depends on the input e.g. when we have to resample an array and we have to iterate as many times as the array length then we need the count to be passed via unfold i.e. it should be Unfold m (Int, m a) a. We can use concatMap to pass the count argument to replicateM but that won't perform well.

harendra-kumar avatar May 05 '22 19:05 harendra-kumar