fixed-vector 1.2.2.1 → 1.2.3.0
raw patch · 9 files changed
+42/−18 lines, 9 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.Vector.Fixed: type family Dim (v :: * -> *) :: Nat
+ Data.Vector.Fixed: type family Dim (v :: Type -> Type) :: Nat
- Data.Vector.Fixed.Cont: type family Dim (v :: * -> *) :: Nat
+ Data.Vector.Fixed.Cont: type family Dim (v :: Type -> Type) :: Nat
- Data.Vector.Fixed.Mutable: type family DimM (v :: * -> * -> *) :: Nat
+ Data.Vector.Fixed.Mutable: type family DimM (v :: Type -> Type -> Type) :: Nat
Files
- ChangeLog.md +7/−0
- Data/Vector/Fixed.hs +20/−6
- Data/Vector/Fixed/Boxed.hs +1/−1
- Data/Vector/Fixed/Cont.hs +3/−2
- Data/Vector/Fixed/Mutable.hs +3/−2
- Data/Vector/Fixed/Primitive.hs +1/−1
- Data/Vector/Fixed/Storable.hs +1/−1
- Data/Vector/Fixed/Unboxed.hs +1/−1
- fixed-vector.cabal +5/−4
ChangeLog.md view
@@ -1,3 +1,10 @@+Changes in 1.2.3.0++ * Pattern `V1` added++ * `COMPLETE` pragmas added for patterns `V1`,`V2`,`V3`,`V4`++ Changes in 1.2.2.1 * Newtype `StorableViaFixed` for deriving `Storable` instances added.
Data/Vector/Fixed.hs view
@@ -69,6 +69,7 @@ , mk8 , mkN -- ** Pattern for low-dimension vectors+ , pattern V1 , pattern V2 , pattern V3 , pattern V4@@ -326,10 +327,10 @@ deriving (Show,Eq,Ord,Typeable,Data,Functor,F.Foldable,T.Traversable) instance Monoid a => Monoid (Only a) where- mempty = Only mempty- Only a `mappend` Only b = Only $ mappend a b+ mempty = Only mempty+ mappend = (<>) instance (Semigroup a) => Semigroup (Only a) where- Only a <> Only b = Only (a <> b)+ (<>) = coerce ((<>) @a) {-# INLINE (<>) #-} @@ -380,26 +381,39 @@ -- Patterns ---------------------------------------------------------------- +pattern V1 :: (Vector v a, Dim v ~ 1) => a -> v a+pattern V1 x <- (convert -> (Only x)) where+ V1 x = mk1 x+#if MIN_VERSION_base(4,16,0)+{-# INLINE V1 #-}+{-# COMPLETE V1 #-}+#endif+ pattern V2 :: (Vector v a, Dim v ~ 2) => a -> a -> v a pattern V2 x y <- (convert -> (x,y)) where V2 x y = mk2 x y #if MIN_VERSION_base(4,16,0)-{-# INLINE V2 #-}+{-# INLINE V2 #-}+{-# COMPLETE V2 #-} #endif pattern V3 :: (Vector v a, Dim v ~ 3) => a -> a -> a -> v a pattern V3 x y z <- (convert -> (x,y,z)) where V3 x y z = mk3 x y z #if MIN_VERSION_base(4,16,0)-{-# INLINE V3 #-}+{-# INLINE V3 #-}+{-# COMPLETE V3 #-} #endif pattern V4 :: (Vector v a, Dim v ~ 4) => a -> a -> a -> a -> v a pattern V4 t x y z <- (convert -> (t,x,y,z)) where V4 t x y z = mk4 t x y z #if MIN_VERSION_base(4,16,0)-{-# INLINE V4 #-}+{-# INLINE V4 #-}+{-# COMPLETE V4 #-} #endif++ -- $setup
Data/Vector/Fixed/Boxed.hs view
@@ -144,7 +144,7 @@ instance (Arity n, Monoid a) => Monoid (Vec n a) where mempty = replicate mempty- mappend = zipWith mappend+ mappend = (<>) {-# INLINE mempty #-} {-# INLINE mappend #-}
Data/Vector/Fixed/Cont.hs view
@@ -132,6 +132,7 @@ import Data.Coerce import Data.Complex (Complex(..)) import Data.Data (Data)+import Data.Kind (Type) import Data.Functor.Identity (Identity(..)) import Data.Typeable (Proxy(..)) import qualified Data.Foldable as F@@ -172,7 +173,7 @@ -- | Type family for n-ary functions. @n@ is number of parameters of -- type @a@ and @b@ is result type.-type family Fn (n :: PeanoNum) (a :: *) (b :: *) where+type family Fn (n :: PeanoNum) (a :: Type) (b :: Type) where Fn 'Z a b = b Fn ('S n) a b = a -> Fn n a b @@ -388,7 +389,7 @@ ---------------------------------------------------------------- -- | Size of vector expressed as type-level natural.-type family Dim (v :: * -> *) :: Nat+type family Dim (v :: Type -> Type) :: Nat -- | Type class for vectors with fixed length. Instance should provide -- two functions: one to create vector and another for vector
Data/Vector/Fixed/Mutable.hs view
@@ -41,6 +41,7 @@ import Control.Monad.ST import Control.Monad.Primitive import Data.Typeable (Proxy(..))+import Data.Kind (Type) import GHC.TypeLits import Data.Vector.Fixed.Cont (Dim,PeanoNum(..),Peano,Arity,Fun(..),Vector(..),ContVec,arity,apply,accum,length) import Prelude hiding (read,length,replicate)@@ -51,10 +52,10 @@ ---------------------------------------------------------------- -- | Mutable counterpart of fixed-length vector.-type family Mutable (v :: * -> *) :: * -> * -> *+type family Mutable (v :: Type -> Type) :: Type -> Type -> Type -- | Dimension for mutable vector.-type family DimM (v :: * -> * -> *) :: Nat+type family DimM (v :: Type -> Type -> Type) :: Nat -- | Type class for mutable vectors. class (Arity (DimM v)) => MVector v a where
Data/Vector/Fixed/Primitive.hs view
@@ -125,7 +125,7 @@ instance (Arity n, Prim a, Monoid a) => Monoid (Vec n a) where mempty = replicate mempty- mappend = zipWith mappend+ mappend = (<>) {-# INLINE mempty #-} {-# INLINE mappend #-}
Data/Vector/Fixed/Storable.hs view
@@ -162,7 +162,7 @@ instance (Arity n, Storable a, Monoid a) => Monoid (Vec n a) where mempty = replicate mempty- mappend = zipWith mappend+ mappend = (<>) {-# INLINE mempty #-} {-# INLINE mappend #-}
Data/Vector/Fixed/Unboxed.hs view
@@ -106,7 +106,7 @@ instance (Unbox n a, Monoid a) => Monoid (Vec n a) where mempty = replicate mempty- mappend = zipWith mappend+ mappend = (<>) {-# INLINE mempty #-} {-# INLINE mappend #-}
fixed-vector.cabal view
@@ -1,5 +1,5 @@ Name: fixed-vector-Version: 1.2.2.1+Version: 1.2.3.0 Synopsis: Generic vectors with statically known size. Description: Generic library for vectors with statically known@@ -59,15 +59,16 @@ || ==8.8.4 || ==8.10.7 || ==9.0.1- || ==9.2.3- || ==9.4.1+ || ==9.2.8+ || ==9.4.7+ || ==9.6.3 source-repository head type: git location: http://github.com/Shimuuar/fixed-vector Library- Ghc-options: -Wall+ Ghc-options: -Wall -Wno-incomplete-uni-patterns Default-Language: Haskell2010 Build-Depends: base >=4.11 && <5 , primitive >=0.6.2