sized-vector 1.0.0.0 → 1.1.0.0
raw patch · 2 files changed
+22/−1 lines, 2 filesdep +deepseqdep +hashable
Dependencies added: deepseq, hashable
Files
- Data/Vector/Sized.hs +19/−0
- sized-vector.cabal +3/−1
Data/Vector/Sized.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE DataKinds, GADTs, MultiParamTypeClasses, PolyKinds #-} {-# LANGUAGE ScopedTypeVariables, StandaloneDeriving, TypeFamilies #-}@@ -34,6 +35,8 @@ zip, zipSame, zipWith, zipWithSame, unzip ) where import Control.Applicative+import Control.DeepSeq+import Data.Hashable import Data.Maybe import Data.Type.Monomorphic import Data.Type.Natural hiding (promote)@@ -416,3 +419,19 @@ unzip ((a, b) :- ps) = let (as, bs) = unzip ps in (a :- as, b :- bs)++instance NFData a => NFData (Vector a n) where+ rnf = rnfVector++rnfVector :: NFData a => Vector a n -> ()+rnfVector Nil = Nil `seq` ()+rnfVector (x :- xs) = rnf x `seq` rnf xs `seq` ()++vecHashWithSalt :: Hashable a => Int -> Vector a n -> Int+vecHashWithSalt salt Nil = salt `combine` 0+vecHashWithSalt salt xs = foldl hashWithSalt salt xs++instance Hashable a => Hashable (Vector a n) where+ hash Nil = 0+ hash (a :- as) = foldl hashWithSalt (hash a) as+ hashWithSalt = vecHashWithSalt
sized-vector.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: sized-vector-version: 1.0.0.0+version: 1.1.0.0 synopsis: Size-parameterized vector types and functions. description: Size-parameterized vector types and functions using a data-type promotion. homepage: https://github.com/konn/sized-vector@@ -26,3 +26,5 @@ , type-natural >= 0.0.2.0 , monomorphic == 0.0.* , equational-reasoning == 0.0.*+ , hashable == 1.1.*+ , deepseq == 1.3.*