| Portability | portable |
|---|---|
| Stability | experimental |
| Maintainer | Reiner Pope <reiner.pope@gmail.com> |
| Safe Haskell | Safe-Infered |
Data.Vector.Generic.Mutable.STFreeze
Description
Proof-of-concept support for using vector's MVectors in the new ST monad. Reexports
only a minimal API from Data.Vector.Generic.Mutable, with all ST operations
done in the new ST (indexed) monad.
Notable differences in API:
- the former
unsafeFreezeis in fact safe, and is now namedfreeze.
Example demonstration of using the new ST monad:
foo :: forall v. Vector v Int => (v Int, v Int) foo =runSTgo where go :: forall s.ST(Normals) (Freezes) (v Int, v Int) go = new 5 >>>= a1 -> new 6 >>>= a2 -> write a1 0 3 >>>= () -> write a2 1 2 >>>= () -> freeze a1 >>>= v1 -> freeze a2 >>>= v2 -> return (v1,v2)