fixed-vector 1.0.0.0 → 1.1.0.0
raw patch · 7 files changed
+42/−2 lines, 7 filesdep +semigroupsdep ~basePVP ok
version bump matches the API change (PVP)
Dependencies added: semigroups
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Data.Vector.Fixed: instance (Data.Vector.Fixed.Cont.Arity n, Data.Semigroup.Semigroup a) => Data.Semigroup.Semigroup (Data.Vector.Fixed.VecList n a)
+ Data.Vector.Fixed: instance Data.Semigroup.Semigroup a => Data.Semigroup.Semigroup (Data.Vector.Fixed.Only a)
+ Data.Vector.Fixed.Boxed: instance (Data.Vector.Fixed.Cont.Arity n, Data.Semigroup.Semigroup a) => Data.Semigroup.Semigroup (Data.Vector.Fixed.Boxed.Vec n a)
+ Data.Vector.Fixed.Primitive: instance (Data.Vector.Fixed.Cont.Arity n, Data.Primitive.Types.Prim a, Data.Semigroup.Semigroup a) => Data.Semigroup.Semigroup (Data.Vector.Fixed.Primitive.Vec n a)
+ Data.Vector.Fixed.Storable: instance (Data.Vector.Fixed.Cont.Arity n, Foreign.Storable.Storable a, Data.Semigroup.Semigroup a) => Data.Semigroup.Semigroup (Data.Vector.Fixed.Storable.Vec n a)
+ Data.Vector.Fixed.Unboxed: instance (Data.Vector.Fixed.Unboxed.Unbox n a, Data.Semigroup.Semigroup a) => Data.Semigroup.Semigroup (Data.Vector.Fixed.Unboxed.Vec n a)
- Data.Vector.Fixed: [Cons] :: a -> VecPeano n a -> VecPeano (S n) a
+ Data.Vector.Fixed: [Cons] :: a -> VecPeano n a -> VecPeano ( 'S n) a
- Data.Vector.Fixed: [Nil] :: VecPeano Z a
+ Data.Vector.Fixed: [Nil] :: VecPeano 'Z a
- Data.Vector.Fixed: class Arity (Dim v) => Vector v a where basicIndex v i = index i (cvec v)
+ Data.Vector.Fixed: class Arity (Dim v) => Vector v a
- Data.Vector.Fixed: type Arity n = (ArityPeano (Peano n), KnownNat n, Peano (n + 1) ~ S (Peano n))
+ Data.Vector.Fixed: type Arity n = (ArityPeano (Peano n), KnownNat n, Peano (n + 1) ~ 'S (Peano n))
- Data.Vector.Fixed.Cont: accum :: ArityPeano n => (forall k. t (S k) -> a -> t k) -> (t Z -> b) -> t n -> Fun n a b
+ Data.Vector.Fixed.Cont: accum :: ArityPeano n => (forall k. t ( 'S k) -> a -> t k) -> (t 'Z -> b) -> t n -> Fun n a b
- Data.Vector.Fixed.Cont: apLast :: ArityPeano n => Fun (S n) a b -> a -> Fun n a b
+ Data.Vector.Fixed.Cont: apLast :: ArityPeano n => Fun ( 'S n) a b -> a -> Fun n a b
- Data.Vector.Fixed.Cont: apply :: Arity n => (forall k. t (S k) -> (a, t k)) -> t (Peano n) -> ContVec n a
+ Data.Vector.Fixed.Cont: apply :: Arity n => (forall k. t ( 'S k) -> (a, t k)) -> t (Peano n) -> ContVec n a
- Data.Vector.Fixed.Cont: applyFun :: ArityPeano n => (forall k. t (S k) -> (a, t k)) -> t n -> (CVecPeano n a, t Z)
+ Data.Vector.Fixed.Cont: applyFun :: ArityPeano n => (forall k. t ( 'S k) -> (a, t k)) -> t n -> (CVecPeano n a, t 'Z)
- Data.Vector.Fixed.Cont: applyFunM :: (ArityPeano n, Applicative f) => (forall k. t (S k) -> (f a, t k)) -> t n -> (f (CVecPeano n a), t Z)
+ Data.Vector.Fixed.Cont: applyFunM :: (ArityPeano n, Applicative f) => (forall k. t ( 'S k) -> (f a, t k)) -> t n -> (f (CVecPeano n a), t 'Z)
- Data.Vector.Fixed.Cont: applyM :: (Applicative f, Arity n) => (forall k. t (S k) -> (f a, t k)) -> t (Peano n) -> f (ContVec n a)
+ Data.Vector.Fixed.Cont: applyM :: (Applicative f, Arity n) => (forall k. t ( 'S k) -> (f a, t k)) -> t (Peano n) -> f (ContVec n a)
- Data.Vector.Fixed.Cont: class Arity (Dim v) => Vector v a where basicIndex v i = index i (cvec v)
+ Data.Vector.Fixed.Cont: class Arity (Dim v) => Vector v a
- Data.Vector.Fixed.Cont: consPeano :: a -> CVecPeano n a -> CVecPeano (S n) a
+ Data.Vector.Fixed.Cont: consPeano :: a -> CVecPeano n a -> CVecPeano ( 'S n) a
- Data.Vector.Fixed.Cont: constFun :: Fun n a b -> Fun (S n) a b
+ Data.Vector.Fixed.Cont: constFun :: Fun n a b -> Fun ( 'S n) a b
- Data.Vector.Fixed.Cont: curryFirst :: Fun (S n) a b -> a -> Fun n a b
+ Data.Vector.Fixed.Cont: curryFirst :: Fun ( 'S n) a b -> a -> Fun n a b
- Data.Vector.Fixed.Cont: curryLast :: ArityPeano n => Fun (S n) a b -> Fun n a (a -> b)
+ Data.Vector.Fixed.Cont: curryLast :: ArityPeano n => Fun ( 'S n) a b -> Fun n a (a -> b)
- Data.Vector.Fixed.Cont: gunfoldF :: (ArityPeano 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 :: (ArityPeano 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: type Arity n = (ArityPeano (Peano n), KnownNat n, Peano (n + 1) ~ S (Peano n))
+ Data.Vector.Fixed.Cont: type Arity n = (ArityPeano (Peano n), KnownNat n, Peano (n + 1) ~ 'S (Peano n))
- Data.Vector.Fixed.Cont: uncurryFirst :: (a -> Fun n a b) -> Fun (S n) a b
+ Data.Vector.Fixed.Cont: uncurryFirst :: (a -> Fun n a b) -> Fun ( 'S n) a b
- Data.Vector.Fixed.Cont: withFun :: (Fun n a b -> Fun n a b) -> Fun (S n) a b -> Fun (S n) a b
+ Data.Vector.Fixed.Cont: withFun :: (Fun n a b -> Fun n a b) -> Fun ( 'S n) a b -> Fun ( 'S n) a b
- Data.Vector.Fixed.Mutable: type Arity n = (ArityPeano (Peano n), KnownNat n, Peano (n + 1) ~ S (Peano n))
+ Data.Vector.Fixed.Mutable: type Arity n = (ArityPeano (Peano n), KnownNat n, Peano (n + 1) ~ 'S (Peano n))
Files
- ChangeLog.md +5/−0
- Data/Vector/Fixed.hs +11/−1
- Data/Vector/Fixed/Boxed.hs +5/−0
- Data/Vector/Fixed/Primitive.hs +7/−0
- Data/Vector/Fixed/Storable.hs +6/−0
- Data/Vector/Fixed/Unboxed.hs +5/−0
- fixed-vector.cabal +3/−1
ChangeLog.md view
@@ -1,3 +1,8 @@+Changes in 1.1.0.0++ * GHC8.4 compatibility release. Semigroup instances added and+ semigroup dependency added for GHC7.10+ Changes in 1.0.0.0 * Vector length now expressed as GHC's type level literals. Underlying
Data/Vector/Fixed.hs view
@@ -162,6 +162,7 @@ import Control.DeepSeq (NFData(..)) import Data.Data (Typeable,Data) import Data.Monoid (Monoid(..))+import Data.Semigroup (Semigroup(..)) import qualified Data.Foldable as F import qualified Data.Traversable as T import Foreign.Storable (Storable(..))@@ -183,7 +184,7 @@ -- There are several ways to construct fixed vectors except using -- their constructor if it's available. For small ones it's possible -- to use functions 'mk1', 'mk2', etc.--- +-- -- >>> mk3 'a' 'b' 'c' :: (Char,Char,Char) -- ('a','b','c') --@@ -274,6 +275,11 @@ {-# INLINE mempty #-} {-# INLINE mappend #-} +instance (Arity n, Semigroup a) => Semigroup (VecList n a) where+ (<>) = zipWith (<>)+ {-# INLINE (<>) #-}++ instance (Storable a, Arity n) => Storable (VecList n a) where alignment = defaultAlignemnt sizeOf = defaultSizeOf@@ -300,6 +306,10 @@ instance Monoid a => Monoid (Only a) where mempty = Only mempty Only a `mappend` Only b = Only $ mappend a b+instance (Semigroup a) => Semigroup (Only a) where+ Only a <> Only b = Only (a <> b)+ {-# INLINE (<>) #-}+ instance NFData a => NFData (Only a) where rnf (Only a) = rnf a
Data/Vector/Fixed/Boxed.hs view
@@ -25,6 +25,7 @@ import Control.DeepSeq (NFData(..)) import Data.Primitive.SmallArray import Data.Monoid (Monoid(..))+import Data.Semigroup (Semigroup(..)) import Data.Data import qualified Data.Foldable as F import qualified Data.Traversable as T@@ -145,6 +146,10 @@ mappend = zipWith mappend {-# INLINE mempty #-} {-# INLINE mappend #-}++instance (Arity n, Semigroup a) => Semigroup (Vec n a) where+ (<>) = zipWith (<>)+ {-# INLINE (<>) #-} instance Arity n => Functor (Vec n) where {-# INLINE fmap #-}
Data/Vector/Fixed/Primitive.hs view
@@ -6,6 +6,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE UndecidableInstances #-} -- | -- Unboxed vectors with fixed length. Vectors from -- "Data.Vector.Fixed.Unboxed" provide more flexibility at no@@ -28,6 +29,7 @@ import Control.DeepSeq (NFData(..)) import Data.Data import Data.Monoid (Monoid(..))+import Data.Semigroup (Semigroup(..)) import Data.Primitive.ByteArray import Data.Primitive import qualified Foreign.Storable as Foreign (Storable(..))@@ -125,6 +127,11 @@ mappend = zipWith mappend {-# INLINE mempty #-} {-# INLINE mappend #-}++instance (Arity n, Prim a, Semigroup a) => Semigroup (Vec n a) where+ (<>) = zipWith (<>)+ {-# INLINE (<>) #-}+ instance (Typeable n, Arity n, Prim a, Data a) => Data (Vec n a) where gfoldl = C.gfoldl
Data/Vector/Fixed/Storable.hs view
@@ -6,6 +6,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE UndecidableInstances #-} -- | -- Storable-based unboxed vectors. module Data.Vector.Fixed.Storable (@@ -29,6 +30,7 @@ import Control.Monad.Primitive import Control.DeepSeq (NFData(..)) import Data.Monoid (Monoid(..))+import Data.Semigroup (Semigroup(..)) import Data.Data import Foreign.Ptr (castPtr) import Foreign.Storable@@ -162,6 +164,10 @@ mappend = zipWith mappend {-# INLINE mempty #-} {-# INLINE mappend #-}++instance (Arity n, Storable a, Semigroup a) => Semigroup (Vec n a) where+ (<>) = zipWith (<>)+ {-# INLINE (<>) #-} instance (Arity n, Storable a) => Storable (Vec n a) where sizeOf _ = arity (Proxy :: Proxy n)
Data/Vector/Fixed/Unboxed.hs view
@@ -33,6 +33,7 @@ import Data.Functor.Identity (Identity(..)) import Data.Int (Int8, Int16, Int32, Int64 ) import Data.Monoid (Monoid(..),Dual(..),Sum(..),Product(..),All(..),Any(..))+import Data.Semigroup (Semigroup(..)) import Data.Ord (Down(..)) import Data.Word (Word,Word8,Word16,Word32,Word64) import Foreign.Storable (Storable(..))@@ -107,6 +108,10 @@ mappend = zipWith mappend {-# INLINE mempty #-} {-# INLINE mappend #-}++instance (Unbox n a, Semigroup a) => Semigroup (Vec n a) where+ (<>) = zipWith (<>)+ {-# INLINE (<>) #-} instance (Typeable n, Unbox n a, Data a) => Data (Vec n a) where gfoldl = C.gfoldl
fixed-vector.cabal view
@@ -1,5 +1,5 @@ Name: fixed-vector-Version: 1.0.0.0+Version: 1.1.0.0 Synopsis: Generic vectors with statically known size. Description: Generic library for vectors with statically known@@ -62,6 +62,8 @@ Build-Depends: base >=4.8 && <5 , primitive >=0.6.2 , deepseq+ if impl(ghc < 8.0)+ Build-Depends: semigroups >= 0.18 Exposed-modules: -- API Data.Vector.Fixed.Cont