haskus-utils-types 1.5.1 → 1.6
raw patch · 3 files changed
+14/−12 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Haskus.Utils.Types.Constraint: data Constraint
- Haskus.Utils.Types.Nat: data Nat
+ Haskus.Utils.Types.Constraint: type Constraint = CONSTRAINT LiftedRep
+ Haskus.Utils.Types.Nat: type Nat = Natural
- Haskus.Utils.Types: type Type = Type
+ Haskus.Utils.Types: type Type = TYPE LiftedRep
- Haskus.Utils.Types.Error: data ErrorMessage
+ Haskus.Utils.Types.Error: data () => ErrorMessage
- Haskus.Utils.Types.Generics: data Field (name :: Symbol) (t :: *)
+ Haskus.Utils.Types.Generics: data Field (name :: Symbol) (t :: Type)
- Haskus.Utils.Types.Generics: type family ExtractFieldTypes (a :: *)
+ Haskus.Utils.Types.Generics: type family ExtractFieldTypes (a :: Type)
- Haskus.Utils.Types.Nat: class KnownNat (n :: Nat)
+ Haskus.Utils.Types.Nat: class () => KnownNat (n :: Nat)
- Haskus.Utils.Types.Nat: data SomeNat
+ Haskus.Utils.Types.Nat: data () => SomeNat
- Haskus.Utils.Types.Nat: sameNat :: forall (a :: Nat) (b :: Nat). (KnownNat a, KnownNat b) => Proxy a -> Proxy b -> Maybe (a :~: b)
+ Haskus.Utils.Types.Nat: sameNat :: forall (a :: Nat) (b :: Nat) proxy1 proxy2. (KnownNat a, KnownNat b) => proxy1 a -> proxy2 b -> Maybe (a :~: b)
- Haskus.Utils.Types.Nat: type (x :: Nat) <= (y :: Nat) = x <=? y ~ 'True
+ Haskus.Utils.Types.Nat: type (x :: t) <= (y :: t) = Assert x <=? y LeErrMsg x y :: Constraint
- Haskus.Utils.Types.Proxy: data Proxy# (a :: k) :: TYPE 'TupleRep '[] :: [RuntimeRep]
+ Haskus.Utils.Types.Proxy: data Proxy# (a :: k) :: ZeroBitType
- Haskus.Utils.Types.Symbol: class KnownSymbol (n :: Symbol)
+ Haskus.Utils.Types.Symbol: class () => KnownSymbol (n :: Symbol)
- Haskus.Utils.Types.Symbol: data SomeSymbol
+ Haskus.Utils.Types.Symbol: data () => SomeSymbol
- Haskus.Utils.Types.Symbol: data Symbol
+ Haskus.Utils.Types.Symbol: data () => Symbol
- Haskus.Utils.Types.Symbol: sameSymbol :: forall (a :: Symbol) (b :: Symbol). (KnownSymbol a, KnownSymbol b) => Proxy a -> Proxy b -> Maybe (a :~: b)
+ Haskus.Utils.Types.Symbol: sameSymbol :: forall (a :: Symbol) (b :: Symbol) proxy1 proxy2. (KnownSymbol a, KnownSymbol b) => proxy1 a -> proxy2 b -> Maybe (a :~: b)
Files
- haskus-utils-types.cabal +6/−5
- src/lib/Haskus/Utils/Types/Generics.hs +4/−4
- src/lib/Haskus/Utils/Types/List.hs +4/−3
haskus-utils-types.cabal view
@@ -1,22 +1,23 @@+cabal-version: 2.4 name: haskus-utils-types-version: 1.5.1+version: 1.6 synopsis: Haskus types utility modules-license: BSD3+license: BSD-3-Clause license-file: LICENSE author: Sylvain Henry maintainer: sylvain@haskus.fr homepage: https://www.haskus.org-copyright: Sylvain Henry 2020+copyright: Sylvain Henry 2024 category: Type build-type: Simple-cabal-version: 1.20 description: Haskus types utility modules (Nat, List, etc.) source-repository head type: git- location: git://github.com/haskus/haskus-utils.git+ location: git://github.com/haskus/packages.git+ subdir: haskus-utils-types library exposed-modules:
src/lib/Haskus/Utils/Types/Generics.hs view
@@ -23,7 +23,7 @@ import GHC.Generics -- | Named field-data Field (name :: Symbol) (t :: *)+data Field (name :: Symbol) (t :: Type) type family FieldType f where FieldType (Field name t) = t@@ -31,7 +31,7 @@ type family LookupFieldType fs s where LookupFieldType fs s = FieldType (LookupField fs s) -type family LookupField (fs :: [*]) (s :: Symbol) where+type family LookupField (fs :: [Type]) (s :: Symbol) where LookupField (Field name t ': fs) name = Field name t LookupField (Field name t ': fs) s = LookupField fs s LookupField '[] name =@@ -41,7 +41,7 @@ -- | Extract fields of a data type: -- - require selector symbols -- - only support data type with a single constructor-type family ExtractFields (a :: *) where+type family ExtractFields (a :: Type) where ExtractFields a = ExtractFields' (Rep a) type family ExtractFields' a where@@ -59,7 +59,7 @@ -- | Extract types of the fields of a data type -- - only support data type with a single constructor-type family ExtractFieldTypes (a :: *) where+type family ExtractFieldTypes (a :: Type) where ExtractFieldTypes a = ExtractFieldTypes' (Rep a) type family ExtractFieldTypes' a where
src/lib/Haskus/Utils/Types/List.hs view
@@ -71,6 +71,7 @@ import Haskus.Utils.Types.Error import Haskus.Utils.Types.Nat import Haskus.Utils.Types.Constraint+import Data.Kind (Type) -- | Map a type function type family Map (f :: a -> k) (xs :: [a]) :: [k] where@@ -250,7 +251,7 @@ MapTest a (x ': xs) = 0 ': MapTest a xs -- | Zip two lists-type family Zip (l :: [*]) (l2 :: [*]) where+type family Zip (l :: [Type]) (l2 :: [Type]) where Zip '[] xs = '[] Zip xs '[] = '[] Zip (x ': xs) (y ': ys) = (x,y) ': Zip xs ys@@ -349,12 +350,12 @@ Complement xs (y:ys) = Complement (Remove y xs) ys -- | Product of two lists-type family Product (xs :: [*]) (ys :: [*]) :: [*] where+type family Product (xs :: [Type]) (ys :: [Type]) :: [Type] where Product '[] ys = '[] Product xy '[] = '[] Product (x:xs) ys = Concat (Product' x ys) (Product xs ys) -type family Product' (x :: *) (ys :: [*]) :: [*] where+type family Product' (x :: Type) (ys :: [Type]) :: [Type] where Product' x '[] = '[] Product' x (y ': ys) = (x,y) ': Product' x ys