packages feed

fixed-vector 0.7.0.3 → 0.8.0.0

raw patch · 10 files changed

+230/−24 lines, 10 filesdep +deepseqPVP ok

version bump matches the API change (PVP)

Dependencies added: deepseq

API changes (from Hackage documentation)

+ Data.Vector.Fixed: defaultAlignemnt :: Storable a => v a -> Int
+ Data.Vector.Fixed: defaultPeek :: (Storable a, Vector v a) => Ptr (v a) -> IO (v a)
+ Data.Vector.Fixed: defaultPoke :: (Storable a, Vector v a) => Ptr (v a) -> v a -> IO ()
+ Data.Vector.Fixed: defaultSizeOf :: (Storable a, Vector v a) => v a -> Int
+ Data.Vector.Fixed: instance (Arity n, NFData a) => NFData (VecList n a)
+ Data.Vector.Fixed: instance (Storable a, Arity n) => Storable (VecList n a)
+ Data.Vector.Fixed: instance NFData (Empty a)
+ Data.Vector.Fixed: instance NFData a => NFData (Only a)
+ Data.Vector.Fixed: instance Storable a => Storable (Only a)
+ Data.Vector.Fixed: izipWith3 :: (Vector v a, Vector v b, Vector v c, Vector v d) => (Int -> a -> b -> c -> d) -> v a -> v b -> v c -> v d
+ Data.Vector.Fixed: izipWithM_ :: (Vector v a, Vector v b, Vector v c, Monad m, Vector v (m c)) => (Int -> a -> b -> m c) -> v a -> v b -> m ()
+ Data.Vector.Fixed: zipWith3 :: (Vector v a, Vector v b, Vector v c, Vector v d) => (a -> b -> c -> d) -> v a -> v b -> v c -> v d
+ Data.Vector.Fixed: zipWithM_ :: (Vector v a, Vector v b, Monad m) => (a -> b -> m c) -> v a -> v b -> m ()
+ Data.Vector.Fixed.Boxed: instance (Arity n, NFData a) => NFData (Vec n a)
+ Data.Vector.Fixed.Boxed: instance (Storable a, Arity n) => Storable (Vec n a)
+ Data.Vector.Fixed.Cont: izipWith3 :: Arity n => (Int -> a -> b -> c -> d) -> ContVec n a -> ContVec n b -> ContVec n c -> ContVec n d
+ Data.Vector.Fixed.Cont: izipWithM_ :: (Arity n, Monad m) => (Int -> a -> b -> m c) -> ContVec n a -> ContVec n b -> m ()
+ Data.Vector.Fixed.Cont: zipWith3 :: Arity n => (a -> b -> c -> d) -> ContVec n a -> ContVec n b -> ContVec n c -> ContVec n d
+ Data.Vector.Fixed.Cont: zipWithM_ :: (Arity n, Monad m) => (a -> b -> m c) -> ContVec n a -> ContVec n b -> m ()
+ Data.Vector.Fixed.Primitive: instance (Arity n, Prim a, NFData a) => NFData (Vec n a)
+ Data.Vector.Fixed.Primitive: instance (Storable a, Prim a, Arity n) => Storable (Vec n a)
+ Data.Vector.Fixed.Storable: instance (Arity n, Storable a, NFData a) => NFData (Vec n a)
+ Data.Vector.Fixed.Unboxed: instance (Arity n, Unbox n a, NFData a) => NFData (Vec n a)
+ Data.Vector.Fixed.Unboxed: instance (Storable a, Unbox n a) => Storable (Vec n a)
- Data.Vector.Fixed.Cont: gunfoldF :: (Arity n, Arity n, Data a) => (forall b x. Data b => c (b -> x) -> c x) -> T_gunfold c r a n -> c r
+ Data.Vector.Fixed.Cont: gunfoldF :: (Arity n, Data a) => (forall b x. Data b => c (b -> x) -> c x) -> T_gunfold c r a n -> c r
- Data.Vector.Fixed.Cont: runContVec :: Arity n => Fun n a r -> ContVec n a -> r
+ Data.Vector.Fixed.Cont: runContVec :: Fun n a r -> ContVec n a -> r
- Data.Vector.Fixed.Storable: unsafeFromForeignPtr :: Storable a => ForeignPtr a -> Vec n a
+ Data.Vector.Fixed.Storable: unsafeFromForeignPtr :: ForeignPtr a -> Vec n a
- Data.Vector.Fixed.Storable: unsafeToForeignPtr :: Storable a => Vec n a -> ForeignPtr a
+ Data.Vector.Fixed.Storable: unsafeToForeignPtr :: Vec n a -> ForeignPtr a
- Data.Vector.Fixed.Storable: unsafeWith :: Storable a => (Ptr a -> IO b) -> Vec n a -> IO b
+ Data.Vector.Fixed.Storable: unsafeWith :: (Ptr a -> IO b) -> Vec n a -> IO b
- Data.Vector.Fixed.Unboxed: class (IVector (Vec n) a, MVector (MVec n) a) => Unbox n a
+ Data.Vector.Fixed.Unboxed: class (Arity n, IVector (Vec n) a, MVector (MVec n) a) => Unbox n a

Files

ChangeLog view
@@ -1,3 +1,13 @@+Changes in 0.8.0.0++  * NFData instances for all data type.++  * Storable instances for all data types and default implementation of+    Storable's methods added.++  * {i,}zipWith3 and {i,}zipWithM_ added.++ Changes in 0.7.0.3    * GHC 7.10 support
Data/Vector/Fixed.hs view
@@ -131,9 +131,19 @@   , any     -- * Zips   , zipWith+  , zipWith3   , zipWithM+  , zipWithM_   , izipWith+  , izipWith3   , izipWithM+  , izipWithM_+    -- * Storable methods+    -- $storable+  , defaultAlignemnt+  , defaultSizeOf+  , defaultPeek+  , defaultPoke     -- * Conversion   , convert   , toList@@ -153,10 +163,13 @@   ) where  import Control.Applicative (Applicative(..),(<$>))+import Control.DeepSeq     (NFData(..)) import Data.Data           (Typeable,Data) import Data.Monoid         (Monoid(..)) import qualified Data.Foldable    as F import qualified Data.Traversable as T+import Foreign.Storable (Storable(..))+import Foreign.Ptr      (castPtr)  import Data.Vector.Fixed.Cont     (Vector(..),VectorN,Dim,length,ContVec,vector,                                    empty,S,Z,Arity,Fun(..),accum,apply,@@ -164,7 +177,7 @@ import qualified Data.Vector.Fixed.Cont as C import Data.Vector.Fixed.Internal -import Prelude (Show(..),Eq(..),Ord(..),Functor(..),id,(.),($))+import Prelude (Show(..),Eq(..),Ord(..),Functor(..),id,(.),($),seq,undefined) -- Needed for doctest import Prelude (Char) @@ -210,7 +223,13 @@ -- Constructors for vectors with small dimensions.  +-- $storable+--+-- Default implementation of methods for Storable type class assumes+-- that individual elements of vector are stored as N-element array. ++ -------------------------------------------------------------------------------- -- We are trying to be clever with indexing here. It's not possible to -- write generic indexing function. For example it's necessary O(n)@@ -242,6 +261,10 @@   Cons :: a -> VecList n a -> VecList (S n) a   deriving (Typeable) +instance (Arity n, NFData a) => NFData (VecList n a) where+  rnf = foldl (\r a -> r `seq` rnf a) ()+  {-# INLINE rnf #-}+ -- Vector instance type instance Dim (VecList n) = n @@ -286,7 +309,18 @@   {-# INLINE mempty  #-}   {-# INLINE mappend #-} +instance (Storable a, Arity n) => Storable (VecList n a) where+  alignment = defaultAlignemnt+  sizeOf    = defaultSizeOf+  peek      = defaultPeek+  poke      = defaultPoke+  {-# INLINE alignment #-}+  {-# INLINE sizeOf    #-}+  {-# INLINE peek      #-}+  {-# INLINE poke      #-} ++ -- | Single-element tuple. newtype Only a = Only a                  deriving (Show,Eq,Ord,Typeable,Data)@@ -302,6 +336,9 @@   mempty = Only mempty   Only a `mappend` Only b = Only $ mappend a b +instance NFData a => NFData (Only a) where+  rnf (Only a) = rnf a+ type instance Dim Only = S Z  instance Vector Only a where@@ -310,6 +347,17 @@   {-# INLINE construct #-}   {-# INLINE inspect   #-} +instance (Storable a) => Storable (Only a) where+  alignment _ = alignment (undefined :: a)+  sizeOf    _ = sizeOf    (undefined :: a)+  peek p          = Only <$> peek (castPtr p)+  poke p (Only a) = poke (castPtr p) a+  {-# INLINE alignment #-}+  {-# INLINE sizeOf    #-}+  {-# INLINE peek      #-}+  {-# INLINE poke      #-}++ -- | Empty tuple. data Empty a = Empty deriving (Typeable, Data) @@ -320,6 +368,9 @@ instance T.Traversable Empty where   sequenceA Empty = pure Empty   traverse _ Empty = pure Empty++instance NFData (Empty a) where+  rnf Empty = ()  type instance Dim Empty = Z 
Data/Vector/Fixed/Boxed.hs view
@@ -20,13 +20,15 @@   ) where  import Control.Applicative  (Applicative(..))+import Control.DeepSeq      (NFData(..)) import Data.Primitive.Array import Data.Monoid          (Monoid(..)) import Data.Data import qualified Data.Foldable    as F import qualified Data.Traversable as T+import Foreign.Storable (Storable(..)) import Prelude (Show(..),Eq(..),Ord(..),Functor(..),Monad(..))-import Prelude ((++),($),($!),undefined,error)+import Prelude ((++),($),($!),undefined,error,seq)  import Data.Vector.Fixed hiding (index) import Data.Vector.Fixed.Mutable@@ -65,16 +67,25 @@   toConstr   _ = con_Vec   dataTypeOf _ = ty_Vec - ty_Vec :: DataType ty_Vec  = mkDataType "Data.Vector.Fixed.Boxed.Vec" [con_Vec]  con_Vec :: Constr con_Vec = mkConstr ty_Vec "Vec" [] Prefix +instance (Storable a, Arity n) => Storable (Vec n a) where+  alignment = defaultAlignemnt+  sizeOf    = defaultSizeOf+  peek      = defaultPeek+  poke      = defaultPoke+  {-# INLINE alignment #-}+  {-# INLINE sizeOf    #-}+  {-# INLINE peek      #-}+  {-# INLINE poke      #-}   + ---------------------------------------------------------------- -- Instances ----------------------------------------------------------------@@ -82,6 +93,9 @@ instance (Arity n, Show a) => Show (Vec n a) where   show v = "fromList " ++ show (toList v) +instance (Arity n, NFData a) => NFData (Vec n a) where+  rnf = foldl (\r a -> r `seq` rnf a) ()+  {-# INLINE rnf #-}  type instance Mutable (Vec n) = MVec n 
Data/Vector/Fixed/Cont.hs view
@@ -103,9 +103,13 @@   , reverse     -- ** Zips   , zipWith+  , zipWith3   , izipWith+  , izipWith3   , zipWithM+  , zipWithM_   , izipWithM+  , izipWithM_     -- * Running ContVec   , runContVec     -- ** Getters@@ -147,7 +151,7 @@ import qualified Data.Foldable    as F import qualified Data.Traversable as F -import Prelude hiding ( replicate,map,zipWith,maximum,minimum,and,or,any,all+import Prelude hiding ( replicate,map,zipWith,zipWith3,maximum,minimum,and,or,any,all                       , foldl,foldr,foldl1,length,sum,reverse,scanl,scanl1                       , head,tail,mapM,mapM_,sequence,sequence_,concat                       )@@ -286,7 +290,7 @@   -- | Reverse order of parameters.   reverseF :: Fun n a b -> Fun n a b   -- | Worker function for 'gunfold'-  gunfoldF :: (Arity n, Data a)+  gunfoldF :: (Data a)            => (forall b x. Data b => c (b -> x) -> c x)            -> T_gunfold c r a n -> c r   -- | Proof that `Fn (n+k) a b ~ Fn n a (Fn k a b)`@@ -888,6 +892,12 @@ {-# INLINE zipWith #-} zipWith = izipWith . const +-- | Zip three vectors together+zipWith3 :: (Arity n) => (a -> b -> c -> d)+         -> ContVec n a -> ContVec n b -> ContVec n c -> ContVec n d+{-# INLINE zipWith3 #-}+zipWith3 f v1 v2 v3 = zipWith (\a (b, c) -> f a b c) v1 (zipWith (,) v2 v3)+ -- | Zip two vector together using function which takes element index --   as well. izipWith :: (Arity n) => (Int -> a -> b -> c)@@ -898,12 +908,23 @@   $ inspect vecA   $ izipWithF f funC +-- | Zip three vectors together+izipWith3 :: (Arity n) => (Int -> a -> b -> c -> d)+          -> ContVec n a -> ContVec n b -> ContVec n c -> ContVec n d+{-# INLINE izipWith3 #-}+izipWith3 f v1 v2 v3 = izipWith (\i a (b, c) -> f i a b c) v1 (zipWith (,) v2 v3)+ -- | Zip two vector together using monadic function. zipWithM :: (Arity n, Monad m) => (a -> b -> m c)          -> ContVec n a -> ContVec n b -> m (ContVec n c) {-# INLINE zipWithM #-} zipWithM f v w = sequence $ zipWith f v w +zipWithM_ :: (Arity n, Monad m)+          => (a -> b -> m c) -> ContVec n a -> ContVec n b -> m ()+{-# INLINE zipWithM_ #-}+zipWithM_ f xs ys = sequence_ (zipWith f xs ys)+ -- | Zip two vector together using monadic function which takes element --   index as well.. izipWithM :: (Arity n, Monad m) => (Int -> a -> b -> m c)@@ -911,6 +932,10 @@ {-# INLINE izipWithM #-} izipWithM f v w = sequence $ izipWith f v w +izipWithM_ :: (Arity n, Monad m)+           => (Int -> a -> b -> m c) -> ContVec n a -> ContVec n b -> m ()+{-# INLINE izipWithM_ #-}+izipWithM_ f xs ys = sequence_ (izipWith f xs ys)  izipWithF :: forall n a b c r. (Arity n)           => (Int -> a -> b -> c) -> Fun n c r -> Fun n a (Fun n b r)@@ -942,8 +967,7 @@  -- | Run continuation vector. It's same as 'inspect' but with --   arguments flipped.-runContVec :: Arity n-           => Fun n a r+runContVec :: Fun n a r            -> ContVec n a            -> r runContVec f (ContVec c) = c f
Data/Vector/Fixed/Internal.hs view
@@ -1,9 +1,10 @@-{-# LANGUAGE TypeOperators         #-} {-# LANGUAGE FlexibleContexts      #-} {-# LANGUAGE FlexibleInstances     #-} {-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE TypeFamilies          #-} {-# LANGUAGE Rank2Types            #-}+{-# LANGUAGE ScopedTypeVariables   #-}+{-# LANGUAGE TypeFamilies          #-}+{-# LANGUAGE TypeOperators         #-} -- | -- Implementation of fixed-vectors module Data.Vector.Fixed.Internal where@@ -13,7 +14,8 @@ import Data.Monoid         (Monoid(..)) import qualified Data.Foldable    as T import qualified Data.Traversable as T-+import Foreign.Storable (Storable(..))+import Foreign.Ptr      (Ptr,castPtr)  import Data.Vector.Fixed.Cont     (Vector(..),Dim,S,Z,Arity,vector,Add) import qualified Data.Vector.Fixed.Cont as C@@ -523,6 +525,17 @@ zipWith f v u = vector               $ C.zipWith f (C.cvec v) (C.cvec u) +-- | Zip three vector together+zipWith3+  :: (Vector v a, Vector v b, Vector v c, Vector v d)+  => (a -> b -> c -> d)+  -> v a -> v b -> v c+  -> v d+{-# INLINE zipWith3 #-}+zipWith3 f v1 v2 v3+  = vector+  $ C.zipWith3 f (C.cvec v1) (C.cvec v2) (C.cvec v3)+ -- | Zip two vector together using monadic function. zipWithM :: (Vector v a, Vector v b, Vector v c, Monad m)          => (a -> b -> m c) -> v a -> v b -> m (v c)@@ -530,6 +543,14 @@ zipWithM f v u = liftM vector                $ C.zipWithM f (C.cvec v) (C.cvec u) +-- | Zip two vector elementwise using monadic function and discard+--   result+zipWithM_+  :: (Vector v a, Vector v b, Monad m)+  => (a -> b -> m c) -> v a -> v b -> m ()+{-# INLINE zipWithM_ #-}+zipWithM_ f xs ys = C.zipWithM_ f (C.cvec xs) (C.cvec ys)+ -- | Zip two vector together using function which takes element index --   as well. izipWith :: (Vector v a, Vector v b, Vector v c)@@ -538,6 +559,17 @@ izipWith f v u = vector                $ C.izipWith f (C.cvec v) (C.cvec u) +-- | Zip three vector together+izipWith3+  :: (Vector v a, Vector v b, Vector v c, Vector v d)+  => (Int -> a -> b -> c -> d)+  -> v a -> v b -> v c+  -> v d+{-# INLINE izipWith3 #-}+izipWith3 f v1 v2 v3+  = vector+  $ C.izipWith3 f (C.cvec v1) (C.cvec v2) (C.cvec v3)+ -- | Zip two vector together using monadic function which takes element --   index as well.. izipWithM :: (Vector v a, Vector v b, Vector v c, Monad m)@@ -545,6 +577,45 @@ {-# INLINE izipWithM #-} izipWithM f v u = liftM vector                 $ C.izipWithM f (C.cvec v) (C.cvec u)++-- | Zip two vector elementwise using monadic function and discard+--   result+izipWithM_+  :: (Vector v a, Vector v b, Vector v c, Monad m, Vector v (m c))+  => (Int -> a -> b -> m c) -> v a -> v b -> m ()+{-# INLINE izipWithM_ #-}+izipWithM_ f xs ys = C.izipWithM_ f (C.cvec xs) (C.cvec ys)+++----------------------------------------------------------------++-- | Default implementation of 'alignment' for 'Storable' type class+--   for fixed vectors.+defaultAlignemnt :: forall a v. Storable a => v a -> Int+defaultAlignemnt _ = alignment (undefined :: a)+{-# INLINE defaultAlignemnt #-}++-- | Default implementation of 'sizeOf` for 'Storable' type class for+--   fixed vectors+defaultSizeOf+  :: forall a v. (Storable a, Vector v a)+  => v a -> Int+defaultSizeOf _ = sizeOf (undefined :: a) * C.arity (undefined :: Dim v)+{-# INLINE defaultSizeOf #-}++-- | Default implementation of 'peek' for 'Storable' type class for+--   fixed vector+defaultPeek :: (Storable a, Vector v a) => Ptr (v a) -> IO (v a)+{-# INLINE defaultPeek #-}+defaultPeek ptr+  = generateM (peekElemOff (castPtr ptr))++-- | Default implementation of 'poke' for 'Storable' type class for+--   fixed vector+defaultPoke :: (Storable a, Vector v a) => Ptr (v a) -> v a -> IO ()+{-# INLINE defaultPoke #-}+defaultPoke ptr+  = imapM_ (pokeElemOff (castPtr ptr))   ----------------------------------------------------------------
Data/Vector/Fixed/Monomorphic.hs view
@@ -1,7 +1,8 @@+{-# LANGUAGE FlexibleContexts      #-}+{-# LANGUAGE FlexibleInstances     #-} {-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeFamilies          #-}+{-# LANGUAGE UndecidableInstances  #-} -- | -- Wrapper function for working with monomorphic vectors. Standard API -- require vector to be parametric in their element type making it
Data/Vector/Fixed/Primitive.hs view
@@ -24,12 +24,14 @@   ) where  import Control.Monad+import Control.DeepSeq (NFData(..)) import Data.Data import Data.Monoid              (Monoid(..)) import Data.Primitive.ByteArray import Data.Primitive+import qualified Foreign.Storable as Foreign (Storable(..)) import Prelude (Show(..),Eq(..),Ord(..),Num(..))-import Prelude ((++),($),($!),undefined)+import Prelude ((++),($),($!),undefined,seq)   import Data.Vector.Fixed hiding (index)@@ -71,7 +73,9 @@ instance (Arity n, Prim a, Show a) => Show (Vec n a) where   show v = "fromList " ++ show (toList v) -+instance (Arity n, Prim a, NFData a) => NFData (Vec n a) where+  rnf = foldl (\r a -> r `seq` rnf a) ()+  {-# INLINE rnf #-}  type instance Mutable (Vec n) = MVec n @@ -138,3 +142,12 @@ con_Vec :: Constr con_Vec = mkConstr ty_Vec "Vec" [] Prefix +instance (Foreign.Storable a, Prim a, Arity n) => Foreign.Storable (Vec n a) where+  alignment = defaultAlignemnt+  sizeOf    = defaultSizeOf+  peek      = defaultPeek+  poke      = defaultPoke+  {-# INLINE alignment #-}+  {-# INLINE sizeOf    #-}+  {-# INLINE peek      #-}+  {-# INLINE poke      #-}
Data/Vector/Fixed/Storable.hs view
@@ -26,6 +26,7 @@   ) where  import Control.Monad.Primitive+import Control.DeepSeq (NFData(..)) import Data.Monoid           (Monoid(..)) import Data.Data import Foreign.Ptr           (castPtr)@@ -35,7 +36,7 @@ import GHC.ForeignPtr        ( ForeignPtr(..), mallocPlainForeignPtrBytes ) import GHC.Ptr               ( Ptr(..) ) import Prelude (Show(..),Eq(..),Ord(..),Num(..),Monad(..),IO,Int)-import Prelude ((++),(&&),(||),($),undefined)+import Prelude ((++),(&&),(||),($),undefined,seq)  import Data.Vector.Fixed hiding (index) import Data.Vector.Fixed.Mutable@@ -74,16 +75,16 @@ ----------------------------------------------------------------  -- | Get underlying pointer. Data may not be modified through pointer.-unsafeToForeignPtr :: Storable a => Vec n a -> ForeignPtr a+unsafeToForeignPtr :: Vec n a -> ForeignPtr a {-# INLINE unsafeToForeignPtr #-} unsafeToForeignPtr (Vec fp) = fp  -- | Construct vector from foreign pointer.-unsafeFromForeignPtr :: Storable a => ForeignPtr a -> Vec n a+unsafeFromForeignPtr :: ForeignPtr a -> Vec n a {-# INLINE unsafeFromForeignPtr #-} unsafeFromForeignPtr = Vec -unsafeWith :: Storable a => (Ptr a -> IO b) -> Vec n a -> IO b+unsafeWith :: (Ptr a -> IO b) -> Vec n a -> IO b {-# INLINE unsafeWith #-} unsafeWith f (Vec fp) = f (getPtr fp) @@ -96,7 +97,9 @@ instance (Arity n, Storable a, Show a) => Show (Vec n a) where   show v = "fromList " ++ show (toList v) -+instance (Arity n, Storable a, NFData a) => NFData (Vec n a) where+  rnf = foldl (\r a -> r `seq` rnf a) ()+  {-# INLINE rnf #-}  type instance Mutable (Vec n) = MVec n 
Data/Vector/Fixed/Unboxed.hs view
@@ -24,15 +24,19 @@   ) where  import Control.Monad+import Control.DeepSeq (NFData(..)) import Data.Complex import Data.Monoid     (Monoid(..)) import Data.Data import Data.Int        (Int8, Int16, Int32, Int64 ) import Data.Word       (Word,Word8,Word16,Word32,Word64)+import Foreign.Storable (Storable(..)) import Prelude (Show(..),Eq(..),Ord(..),Int,Double,Float,Char,Bool(..))-import Prelude ((++),(||),($),(.))+import Prelude ((++),(||),($),(.),seq) -import Data.Vector.Fixed (Dim,Vector(..),VectorN,S,Z,toList,eq,ord,replicate,zipWith)+import Data.Vector.Fixed (Dim,Vector(..),VectorN,S,Z,toList,eq,ord,replicate,zipWith,foldl,+                          defaultSizeOf,defaultAlignemnt,defaultPeek,defaultPoke+                         ) import Data.Vector.Fixed.Mutable import qualified Data.Vector.Fixed.Cont      as C import qualified Data.Vector.Fixed.Primitive as P@@ -60,7 +64,7 @@ type Vec4 = Vec (S (S (S (S Z)))) type Vec5 = Vec (S (S (S (S (S Z))))) -class (IVector (Vec n) a, MVector (MVec n) a) => Unbox n a+class (Arity n, IVector (Vec n) a, MVector (MVec n) a) => Unbox n a   ----------------------------------------------------------------@@ -70,6 +74,10 @@ instance (Arity n, Show a, Unbox n a) => Show (Vec n a) where   show v = "fromList " ++ show (toList v) +instance (Arity n, Unbox n a, NFData a) => NFData (Vec n a) where+  rnf = foldl (\r a -> r `seq` rnf a) ()+  {-# INLINE rnf #-}+ type instance Mutable (Vec n) = MVec n  type instance Dim  (Vec  n) = n@@ -110,6 +118,16 @@  con_Vec :: Constr con_Vec = mkConstr ty_Vec "Vec" [] Prefix++instance (Storable a, Unbox n a) => Storable (Vec n a) where+  alignment = defaultAlignemnt+  sizeOf    = defaultSizeOf+  peek      = defaultPeek+  poke      = defaultPoke+  {-# INLINE alignment #-}+  {-# INLINE sizeOf    #-}+  {-# INLINE peek      #-}+  {-# INLINE poke      #-}   
fixed-vector.cabal view
@@ -1,5 +1,5 @@ Name:           fixed-vector-Version:        0.7.0.3+Version:        0.8.0.0 Synopsis:       Generic vectors with statically known size. Description:   Generic library for vectors with statically known@@ -67,6 +67,7 @@   Ghc-options:          -Wall   Build-Depends:     base >=3 && <5,+    deepseq,     primitive   Exposed-modules:     -- API