ZHaskell / z-data

array, slices and text

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Investgate rules to optimize `pack . replicateM`

winterland1989 opened this issue · comments

It's common to pack a vector from a list generated by replicateM:

V.pack . replicateM n $ do
    ...
V.packN n . replicateM n $ do

There should be rules to eliminate the list, probably already covered by foldM rules in the base, have to read the core to find out. If rules doesn't play out, should add vector version's replicateM :: Vec v a => Int -> m a -> m (v a)

Add replicateMVec in 0.8.8, closed.