-
Notifications
You must be signed in to change notification settings - Fork 141
Closed
Description
See the following export list for Data.Vector.Unboxed
:
vector/vector/src/Data/Vector/Unboxed.hs
Lines 61 to 63 in eb60526
module Data.Vector.Unboxed ( | |
-- * Unboxed vectors | |
Vector(V_UnboxAs, V_UnboxViaPrim), MVector(..), Unbox, |
All the constructors for the MVector
family are exported, which includes constructors for mutable unboxed tuple vectors (e.g., MV_2
). However, for immutable unboxed tuple vectors, the constructors are private.
Currently, to construct an unboxed tuple vector from the two underlying parallel vector without copying, one must go through MVector
and unsafeFreeze
, which seems a bit weird to me.
import Data.Vector.Unboxed qualified as U
pairUnboxed :: U.Vector a -> U.Vector b -> U.Vector (a, b)
pairUnboxed xs ys = do
xs' <- unsafeThaw xs
ys' <- unsafeThaw ys
let len = U.length xs
unsafeFreeze (MV_2 len xs' ys')
toyboot4e
Metadata
Metadata
Assignees
Labels
No labels