id,summary,reporter,owner,description,type,status,priority,milestone,version,resolution,keywords,cc
30,There is no safe analog of unsafeFreeze,anonymous,,"Summary is quite exhaustive here. Such function is required when one needs snapshot of mutable vector which will be mutated afterwards. Improper usage of unsafeFreeze already caused bug in mwc-random.

Here is safeFreeze I used:

{{{
-- Safe version of unsafeFreeze.
safeFreeze :: (PrimMonad m, Vector v a) => G.Mutable v (PrimState m) a -> m (v a)
safeFreeze v = do
  v' <- GM.unsafeNew (GM.length v)
  GM.unsafeCopy v' v
  unsafeFreeze v'
}}}
",defect,closed,major,,,worksforme,,alexey.skladnoy@…
