How do you build IOVector from MVector? IOVector is documented as:
type IOVector = MVector RealWorld
I have a MVector like below, and will like to construct IOVector (for input to MSV.unsafeWith function – MSV is short-hand for Data.Vector.Storable.Mutable library):
v <- MSV.replicate 5 0 :: (IO (MVector (PrimState IO) CShort))
(from the primitive package’s source code)
So an
MVector (PrimState IO)is anMVector RealWorldand, thus, anIOVector; you can use it directly.IOVectoris just a convenience synonym so you don’t have to type outMVector RealWorldall the time 🙂