fixed-vector-hetero 0.6.1.1 → 0.6.2.0
raw patch · 6 files changed
+54/−37 lines, 6 filesdep ~basedep ~doctestPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, doctest
API changes (from Hackage documentation)
- Data.Vector.HFixed: type family ValueAt n xs :: *
- Data.Vector.HFixed.Class: instance (Data.Primitive.Types.Prim a, Data.Vector.HFixed.Class.HomArity (Data.Vector.Fixed.Cont.Peano n) a, GHC.TypeNats.KnownNat n, Data.Vector.Fixed.Cont.Peano (n GHC.TypeNats.+ 1) GHC.Types.~ 'Data.Vector.Fixed.Cont.S (Data.Vector.Fixed.Cont.Peano n)) => Data.Vector.HFixed.Class.HVector (Data.Vector.Fixed.Primitive.Vec n a)
- Data.Vector.HFixed.Class: instance (Data.Vector.Fixed.Unboxed.Unbox n a, Data.Vector.HFixed.Class.HomArity (Data.Vector.Fixed.Cont.Peano n) a, GHC.TypeNats.KnownNat n, Data.Vector.Fixed.Cont.Peano (n GHC.TypeNats.+ 1) GHC.Types.~ 'Data.Vector.Fixed.Cont.S (Data.Vector.Fixed.Cont.Peano n)) => Data.Vector.HFixed.Class.HVector (Data.Vector.Fixed.Unboxed.Vec n a)
- Data.Vector.HFixed.Class: instance (Data.Vector.HFixed.Class.HomArity (Data.Vector.Fixed.Cont.Peano n) a, GHC.TypeNats.KnownNat n, Data.Vector.Fixed.Cont.Peano (n GHC.TypeNats.+ 1) GHC.Types.~ 'Data.Vector.Fixed.Cont.S (Data.Vector.Fixed.Cont.Peano n)) => Data.Vector.HFixed.Class.HVector (Data.Vector.Fixed.Boxed.Vec n a)
- Data.Vector.HFixed.Class: instance (Foreign.Storable.Storable a, Data.Vector.HFixed.Class.HomArity (Data.Vector.Fixed.Cont.Peano n) a, GHC.TypeNats.KnownNat n, Data.Vector.Fixed.Cont.Peano (n GHC.TypeNats.+ 1) GHC.Types.~ 'Data.Vector.Fixed.Cont.S (Data.Vector.Fixed.Cont.Peano n)) => Data.Vector.HFixed.Class.HVector (Data.Vector.Fixed.Storable.Vec n a)
- Data.Vector.HFixed.Class: instance forall α (c :: α -> GHC.Types.Constraint). Data.Vector.HFixed.Class.ArityC c '[]
+ Data.Vector.HFixed: type ElemsF v :: [α];
+ Data.Vector.HFixed: type ValueAt n xs :: Type
+ Data.Vector.HFixed.Class: instance (Data.Primitive.Types.Prim a, Data.Vector.HFixed.Class.HomArity (Data.Vector.Fixed.Cont.Peano n) a, Data.Vector.HFixed.Class.Arity (Data.Vector.HFixed.TypeFuns.HomList (Data.Vector.Fixed.Cont.Peano n) a), GHC.TypeNats.KnownNat n, Data.Vector.Fixed.Cont.Peano (n GHC.TypeNats.+ 1) GHC.Types.~ 'Data.Vector.Fixed.Cont.S (Data.Vector.Fixed.Cont.Peano n)) => Data.Vector.HFixed.Class.HVector (Data.Vector.Fixed.Primitive.Vec n a)
+ Data.Vector.HFixed.Class: instance (Data.Vector.Fixed.Unboxed.Unbox n a, Data.Vector.HFixed.Class.HomArity (Data.Vector.Fixed.Cont.Peano n) a, Data.Vector.HFixed.Class.Arity (Data.Vector.HFixed.TypeFuns.HomList (Data.Vector.Fixed.Cont.Peano n) a), GHC.TypeNats.KnownNat n, Data.Vector.Fixed.Cont.Peano (n GHC.TypeNats.+ 1) GHC.Types.~ 'Data.Vector.Fixed.Cont.S (Data.Vector.Fixed.Cont.Peano n)) => Data.Vector.HFixed.Class.HVector (Data.Vector.Fixed.Unboxed.Vec n a)
+ Data.Vector.HFixed.Class: instance (Data.Vector.HFixed.Class.HomArity (Data.Vector.Fixed.Cont.Peano n) a, Data.Vector.HFixed.Class.Arity (Data.Vector.HFixed.TypeFuns.HomList (Data.Vector.Fixed.Cont.Peano n) a), GHC.TypeNats.KnownNat n, Data.Vector.Fixed.Cont.Peano (n GHC.TypeNats.+ 1) GHC.Types.~ 'Data.Vector.Fixed.Cont.S (Data.Vector.Fixed.Cont.Peano n)) => Data.Vector.HFixed.Class.HVector (Data.Vector.Fixed.Boxed.Vec n a)
+ Data.Vector.HFixed.Class: instance (Foreign.Storable.Storable a, Data.Vector.HFixed.Class.HomArity (Data.Vector.Fixed.Cont.Peano n) a, Data.Vector.HFixed.Class.Arity (Data.Vector.HFixed.TypeFuns.HomList (Data.Vector.Fixed.Cont.Peano n) a), GHC.TypeNats.KnownNat n, Data.Vector.Fixed.Cont.Peano (n GHC.TypeNats.+ 1) GHC.Types.~ 'Data.Vector.Fixed.Cont.S (Data.Vector.Fixed.Cont.Peano n)) => Data.Vector.HFixed.Class.HVector (Data.Vector.Fixed.Storable.Vec n a)
+ Data.Vector.HFixed.Class: instance forall k (c :: k -> GHC.Types.Constraint). Data.Vector.HFixed.Class.ArityC c '[]
+ Data.Vector.HFixed.Class: type ElemsF v :: [α];
+ Data.Vector.HFixed.Class: type NewElems n xs a :: [Type];
+ Data.Vector.HFixed.Class: type ValueAt n xs :: Type;
+ Data.Vector.HFixed.Cont: type ElemsF v :: [α];
+ Data.Vector.HFixed.Cont: type ValueAt n xs :: Type
- Data.Vector.HFixed: ContVecF :: (forall r. TFun f xs r -> r) -> ContVecF (xs :: [α]) (f :: α -> *)
+ Data.Vector.HFixed: ContVecF :: (forall r. TFun f xs r -> r) -> ContVecF (xs :: [α]) (f :: α -> Type)
- Data.Vector.HFixed: [runContVecF] :: ContVecF (xs :: [α]) (f :: α -> *) -> forall r. TFun f xs r -> r
+ Data.Vector.HFixed: [runContVecF] :: ContVecF (xs :: [α]) (f :: α -> Type) -> forall r. TFun f xs r -> r
- Data.Vector.HFixed: class Arity (ElemsF v) => HVectorF (v :: (α -> *) -> *) where {
+ Data.Vector.HFixed: class Arity (ElemsF v) => HVectorF (v :: (α -> Type) -> Type) where {
- Data.Vector.HFixed: class ArityPeano n => Index (n :: PeanoNum) (xs :: [*])
+ Data.Vector.HFixed: class ArityPeano n => Index (n :: PeanoNum) (xs :: [Type])
- Data.Vector.HFixed: data Proxy (t :: k)
+ Data.Vector.HFixed: data () => Proxy (t :: k)
- Data.Vector.HFixed: newtype ContVecF (xs :: [α]) (f :: α -> *)
+ Data.Vector.HFixed: newtype ContVecF (xs :: [α]) (f :: α -> Type)
- Data.Vector.HFixed.Class: ContVecF :: (forall r. TFun f xs r -> r) -> ContVecF (xs :: [α]) (f :: α -> *)
+ Data.Vector.HFixed.Class: ContVecF :: (forall r. TFun f xs r -> r) -> ContVecF (xs :: [α]) (f :: α -> Type)
- Data.Vector.HFixed.Class: [runContVecF] :: ContVecF (xs :: [α]) (f :: α -> *) -> forall r. TFun f xs r -> r
+ Data.Vector.HFixed.Class: [runContVecF] :: ContVecF (xs :: [α]) (f :: α -> Type) -> forall r. TFun f xs r -> r
- Data.Vector.HFixed.Class: class Arity (ElemsF v) => HVectorF (v :: (α -> *) -> *) where {
+ Data.Vector.HFixed.Class: class Arity (ElemsF v) => HVectorF (v :: (α -> Type) -> Type) where {
- Data.Vector.HFixed.Class: class ArityPeano n => Index (n :: PeanoNum) (xs :: [*]) where {
+ Data.Vector.HFixed.Class: class ArityPeano n => Index (n :: PeanoNum) (xs :: [Type]) where {
- Data.Vector.HFixed.Class: data Proxy (t :: k)
+ Data.Vector.HFixed.Class: data () => Proxy (t :: k)
- Data.Vector.HFixed.Class: newtype ContVecF (xs :: [α]) (f :: α -> *)
+ Data.Vector.HFixed.Class: newtype ContVecF (xs :: [α]) (f :: α -> Type)
- Data.Vector.HFixed.Class: type family NewElems n xs a :: [*];
+ Data.Vector.HFixed.Class: type family HomList (n :: PeanoNum) (a :: α) :: [α]
- Data.Vector.HFixed.Cont: ContVecF :: (forall r. TFun f xs r -> r) -> ContVecF (xs :: [α]) (f :: α -> *)
+ Data.Vector.HFixed.Cont: ContVecF :: (forall r. TFun f xs r -> r) -> ContVecF (xs :: [α]) (f :: α -> Type)
- Data.Vector.HFixed.Cont: [runContVecF] :: ContVecF (xs :: [α]) (f :: α -> *) -> forall r. TFun f xs r -> r
+ Data.Vector.HFixed.Cont: [runContVecF] :: ContVecF (xs :: [α]) (f :: α -> Type) -> forall r. TFun f xs r -> r
- Data.Vector.HFixed.Cont: class Arity (ElemsF v) => HVectorF (v :: (α -> *) -> *) where {
+ Data.Vector.HFixed.Cont: class Arity (ElemsF v) => HVectorF (v :: (α -> Type) -> Type) where {
- Data.Vector.HFixed.Cont: class ArityPeano n => Index (n :: PeanoNum) (xs :: [*])
+ Data.Vector.HFixed.Cont: class ArityPeano n => Index (n :: PeanoNum) (xs :: [Type])
- Data.Vector.HFixed.Cont: data VecList :: [*] -> *
+ Data.Vector.HFixed.Cont: data VecList :: [Type] -> Type
- Data.Vector.HFixed.Cont: data VecListF (xs :: [α]) (f :: α -> *)
+ Data.Vector.HFixed.Cont: data VecListF (xs :: [α]) (f :: α -> Type)
- Data.Vector.HFixed.Cont: newtype ContVecF (xs :: [α]) (f :: α -> *)
+ Data.Vector.HFixed.Cont: newtype ContVecF (xs :: [α]) (f :: α -> Type)
- Data.Vector.HFixed.Cont: type family ValueAt n xs :: *
+ Data.Vector.HFixed.Cont: type family Fn (f :: α -> Type) (as :: [α]) b
- Data.Vector.HFixed.HVec: data HVec (xs :: [*])
+ Data.Vector.HFixed.HVec: data HVec (xs :: [Type])
- Data.Vector.HFixed.HVec: data HVecF (xs :: [*]) (f :: * -> *)
+ Data.Vector.HFixed.HVec: data HVecF (xs :: [Type]) (f :: Type -> Type)
- Data.Vector.HFixed.TypeFuns: data Proxy (t :: k)
+ Data.Vector.HFixed.TypeFuns: data () => Proxy (t :: k)
Files
- ChangeLog.md +5/−0
- Data/Vector/HFixed.hs +10/−5
- Data/Vector/HFixed/Class.hs +14/−9
- Data/Vector/HFixed/Cont.hs +7/−3
- Data/Vector/HFixed/HVec.hs +8/−9
- fixed-vector-hetero.cabal +10/−11
ChangeLog.md view
@@ -1,3 +1,8 @@+Changes in 0.6.2.0++ * GHC 9.10 compatibility++ Changes in 0.6.1.1 * doctests are marked as non-buildable on GHC9.0 & 9.2
Data/Vector/HFixed.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-}@@ -5,7 +6,6 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}@@ -125,6 +125,9 @@ import Prelude ( Functor(..),Eq(..),Ord,Bool,Ordering , id,(.),($),seq) import qualified Prelude+#if MIN_VERSION_base(4,17,0)+import Prelude (type(~))+#endif import Data.Vector.HFixed.Class hiding (cons,consF) import Data.Vector.Fixed.Cont (Peano)@@ -276,15 +279,17 @@ -- ... -- • Cannot find type: -- Int--- • In the expression: tyLookup ('c', "str") :: Int--- In an equation for ‘it’: it = tyLookup ('c', "str") :: Int+-- ... • In the expression: tyLookup ('c', "str") :: Int+-- ... In an equation for ‘it’: it = tyLookup ('c', "str") :: Int+-- ... -- -- >>> tyLookup ('c','c') :: Char -- ... -- • Duplicate type found: -- Char--- • In the expression: tyLookup ('c', 'c') :: Char--- In an equation for ‘it’: it = tyLookup ('c', 'c') :: Char+-- ... • In the expression: tyLookup ('c', 'c') :: Char+-- ... In an equation for ‘it’: it = tyLookup ('c', 'c') :: Char+-- ... tyLookup :: (HVector v, TyLookup a (Elems v)) => v -> a tyLookup = C.tyLookup . C.cvec {-# INLINE tyLookup #-}
Data/Vector/HFixed/Class.hs view
@@ -71,6 +71,7 @@ import Data.Complex (Complex(..)) import Data.Functor.Identity (Identity(..)) import Data.Type.Equality (type (==))+import Data.Kind (Type) import Data.Vector.Fixed.Cont (Peano,PeanoNum(..),ArityPeano) import qualified Data.Vector.Fixed as F@@ -95,7 +96,7 @@ -- | Type family for N-ary function. Types of function parameters are -- encoded as the list of types.-type family Fn (f :: α -> *) (as :: [α]) b where+type family Fn (f :: α -> Type) (as :: [α]) b where Fn f '[] b = b Fn f (a : as) b = f a -> Fn f as b @@ -227,7 +228,7 @@ -- -- Default implementation which uses 'Generic' is provided. class Arity (Elems v) => HVector v where- type Elems v :: [*]+ type Elems v :: [Type] type Elems v = GElems (Rep v) -- | Function for constructing vector construct :: Fun (Elems v) v@@ -250,7 +251,7 @@ -- | Type class for partially homogeneous vector where every element -- in the vector have same type constructor. Vector itself is -- parametrized by that constructor-class Arity (ElemsF v) => HVectorF (v :: (α -> *) -> *) where+class Arity (ElemsF v) => HVectorF (v :: (α -> Type) -> Type) where -- | Elements of the vector without type constructors type ElemsF v :: [α] inspectF :: v f -> TFun f (ElemsF v) a -> a@@ -303,6 +304,7 @@ instance ( HomArity (Peano n) a+ , Arity (HomList (Peano n) a) , KnownNat n , Peano (n + 1) ~ 'S (Peano n) ) => HVector (B.Vec n a) where@@ -314,6 +316,7 @@ instance ( U.Unbox n a , HomArity (Peano n) a+ , Arity (HomList (Peano n) a) , KnownNat n , Peano (n + 1) ~ 'S (Peano n) ) => HVector (U.Vec n a) where@@ -325,6 +328,7 @@ instance ( S.Storable a , HomArity (Peano n) a+ , Arity (HomList (Peano n) a) , KnownNat n , Peano (n + 1) ~ 'S (Peano n) ) => HVector (S.Vec n a) where@@ -336,6 +340,7 @@ instance ( P.Prim a , HomArity (Peano n) a+ , Arity (HomList (Peano n) a) , KnownNat n , Peano (n + 1) ~ 'S (Peano n) ) => HVector (P.Vec n a) where@@ -370,7 +375,7 @@ type ContVec xs = ContVecF xs Identity -- | CPS-encoded partially heterogeneous vector.-newtype ContVecF (xs :: [α]) (f :: α -> *) =+newtype ContVecF (xs :: [α]) (f :: α -> Type) = ContVecF { runContVecF :: forall r. TFun f xs r -> r } instance Arity xs => HVectorF (ContVecF xs) where@@ -544,11 +549,11 @@ ---------------------------------------------------------------- -- | Indexing of vectors-class ArityPeano n => Index (n :: PeanoNum) (xs :: [*]) where+class ArityPeano n => Index (n :: PeanoNum) (xs :: [Type]) where -- | Type at position n- type ValueAt n xs :: *+ type ValueAt n xs :: Type -- | List of types with n'th element replaced by /a/.- type NewElems n xs a :: [*]+ type NewElems n xs a :: [Type] -- | Getter function for vectors getF :: proxy n -> Fun xs (ValueAt n xs) -- | Putter function. It applies value @x@ to @n@th parameter of@@ -943,8 +948,8 @@ -- Generics ---------------------------------------------------------------- -class GHVector (v :: * -> *) where- type GElems v :: [*]+class GHVector (v :: Type -> Type) where+ type GElems v :: [Type] gconstruct :: Fun (GElems v) (v p) ginspect :: v p -> Fun (GElems v) r -> r
Data/Vector/HFixed/Cont.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-}@@ -76,9 +77,12 @@ import Data.Monoid (Monoid(..),(<>)) import Data.Functor.Compose (Compose(..)) import Data.Functor.Identity (Identity(..))+import Data.Kind (Type) import qualified Data.Vector.Fixed.Cont as F import Prelude (Functor(..),id,(.),($))-+#if MIN_VERSION_base(4,17,0)+import Prelude (type(~))+#endif import Data.Vector.HFixed.Class @@ -231,7 +235,7 @@ ---------------------------------------------------------------- -- | List like heterogeneous vector.-data VecList :: [*] -> * where+data VecList :: [Type] -> Type where Nil :: VecList '[] Cons :: x -> VecList xs -> VecList (x : xs) @@ -252,7 +256,7 @@ -- | List-like vector-data VecListF (xs :: [α]) (f :: α -> *) where+data VecListF (xs :: [α]) (f :: α -> Type) where NilF :: VecListF '[] f ConsF :: f x -> VecListF xs f -> VecListF (x : xs) f
Data/Vector/HFixed/HVec.hs view
@@ -19,9 +19,12 @@ import Data.Functor.Identity (Identity(..)) import Data.Functor.Classes import Control.DeepSeq (NFData(..))+#if !MIN_VERSION_base(4,13,0) import Data.Semigroup (Semigroup(..))+#endif import Data.Monoid (All(..)) import Data.List (intersperse,intercalate)+import Data.Kind (Type) import Data.Primitive.SmallArray ( SmallArray, SmallMutableArray, newSmallArray , writeSmallArray, indexSmallArray , unsafeFreezeSmallArray)@@ -38,7 +41,7 @@ ---------------------------------------------------------------- -- | Heterogeneous vector parametrized by common type constructor.-newtype HVecF (xs :: [*]) (f :: * -> *) = HVecF (SmallArray Any)+newtype HVecF (xs :: [Type]) (f :: Type -> Type) = HVecF (SmallArray Any) instance Arity xs => HVectorF (HVecF xs) where type ElemsF (HVecF xs) = xs@@ -56,8 +59,8 @@ len = arity (Proxy @xs) {-# INLINE constructF #-} -data T_insp (xs :: [*]) = T_insp Int (SmallArray Any)-data T_con (xs :: [*]) = T_con Int (Box Any)+data T_insp (xs :: [Type]) = T_insp Int (SmallArray Any)+data T_con (xs :: [Type]) = T_con Int (Box Any) -- Helper data type for creating of array newtype Box a = Box (forall s. SmallMutableArray s a -> ST s ())@@ -93,7 +96,7 @@ ---------------------------------------------------------------- -- | Generic heterogeneous vector-newtype HVec (xs :: [*]) = HVec (HVecF xs Identity)+newtype HVec (xs :: [Type]) = HVec (HVecF xs Identity) instance Arity xs => HVector (HVec xs) where type Elems (HVec xs) = xs@@ -116,17 +119,13 @@ compare = H.compare {-# INLINE compare #-} -instance (ArityC Monoid xs+instance ( ArityC Monoid xs -- NOTE: Sadly we cannot infer `ArityC Semigroup' xs from `ArityC Monoid xs' -- Thus we have to specify both-#if MIN_VERSION_base(4,11,0) , ArityC Semigroup xs-#endif ) => Monoid (HVec xs) where mempty = H.replicate (Proxy @Monoid) mempty- mappend = H.zipWith (Proxy @Monoid) mappend {-# INLINE mempty #-}- {-# INLINE mappend #-} instance (ArityC Semigroup xs) => Semigroup (HVec xs) where (<>) = H.zipWith (Proxy @Semigroup) (<>)
fixed-vector-hetero.cabal view
@@ -1,5 +1,5 @@ Name: fixed-vector-hetero-Version: 0.6.1.1+Version: 0.6.2.0 Synopsis: Library for working with product types generically Description: Library allow to work with arbitrary product types in generic@@ -18,14 +18,16 @@ ChangeLog.md tested-with:- GHC ==8.0.2- || ==8.2.2- || ==8.4.4+ GHC ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.1- || ==9.2.1+ || ==9.2.8+ || ==9.4.8+ || ==9.6.6+ || ==9.8.2+ || ==9.10.1 source-repository head@@ -37,9 +39,9 @@ -- tuples Ghc-options: -Wall -freduction-depth=50 default-language: Haskell2010- Build-Depends: base >=4.9 && <5+ Build-Depends: base >=4.11 && <5 , deepseq- , fixed-vector >= 1.0.0.0+ , fixed-vector >= 1.0.0.0 && <1.3 , primitive >= 0.6.2 Exposed-modules: Data.Vector.HFixed@@ -55,16 +57,13 @@ -- GHC 9.0 panic while running doctests if impl(ghc >= 9.0) && impl(ghc < 9.1) buildable: False- -- GHC 9.2 too- if impl(ghc >= 9.2) && impl(ghc < 9.3)- buildable: False type: exitcode-stdio-1.0 main-is: doctests.hs hs-source-dirs: test default-language: Haskell2010 build-depends: base >=4.9 && <5- , doctest >=0.15 && <0.20+ , doctest >=0.15 && <0.24 , fixed-vector >=1.0 , fixed-vector-hetero -any