Hoogle Search
Within LTS Haskell 22.21 (ghc-9.6.5)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
-
Adaptive unboxed vectors. The implementation is based on type families and picks an efficient, specialised representation for every element type. For example, unboxed vectors of pairs are represented as pairs of unboxed vectors. Implementing unboxed vectors for new data types can be very easy. Here is how the library does this for Complex by simply wrapping vectors of pairs.
newtype instance MVector s (Complex a) = MV_Complex (MVector s (a,a)) newtype instance Vector (Complex a) = V_Complex (Vector (a,a)) instance (RealFloat a, Unbox a) => MVector MVector (Complex a) where {-# INLINE basicLength #-} basicLength (MV_Complex v) = basicLength v ... instance (RealFloat a, Unbox a) => Data.Vector.Generic.Vector Vector (Complex a) where {-# INLINE basicLength #-} basicLength (V_Complex v) = Data.Vector.Generic.basicLength v ... instance (RealFloat a, Unbox a) => Unbox (Complex a)
For newtypes, defining instances is easier since one could use GeneralizedNewtypeDeriving in order to derive instances for Vector and MVector, since they're very cumbersome to write by hand:>>> :set -XTypeFamilies -XStandaloneDeriving -XMultiParamTypeClasses -XGeneralizedNewtypeDeriving >>> >>> import qualified Data.Vector.Generic as VG >>> import qualified Data.Vector.Generic.Mutable as VGM >>> import qualified Data.Vector.Unboxed as VU >>> >>> newtype Foo = Foo Int >>> >>> newtype instance VU.MVector s Foo = MV_Int (VU.MVector s Int) >>> newtype instance VU.Vector Foo = V_Int (VU.Vector Int) >>> deriving instance VGM.MVector VU.MVector Foo >>> deriving instance VG.Vector VU.Vector Foo >>> instance VU.Unbox Foo
-
No documentation available.
module Rebase.Data.Vector.
Unboxed No documentation available.
module Data.Vector.Fixed.
Unboxed Unboxed vectors with fixed length.
-
unboxing-vector Data.Vector.Unboxing No documentation available.
fromUnboxedVector :: (Unboxable a, Rep a ~ a, IsTrivial a ~ 'True) => Vector a -> Vector aunboxing-vector Data.Vector.Unboxing No documentation available.
toUnboxedVector :: (Unboxable a, Rep a ~ a, IsTrivial a ~ 'True) => Vector a -> Vector aunboxing-vector Data.Vector.Unboxing No documentation available.
-
unboxing-vector Data.Vector.Unboxing.Mutable No documentation available.
fromUnboxedMVector :: (Unboxable a, Rep a ~ a, IsTrivial a ~ 'True) => MVector s a -> MVector s aunboxing-vector Data.Vector.Unboxing.Mutable No documentation available.
toUnboxedMVector :: (Unboxable a, Rep a ~ a, IsTrivial a ~ 'True) => MVector s a -> MVector s aunboxing-vector Data.Vector.Unboxing.Mutable No documentation available.
Page 1 of 2 | Next