generics-sop 0.4.0.1 → 0.5.0.0
raw patch · 9 files changed
+308/−23 lines, 9 filesdep ~sop-coredep ~template-haskellsetup-changedPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: sop-core, template-haskell
API changes (from Hackage documentation)
- Generics.SOP: infixl 7 `And`
- Generics.SOP: infixr 1 -.->
- Generics.SOP: infixr 5 :*
- Generics.SOP: infixr 7 :.:
- Generics.SOP: infixr 9 `Compose`
- Generics.SOP.Metadata: instance (Data.SOP.Constraint.All (Data.SOP.Constraint.Compose GHC.Classes.Eq Generics.SOP.Metadata.ConstructorInfo) xs, Data.SOP.Constraint.All (Data.SOP.Constraint.Compose GHC.Classes.Ord Generics.SOP.Metadata.ConstructorInfo) xs) => GHC.Classes.Ord (Generics.SOP.Metadata.DatatypeInfo xs)
- Generics.SOP.Metadata: instance Data.SOP.Constraint.All (Data.SOP.Constraint.Compose GHC.Classes.Eq Generics.SOP.Metadata.ConstructorInfo) xs => GHC.Classes.Eq (Generics.SOP.Metadata.DatatypeInfo xs)
- Generics.SOP.Metadata: instance Data.SOP.Constraint.All (Data.SOP.Constraint.Compose GHC.Show.Show Generics.SOP.Metadata.ConstructorInfo) xs => GHC.Show.Show (Generics.SOP.Metadata.DatatypeInfo xs)
- Generics.SOP.Type.Metadata: instance (GHC.TypeLits.KnownSymbol m, GHC.TypeLits.KnownSymbol d, Generics.SOP.Type.Metadata.DemoteConstructorInfos cs xss) => Generics.SOP.Type.Metadata.DemoteDatatypeInfo ('Generics.SOP.Type.Metadata.ADT m d cs) xss
+ Generics.SOP: ejections :: forall k (xs :: [k]) (f :: k -> Type). SListI xs => NP (Ejection f xs) xs
+ Generics.SOP: enumTypeFrom :: IsEnumType a => a -> NS (K ()) (Code a)
+ Generics.SOP: enumTypeTo :: IsEnumType a => NS (K ()) (Code a) -> a
+ Generics.SOP: newtypeFrom :: IsNewtype a x => a -> x
+ Generics.SOP: newtypeTo :: IsNewtype a x => x -> a
+ Generics.SOP: productTypeFrom :: IsProductType a xs => a -> NP I xs
+ Generics.SOP: productTypeTo :: IsProductType a xs => NP I xs -> a
+ Generics.SOP: shiftEjection :: forall a1 (f :: a1 -> Type) (x :: a1) (xs :: [a1]) (a2 :: a1). Ejection f xs a2 -> Ejection f (x : xs) a2
+ Generics.SOP: type Ejection (f :: k -> Type) (xs :: [k]) = K NS f xs :: k -> Type -.-> Maybe :.: f
+ Generics.SOP: type ProductCode (a :: Type) = Head (Code a)
+ Generics.SOP: type WrappedCode (a :: Type) = Head (Head (Code a))
+ Generics.SOP: wrappedTypeFrom :: IsWrappedType a x => a -> x
+ Generics.SOP: wrappedTypeTo :: IsWrappedType a x => x -> a
+ Generics.SOP.Metadata: DecidedLazy :: DecidedStrictness
+ Generics.SOP.Metadata: DecidedStrict :: DecidedStrictness
+ Generics.SOP.Metadata: DecidedUnpack :: DecidedStrictness
+ Generics.SOP.Metadata: NoSourceStrictness :: SourceStrictness
+ Generics.SOP.Metadata: NoSourceUnpackedness :: SourceUnpackedness
+ Generics.SOP.Metadata: SourceLazy :: SourceStrictness
+ Generics.SOP.Metadata: SourceNoUnpack :: SourceUnpackedness
+ Generics.SOP.Metadata: SourceStrict :: SourceStrictness
+ Generics.SOP.Metadata: SourceUnpack :: SourceUnpackedness
+ Generics.SOP.Metadata: [StrictnessInfo] :: SourceUnpackedness -> SourceStrictness -> DecidedStrictness -> StrictnessInfo a
+ Generics.SOP.Metadata: data DecidedStrictness
+ Generics.SOP.Metadata: data SourceStrictness
+ Generics.SOP.Metadata: data SourceUnpackedness
+ Generics.SOP.Metadata: data StrictnessInfo :: Type -> Type
+ Generics.SOP.Metadata: instance (Data.SOP.Constraint.All (Data.SOP.Constraint.Compose GHC.Classes.Eq Generics.SOP.Metadata.ConstructorInfo) xs, Data.SOP.Constraint.All (Data.SOP.Constraint.Compose GHC.Classes.Eq (Data.SOP.NP.NP Generics.SOP.Metadata.StrictnessInfo)) xs) => GHC.Classes.Eq (Generics.SOP.Metadata.DatatypeInfo xs)
+ Generics.SOP.Metadata: instance (Data.SOP.Constraint.All (Data.SOP.Constraint.Compose GHC.Classes.Eq Generics.SOP.Metadata.ConstructorInfo) xs, Data.SOP.Constraint.All (Data.SOP.Constraint.Compose GHC.Classes.Ord Generics.SOP.Metadata.ConstructorInfo) xs, Data.SOP.Constraint.All (Data.SOP.Constraint.Compose GHC.Classes.Eq (Data.SOP.NP.NP Generics.SOP.Metadata.StrictnessInfo)) xs, Data.SOP.Constraint.All (Data.SOP.Constraint.Compose GHC.Classes.Ord (Data.SOP.NP.NP Generics.SOP.Metadata.StrictnessInfo)) xs) => GHC.Classes.Ord (Generics.SOP.Metadata.DatatypeInfo xs)
+ Generics.SOP.Metadata: instance (Data.SOP.Constraint.All (Data.SOP.Constraint.Compose GHC.Show.Show Generics.SOP.Metadata.ConstructorInfo) xs, Data.SOP.Constraint.All (Data.SOP.Constraint.Compose GHC.Show.Show (Data.SOP.NP.NP Generics.SOP.Metadata.StrictnessInfo)) xs) => GHC.Show.Show (Generics.SOP.Metadata.DatatypeInfo xs)
+ Generics.SOP.Metadata: instance GHC.Base.Functor Generics.SOP.Metadata.StrictnessInfo
+ Generics.SOP.Metadata: instance GHC.Classes.Eq (Generics.SOP.Metadata.StrictnessInfo a)
+ Generics.SOP.Metadata: instance GHC.Classes.Ord (Generics.SOP.Metadata.StrictnessInfo a)
+ Generics.SOP.Metadata: instance GHC.Show.Show (Generics.SOP.Metadata.StrictnessInfo a)
+ Generics.SOP.Type.Metadata: StrictnessInfo :: SourceUnpackedness -> SourceStrictness -> DecidedStrictness -> StrictnessInfo
+ Generics.SOP.Type.Metadata: class DemoteDecidedStrictness (a :: DecidedStrictness)
+ Generics.SOP.Type.Metadata: class DemoteSourceStrictness (a :: SourceStrictness)
+ Generics.SOP.Type.Metadata: class DemoteSourceUnpackedness (a :: SourceUnpackedness)
+ Generics.SOP.Type.Metadata: class DemoteStrictnessInfo (s :: StrictnessInfo) (x :: Type)
+ Generics.SOP.Type.Metadata: class DemoteStrictnessInfos (ss :: [StrictnessInfo]) (xs :: [Type])
+ Generics.SOP.Type.Metadata: class DemoteStrictnessInfoss (sss :: [[StrictnessInfo]]) (xss :: [[Type]])
+ Generics.SOP.Type.Metadata: data StrictnessInfo
+ Generics.SOP.Type.Metadata: demoteDecidedStrictness :: DemoteDecidedStrictness a => proxy a -> DecidedStrictness
+ Generics.SOP.Type.Metadata: demoteSourceStrictness :: DemoteSourceStrictness a => proxy a -> SourceStrictness
+ Generics.SOP.Type.Metadata: demoteSourceUnpackedness :: DemoteSourceUnpackedness a => proxy a -> SourceUnpackedness
+ Generics.SOP.Type.Metadata: demoteStrictnessInfo :: DemoteStrictnessInfo s x => proxy s -> StrictnessInfo x
+ Generics.SOP.Type.Metadata: demoteStrictnessInfos :: DemoteStrictnessInfos ss xs => proxy ss -> NP StrictnessInfo xs
+ Generics.SOP.Type.Metadata: demoteStrictnessInfoss :: DemoteStrictnessInfoss sss xss => proxy sss -> NP (NP StrictnessInfo) xss
+ Generics.SOP.Type.Metadata: instance (GHC.TypeLits.KnownSymbol m, GHC.TypeLits.KnownSymbol d, Generics.SOP.Type.Metadata.DemoteConstructorInfos cs xss, Generics.SOP.Type.Metadata.DemoteStrictnessInfoss sss xss) => Generics.SOP.Type.Metadata.DemoteDatatypeInfo ('Generics.SOP.Type.Metadata.ADT m d cs sss) xss
+ Generics.SOP.Type.Metadata: instance (Generics.SOP.Type.Metadata.DemoteSourceUnpackedness su, Generics.SOP.Type.Metadata.DemoteSourceStrictness ss, Generics.SOP.Type.Metadata.DemoteDecidedStrictness ds) => Generics.SOP.Type.Metadata.DemoteStrictnessInfo ('Generics.SOP.Type.Metadata.StrictnessInfo su ss ds) x
+ Generics.SOP.Type.Metadata: instance (Generics.SOP.Type.Metadata.DemoteStrictnessInfo s x, Generics.SOP.Type.Metadata.DemoteStrictnessInfos ss xs) => Generics.SOP.Type.Metadata.DemoteStrictnessInfos (s : ss) (x : xs)
+ Generics.SOP.Type.Metadata: instance (Generics.SOP.Type.Metadata.DemoteStrictnessInfos ss xs, Generics.SOP.Type.Metadata.DemoteStrictnessInfoss sss xss) => Generics.SOP.Type.Metadata.DemoteStrictnessInfoss (ss : sss) (xs : xss)
+ Generics.SOP.Type.Metadata: instance Generics.SOP.Type.Metadata.DemoteDecidedStrictness 'GHC.Generics.DecidedLazy
+ Generics.SOP.Type.Metadata: instance Generics.SOP.Type.Metadata.DemoteDecidedStrictness 'GHC.Generics.DecidedStrict
+ Generics.SOP.Type.Metadata: instance Generics.SOP.Type.Metadata.DemoteDecidedStrictness 'GHC.Generics.DecidedUnpack
+ Generics.SOP.Type.Metadata: instance Generics.SOP.Type.Metadata.DemoteSourceStrictness 'GHC.Generics.NoSourceStrictness
+ Generics.SOP.Type.Metadata: instance Generics.SOP.Type.Metadata.DemoteSourceStrictness 'GHC.Generics.SourceLazy
+ Generics.SOP.Type.Metadata: instance Generics.SOP.Type.Metadata.DemoteSourceStrictness 'GHC.Generics.SourceStrict
+ Generics.SOP.Type.Metadata: instance Generics.SOP.Type.Metadata.DemoteSourceUnpackedness 'GHC.Generics.NoSourceUnpackedness
+ Generics.SOP.Type.Metadata: instance Generics.SOP.Type.Metadata.DemoteSourceUnpackedness 'GHC.Generics.SourceNoUnpack
+ Generics.SOP.Type.Metadata: instance Generics.SOP.Type.Metadata.DemoteSourceUnpackedness 'GHC.Generics.SourceUnpack
+ Generics.SOP.Type.Metadata: instance Generics.SOP.Type.Metadata.DemoteStrictnessInfos '[] '[]
+ Generics.SOP.Type.Metadata: instance Generics.SOP.Type.Metadata.DemoteStrictnessInfoss '[] '[]
- Generics.SOP: [:*] :: forall k (a :: k -> Type) (b :: [k]) (x :: k) (xs :: [k]). () => a x -> NP a xs -> NP a (x : xs)
+ Generics.SOP: [:*] :: forall k (a :: k -> Type) (x :: k) (xs :: [k]). a x -> NP a xs -> NP a (x : xs)
- Generics.SOP: [ADT] :: ModuleName -> DatatypeName -> NP ConstructorInfo xss -> DatatypeInfo xss
+ Generics.SOP: [ADT] :: ModuleName -> DatatypeName -> NP ConstructorInfo xss -> POP StrictnessInfo xss -> DatatypeInfo xss
- Generics.SOP: [Newtype] :: ModuleName -> DatatypeName -> ConstructorInfo '[x] -> DatatypeInfo '['[x]]
+ Generics.SOP: [Newtype] :: ModuleName -> DatatypeName -> ConstructorInfo '[x] -> DatatypeInfo '[ '[x]]
- Generics.SOP: [Nil] :: forall k (a :: k -> Type) (b :: [k]). () => NP a ([] :: [k])
+ Generics.SOP: [Nil] :: forall k (a :: k -> Type). NP a ('[] :: [k])
- Generics.SOP: [SCons] :: forall k (a :: [k]) (xs :: [k]) (x :: k). SListI xs => SList (x : xs)
+ Generics.SOP: [SCons] :: forall k (xs :: [k]) (x :: k). SListI xs => SList (x : xs)
- Generics.SOP: [SNil] :: forall k (a :: [k]). () => SList ([] :: [k])
+ Generics.SOP: [SNil] :: forall k. SList ('[] :: [k])
- Generics.SOP: [S] :: forall k (a :: k -> Type) (b :: [k]) (xs :: [k]) (x :: k). () => NS a xs -> NS a (x : xs)
+ Generics.SOP: [S] :: forall k (a :: k -> Type) (xs :: [k]) (x :: k). NS a xs -> NS a (x : xs)
- Generics.SOP: [ShapeCons] :: forall k (a :: [k]) (xs :: [k]) (x :: k). SListI xs => Shape xs -> Shape (x : xs)
+ Generics.SOP: [ShapeCons] :: forall k (xs :: [k]) (x :: k). SListI xs => Shape xs -> Shape (x : xs)
- Generics.SOP: [ShapeNil] :: forall k (a :: [k]). () => Shape ([] :: [k])
+ Generics.SOP: [ShapeNil] :: forall k. Shape ('[] :: [k])
- Generics.SOP: [Z] :: forall k (a :: k -> Type) (b :: [k]) (x :: k) (xs :: [k]). () => a x -> NS a (x : xs)
+ Generics.SOP: [Z] :: forall k (a :: k -> Type) (x :: k) (xs :: [k]). a x -> NS a (x : xs)
- Generics.SOP: apInjs_NP :: SListI xs => NP f xs -> [NS f xs]
+ Generics.SOP: apInjs_NP :: forall k (xs :: [k]) (f :: k -> Type). SListI xs => NP f xs -> [NS f xs]
- Generics.SOP: apInjs_POP :: SListI xss => POP f xss -> [SOP f xss]
+ Generics.SOP: apInjs_POP :: forall k (xss :: [[k]]) (f :: k -> Type). SListI xss => POP f xss -> [SOP f xss]
- Generics.SOP: case_SList :: SListI xs => r ([] :: [k]) -> (forall (y :: k) (ys :: [k]). SListI ys => r (y : ys)) -> r xs
+ Generics.SOP: case_SList :: forall k (xs :: [k]) r. SListI xs => r ('[] :: [k]) -> (forall (y :: k) (ys :: [k]). SListI ys => r (y : ys)) -> r xs
- Generics.SOP: ccase_SList :: All c xs => proxy c -> r ([] :: [k]) -> (forall (y :: k) (ys :: [k]). (c y, All c ys) => r (y : ys)) -> r xs
+ Generics.SOP: ccase_SList :: forall k c (xs :: [k]) proxy r. All c xs => proxy c -> r ('[] :: [k]) -> (forall (y :: k) (ys :: [k]). (c y, All c ys) => r (y : ys)) -> r xs
- Generics.SOP: ccompare_NS :: All c xs => proxy c -> r -> (forall (x :: k). c x => f x -> g x -> r) -> r -> NS f xs -> NS g xs -> r
+ Generics.SOP: ccompare_NS :: forall k c proxy r f g (xs :: [k]). All c xs => proxy c -> r -> (forall (x :: k). c x => f x -> g x -> r) -> r -> NS f xs -> NS g xs -> r
- Generics.SOP: ccompare_SOP :: All2 c xss => proxy c -> r -> (forall (xs :: [k]). All c xs => NP f xs -> NP g xs -> r) -> r -> SOP f xss -> SOP g xss -> r
+ Generics.SOP: ccompare_SOP :: forall k (c :: k -> Constraint) proxy r (f :: k -> Type) (g :: k -> Type) (xss :: [[k]]). All2 c xss => proxy c -> r -> (forall (xs :: [k]). All c xs => NP f xs -> NP g xs -> r) -> r -> SOP f xss -> SOP g xss -> r
- Generics.SOP: class ((Same h1 :: k2 -> Type -> l2 -> Type) ~ h2, (Same h2 :: k1 -> Type -> l1 -> Type) ~ h1) => HTrans (h1 :: k1 -> Type -> l1 -> Type) (h2 :: k2 -> Type -> l2 -> Type)
+ Generics.SOP: class (Same h1 :: k2 -> Type -> l2 -> Type ~ h2, Same h2 :: k1 -> Type -> l1 -> Type ~ h1) => HTrans (h1 :: k1 -> Type -> l1 -> Type) (h2 :: k2 -> Type -> l2 -> Type)
- Generics.SOP: class Coercible f x g y => LiftedCoercible (f :: k -> k0) (g :: k1 -> k0) (x :: k) (y :: k1)
+ Generics.SOP: class Coercible f x g y => LiftedCoercible (f :: k -> k1) (g :: k2 -> k1) (x :: k) (y :: k2)
- Generics.SOP: compare_NS :: () => r -> (forall (x :: k). () => f x -> g x -> r) -> r -> NS f xs -> NS g xs -> r
+ Generics.SOP: compare_NS :: forall k r f g (xs :: [k]). r -> (forall (x :: k). () => f x -> g x -> r) -> r -> NS f xs -> NS g xs -> r
- Generics.SOP: compare_SOP :: () => r -> (forall (xs :: [k]). () => NP f xs -> NP g xs -> r) -> r -> SOP f xss -> SOP g xss -> r
+ Generics.SOP: compare_SOP :: forall k r (f :: k -> Type) (g :: k -> Type) (xss :: [[k]]). r -> (forall (xs :: [k]). () => NP f xs -> NP g xs -> r) -> r -> SOP f xss -> SOP g xss -> r
- Generics.SOP: cpara_SList :: All c xs => proxy c -> r ([] :: [k]) -> (forall (y :: k) (ys :: [k]). (c y, All c ys) => r ys -> r (y : ys)) -> r xs
+ Generics.SOP: cpara_SList :: All c xs => proxy c -> r ('[] :: [k]) -> (forall (y :: k) (ys :: [k]). (c y, All c ys) => r ys -> r (y : ys)) -> r xs
- Generics.SOP: fn :: () => (f a -> f' a) -> (f -.-> f') a
+ Generics.SOP: fn :: forall k f (a :: k) f'. (f a -> f' a) -> (f -.-> f') a
- Generics.SOP: fn_2 :: () => (f a -> f' a -> f'' a) -> (f -.-> (f' -.-> f'')) a
+ Generics.SOP: fn_2 :: forall k f (a :: k) f' f''. (f a -> f' a -> f'' a) -> (f -.-> (f' -.-> f'')) a
- Generics.SOP: fn_3 :: () => (f a -> f' a -> f'' a -> f''' a) -> (f -.-> (f' -.-> (f'' -.-> f'''))) a
+ Generics.SOP: fn_3 :: forall k f (a :: k) f' f'' f'''. (f a -> f' a -> f'' a -> f''' a) -> (f -.-> (f' -.-> (f'' -.-> f'''))) a
- Generics.SOP: fn_4 :: () => (f a -> f' a -> f'' a -> f''' a -> f'''' a) -> (f -.-> (f' -.-> (f'' -.-> (f''' -.-> f'''')))) a
+ Generics.SOP: fn_4 :: forall k f (a :: k) f' f'' f''' f''''. (f a -> f' a -> f'' a -> f''' a -> f'''' a) -> (f -.-> (f' -.-> (f'' -.-> (f''' -.-> f'''')))) a
- Generics.SOP: fromList :: SListI xs => [a] -> Maybe (NP (K a :: k -> Type) xs)
+ Generics.SOP: fromList :: forall k (xs :: [k]) a. SListI xs => [a] -> Maybe (NP (K a :: k -> Type) xs)
- Generics.SOP: hap :: HAp h => Prod h (f -.-> g) xs -> h f xs -> h g xs
+ Generics.SOP: hap :: forall (f :: k -> Type) (g :: k -> Type) (xs :: l). HAp h => Prod h (f -.-> g) xs -> h f xs -> h g xs
- Generics.SOP: hapInjs :: (HApInjs h, SListIN h xs) => Prod h f xs -> [h f xs]
+ Generics.SOP: hapInjs :: forall (xs :: l) (f :: k -> Type). (HApInjs h, SListIN h xs) => Prod h f xs -> [h f xs]
- Generics.SOP: hcexpand :: (HExpand h, AllN (Prod h) c xs) => proxy c -> (forall (x :: k). c x => f x) -> h f xs -> Prod h f xs
+ Generics.SOP: hcexpand :: forall c (xs :: l) proxy f. (HExpand h, AllN (Prod h) c xs) => proxy c -> (forall (x :: k). c x => f x) -> h f xs -> Prod h f xs
- Generics.SOP: hcfoldMap :: (HTraverse_ h, AllN h c xs, Monoid m) => proxy c -> (forall (a :: k). c a => f a -> m) -> h f xs -> m
+ Generics.SOP: hcfoldMap :: forall k l h c (xs :: l) m proxy f. (HTraverse_ h, AllN h c xs, Monoid m) => proxy c -> (forall (a :: k). c a => f a -> m) -> h f xs -> m
- Generics.SOP: hcfor :: (HSequence h, AllN h c xs, Applicative g) => proxy c -> h f xs -> (forall a. c a => f a -> g a) -> g (h I xs)
+ Generics.SOP: hcfor :: forall l h c (xs :: l) g proxy f. (HSequence h, AllN h c xs, Applicative g) => proxy c -> h f xs -> (forall a. c a => f a -> g a) -> g (h I xs)
- Generics.SOP: hcfor_ :: (HTraverse_ h, AllN h c xs, Applicative g) => proxy c -> h f xs -> (forall (a :: k). c a => f a -> g ()) -> g ()
+ Generics.SOP: hcfor_ :: forall k l h c (xs :: l) g proxy f. (HTraverse_ h, AllN h c xs, Applicative g) => proxy c -> h f xs -> (forall (a :: k). c a => f a -> g ()) -> g ()
- Generics.SOP: hcliftA :: (AllN (Prod h) c xs, HAp h) => proxy c -> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
+ Generics.SOP: hcliftA :: forall k l h c (xs :: l) proxy f f'. (AllN (Prod h) c xs, HAp h) => proxy c -> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
- Generics.SOP: hcliftA' :: (All2 c xss, Prod h ~ (NP :: ([k] -> Type) -> [[k]] -> Type), HAp h) => proxy c -> (forall (xs :: [k]). All c xs => f xs -> f' xs) -> h f xss -> h f' xss
+ Generics.SOP: hcliftA' :: forall k (c :: k -> Constraint) (xss :: [[k]]) h proxy f f'. (All2 c xss, Prod h ~ (NP :: ([k] -> Type) -> [[k]] -> Type), HAp h) => proxy c -> (forall (xs :: [k]). All c xs => f xs -> f' xs) -> h f xss -> h f' xss
- Generics.SOP: hcliftA2 :: (AllN (Prod h) c xs, HAp h, HAp (Prod h)) => proxy c -> (forall (a :: k). c a => f a -> f' a -> f'' a) -> Prod h f xs -> h f' xs -> h f'' xs
+ Generics.SOP: hcliftA2 :: forall k l h c (xs :: l) proxy f f' f''. (AllN (Prod h) c xs, HAp h, HAp (Prod h)) => proxy c -> (forall (a :: k). c a => f a -> f' a -> f'' a) -> Prod h f xs -> h f' xs -> h f'' xs
- Generics.SOP: hcliftA2' :: (All2 c xss, Prod h ~ (NP :: ([k] -> Type) -> [[k]] -> Type), HAp h) => proxy c -> (forall (xs :: [k]). All c xs => f xs -> f' xs -> f'' xs) -> Prod h f xss -> h f' xss -> h f'' xss
+ Generics.SOP: hcliftA2' :: forall k (c :: k -> Constraint) (xss :: [[k]]) h proxy f f' f''. (All2 c xss, Prod h ~ (NP :: ([k] -> Type) -> [[k]] -> Type), HAp h) => proxy c -> (forall (xs :: [k]). All c xs => f xs -> f' xs -> f'' xs) -> Prod h f xss -> h f' xss -> h f'' xss
- Generics.SOP: hcliftA3 :: (AllN (Prod h) c xs, HAp h, HAp (Prod h)) => proxy c -> (forall (a :: k). c a => f a -> f' a -> f'' a -> f''' a) -> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs
+ Generics.SOP: hcliftA3 :: forall k l h c (xs :: l) proxy f f' f'' f'''. (AllN (Prod h) c xs, HAp h, HAp (Prod h)) => proxy c -> (forall (a :: k). c a => f a -> f' a -> f'' a -> f''' a) -> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs
- Generics.SOP: hcliftA3' :: (All2 c xss, Prod h ~ (NP :: ([k] -> Type) -> [[k]] -> Type), HAp h) => proxy c -> (forall (xs :: [k]). All c xs => f xs -> f' xs -> f'' xs -> f''' xs) -> Prod h f xss -> Prod h f' xss -> h f'' xss -> h f''' xss
+ Generics.SOP: hcliftA3' :: forall k (c :: k -> Constraint) (xss :: [[k]]) h proxy f f' f'' f'''. (All2 c xss, Prod h ~ (NP :: ([k] -> Type) -> [[k]] -> Type), HAp h) => proxy c -> (forall (xs :: [k]). All c xs => f xs -> f' xs -> f'' xs -> f''' xs) -> Prod h f xss -> Prod h f' xss -> h f'' xss -> h f''' xss
- Generics.SOP: hcmap :: (AllN (Prod h) c xs, HAp h) => proxy c -> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
+ Generics.SOP: hcmap :: forall k l h c (xs :: l) proxy f f'. (AllN (Prod h) c xs, HAp h) => proxy c -> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
- Generics.SOP: hcoerce :: (HTrans h1 h2, AllZipN (Prod h1) (LiftedCoercible f g) xs ys, HTrans h1 h2) => h1 f xs -> h2 g ys
+ Generics.SOP: hcoerce :: forall (f :: k1 -> Type) (g :: k2 -> Type) (xs :: l1) (ys :: l2). (HTrans h1 h2, AllZipN (Prod h1) (LiftedCoercible f g) xs ys, HTrans h1 h2) => h1 f xs -> h2 g ys
- Generics.SOP: hcollapse :: (HCollapse h, SListIN h xs) => h (K a :: k -> Type) xs -> CollapseTo h a
+ Generics.SOP: hcollapse :: forall (xs :: l) a. (HCollapse h, SListIN h xs) => h (K a :: k -> Type) xs -> CollapseTo h a
- Generics.SOP: hcpure :: (HPure h, AllN h c xs) => proxy c -> (forall (a :: k). c a => f a) -> h f xs
+ Generics.SOP: hcpure :: forall c (xs :: l) proxy f. (HPure h, AllN h c xs) => proxy c -> (forall (a :: k). c a => f a) -> h f xs
- Generics.SOP: hctraverse :: (HSequence h, AllN h c xs, Applicative g) => proxy c -> (forall a. c a => f a -> g a) -> h f xs -> g (h I xs)
+ Generics.SOP: hctraverse :: forall l h c (xs :: l) g proxy f. (HSequence h, AllN h c xs, Applicative g) => proxy c -> (forall a. c a => f a -> g a) -> h f xs -> g (h I xs)
- Generics.SOP: hctraverse' :: (HSequence h, AllN h c xs, Applicative g) => proxy c -> (forall (a :: k). c a => f a -> g (f' a)) -> h f xs -> g (h f' xs)
+ Generics.SOP: hctraverse' :: forall c (xs :: l) g proxy f f'. (HSequence h, AllN h c xs, Applicative g) => proxy c -> (forall (a :: k). c a => f a -> g (f' a)) -> h f xs -> g (h f' xs)
- Generics.SOP: hctraverse_ :: (HTraverse_ h, AllN h c xs, Applicative g) => proxy c -> (forall (a :: k). c a => f a -> g ()) -> h f xs -> g ()
+ Generics.SOP: hctraverse_ :: forall c (xs :: l) g proxy f. (HTraverse_ h, AllN h c xs, Applicative g) => proxy c -> (forall (a :: k). c a => f a -> g ()) -> h f xs -> g ()
- Generics.SOP: hczipWith :: (AllN (Prod h) c xs, HAp h, HAp (Prod h)) => proxy c -> (forall (a :: k). c a => f a -> f' a -> f'' a) -> Prod h f xs -> h f' xs -> h f'' xs
+ Generics.SOP: hczipWith :: forall k l h c (xs :: l) proxy f f' f''. (AllN (Prod h) c xs, HAp h, HAp (Prod h)) => proxy c -> (forall (a :: k). c a => f a -> f' a -> f'' a) -> Prod h f xs -> h f' xs -> h f'' xs
- Generics.SOP: hczipWith3 :: (AllN (Prod h) c xs, HAp h, HAp (Prod h)) => proxy c -> (forall (a :: k). c a => f a -> f' a -> f'' a -> f''' a) -> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs
+ Generics.SOP: hczipWith3 :: forall k l h c (xs :: l) proxy f f' f'' f'''. (AllN (Prod h) c xs, HAp h, HAp (Prod h)) => proxy c -> (forall (a :: k). c a => f a -> f' a -> f'' a -> f''' a) -> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs
- Generics.SOP: hd :: () => NP f (x : xs) -> f x
+ Generics.SOP: hd :: forall k f (x :: k) (xs :: [k]). NP f (x : xs) -> f x
- Generics.SOP: hexpand :: (HExpand h, SListIN (Prod h) xs) => (forall (x :: k). () => f x) -> h f xs -> Prod h f xs
+ Generics.SOP: hexpand :: forall (xs :: l) f. (HExpand h, SListIN (Prod h) xs) => (forall (x :: k). () => f x) -> h f xs -> Prod h f xs
- Generics.SOP: hfromI :: (AllZipN (Prod h1) (LiftedCoercible I f) xs ys, HTrans h1 h2) => h1 I xs -> h2 f ys
+ Generics.SOP: hfromI :: forall l1 k2 l2 h1 (f :: k2 -> Type) (xs :: l1) (ys :: l2) h2. (AllZipN (Prod h1) (LiftedCoercible I f) xs ys, HTrans h1 h2) => h1 I xs -> h2 f ys
- Generics.SOP: hindex :: HIndex h => h f xs -> Int
+ Generics.SOP: hindex :: forall (f :: k -> Type) (xs :: l). HIndex h => h f xs -> Int
- Generics.SOP: hliftA :: (SListIN (Prod h) xs, HAp h) => (forall (a :: k). () => f a -> f' a) -> h f xs -> h f' xs
+ Generics.SOP: hliftA :: forall k l h (xs :: l) f f'. (SListIN (Prod h) xs, HAp h) => (forall (a :: k). () => f a -> f' a) -> h f xs -> h f' xs
- Generics.SOP: hliftA2 :: (SListIN (Prod h) xs, HAp h, HAp (Prod h)) => (forall (a :: k). () => f a -> f' a -> f'' a) -> Prod h f xs -> h f' xs -> h f'' xs
+ Generics.SOP: hliftA2 :: forall k l h (xs :: l) f f' f''. (SListIN (Prod h) xs, HAp h, HAp (Prod h)) => (forall (a :: k). () => f a -> f' a -> f'' a) -> Prod h f xs -> h f' xs -> h f'' xs
- Generics.SOP: hliftA3 :: (SListIN (Prod h) xs, HAp h, HAp (Prod h)) => (forall (a :: k). () => f a -> f' a -> f'' a -> f''' a) -> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs
+ Generics.SOP: hliftA3 :: forall k l h (xs :: l) f f' f'' f'''. (SListIN (Prod h) xs, HAp h, HAp (Prod h)) => (forall (a :: k). () => f a -> f' a -> f'' a -> f''' a) -> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs
- Generics.SOP: hmap :: (SListIN (Prod h) xs, HAp h) => (forall (a :: k). () => f a -> f' a) -> h f xs -> h f' xs
+ Generics.SOP: hmap :: forall k l h (xs :: l) f f'. (SListIN (Prod h) xs, HAp h) => (forall (a :: k). () => f a -> f' a) -> h f xs -> h f' xs
- Generics.SOP: hpure :: (HPure h, SListIN h xs) => (forall (a :: k). () => f a) -> h f xs
+ Generics.SOP: hpure :: forall (xs :: l) f. (HPure h, SListIN h xs) => (forall (a :: k). () => f a) -> h f xs
- Generics.SOP: hsequence :: (SListIN h xs, SListIN (Prod h) xs, HSequence h, Applicative f) => h f xs -> f (h I xs)
+ Generics.SOP: hsequence :: forall l h (xs :: l) f. (SListIN h xs, SListIN (Prod h) xs, HSequence h, Applicative f) => h f xs -> f (h I xs)
- Generics.SOP: hsequence' :: (HSequence h, SListIN h xs, Applicative f) => h (f :.: g) xs -> f (h g xs)
+ Generics.SOP: hsequence' :: forall (xs :: l) f (g :: k -> Type). (HSequence h, SListIN h xs, Applicative f) => h (f :.: g) xs -> f (h g xs)
- Generics.SOP: hsequenceK :: (SListIN h xs, SListIN (Prod h) xs, Applicative f, HSequence h) => h (K (f a) :: k -> Type) xs -> f (h (K a :: k -> Type) xs)
+ Generics.SOP: hsequenceK :: forall k l h (xs :: l) f a. (SListIN h xs, SListIN (Prod h) xs, Applicative f, HSequence h) => h (K (f a) :: k -> Type) xs -> f (h (K a :: k -> Type) xs)
- Generics.SOP: htoI :: (AllZipN (Prod h1) (LiftedCoercible f I) xs ys, HTrans h1 h2) => h1 f xs -> h2 I ys
+ Generics.SOP: htoI :: forall k1 l1 l2 h1 (f :: k1 -> Type) (xs :: l1) (ys :: l2) h2. (AllZipN (Prod h1) (LiftedCoercible f I) xs ys, HTrans h1 h2) => h1 f xs -> h2 I ys
- Generics.SOP: htrans :: (HTrans h1 h2, AllZipN (Prod h1) c xs ys) => proxy c -> (forall (x :: k1) (y :: k2). c x y => f x -> g y) -> h1 f xs -> h2 g ys
+ Generics.SOP: htrans :: forall c (xs :: l1) (ys :: l2) proxy f g. (HTrans h1 h2, AllZipN (Prod h1) c xs ys) => proxy c -> (forall (x :: k1) (y :: k2). c x y => f x -> g y) -> h1 f xs -> h2 g ys
- Generics.SOP: htraverse' :: (HSequence h, SListIN h xs, Applicative g) => (forall (a :: k). () => f a -> g (f' a)) -> h f xs -> g (h f' xs)
+ Generics.SOP: htraverse' :: forall (xs :: l) g f f'. (HSequence h, SListIN h xs, Applicative g) => (forall (a :: k). () => f a -> g (f' a)) -> h f xs -> g (h f' xs)
- Generics.SOP: htraverse_ :: (HTraverse_ h, SListIN h xs, Applicative g) => (forall (a :: k). () => f a -> g ()) -> h f xs -> g ()
+ Generics.SOP: htraverse_ :: forall (xs :: l) g f. (HTraverse_ h, SListIN h xs, Applicative g) => (forall (a :: k). () => f a -> g ()) -> h f xs -> g ()
- Generics.SOP: hzipWith :: (SListIN (Prod h) xs, HAp h, HAp (Prod h)) => (forall (a :: k). () => f a -> f' a -> f'' a) -> Prod h f xs -> h f' xs -> h f'' xs
+ Generics.SOP: hzipWith :: forall k l h (xs :: l) f f' f''. (SListIN (Prod h) xs, HAp h, HAp (Prod h)) => (forall (a :: k). () => f a -> f' a -> f'' a) -> Prod h f xs -> h f' xs -> h f'' xs
- Generics.SOP: hzipWith3 :: (SListIN (Prod h) xs, HAp h, HAp (Prod h)) => (forall (a :: k). () => f a -> f' a -> f'' a -> f''' a) -> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs
+ Generics.SOP: hzipWith3 :: forall k l h (xs :: l) f f' f'' f'''. (SListIN (Prod h) xs, HAp h, HAp (Prod h)) => (forall (a :: k). () => f a -> f' a -> f'' a -> f''' a) -> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs
- Generics.SOP: injections :: SListI xs => NP (Injection f xs) xs
+ Generics.SOP: injections :: forall k (xs :: [k]) (f :: k -> Type). SListI xs => NP (Injection f xs) xs
- Generics.SOP: lengthSList :: SListI xs => proxy xs -> Int
+ Generics.SOP: lengthSList :: forall k (xs :: [k]) proxy. SListI xs => proxy xs -> Int
- Generics.SOP: mapII :: () => (a -> b) -> I a -> I b
+ Generics.SOP: mapII :: (a -> b) -> I a -> I b
- Generics.SOP: mapIII :: () => (a -> b -> c) -> I a -> I b -> I c
+ Generics.SOP: mapIII :: (a -> b -> c) -> I a -> I b -> I c
- Generics.SOP: mapIIK :: () => (a -> b -> c) -> I a -> I b -> K c d
+ Generics.SOP: mapIIK :: forall k a b c (d :: k). (a -> b -> c) -> I a -> I b -> K c d
- Generics.SOP: mapIK :: () => (a -> b) -> I a -> K b c
+ Generics.SOP: mapIK :: forall k a b (c :: k). (a -> b) -> I a -> K b c
- Generics.SOP: mapIKI :: () => (a -> b -> c) -> I a -> K b d -> I c
+ Generics.SOP: mapIKI :: forall k a b c (d :: k). (a -> b -> c) -> I a -> K b d -> I c
- Generics.SOP: mapIKK :: () => (a -> b -> c) -> I a -> K b d -> K c e
+ Generics.SOP: mapIKK :: forall k1 k2 a b c (d :: k1) (e :: k2). (a -> b -> c) -> I a -> K b d -> K c e
- Generics.SOP: mapKI :: () => (a -> b) -> K a c -> I b
+ Generics.SOP: mapKI :: forall k a b (c :: k). (a -> b) -> K a c -> I b
- Generics.SOP: mapKII :: () => (a -> b -> c) -> K a d -> I b -> I c
+ Generics.SOP: mapKII :: forall k a b c (d :: k). (a -> b -> c) -> K a d -> I b -> I c
- Generics.SOP: mapKIK :: () => (a -> b -> c) -> K a d -> I b -> K c e
+ Generics.SOP: mapKIK :: forall k1 k2 a b c (d :: k1) (e :: k2). (a -> b -> c) -> K a d -> I b -> K c e
- Generics.SOP: mapKK :: () => (a -> b) -> K a c -> K b d
+ Generics.SOP: mapKK :: forall k1 k2 a b (c :: k1) (d :: k2). (a -> b) -> K a c -> K b d
- Generics.SOP: mapKKI :: () => (a -> b -> c) -> K a d -> K b e -> I c
+ Generics.SOP: mapKKI :: forall k1 k2 a b c (d :: k1) (e :: k2). (a -> b -> c) -> K a d -> K b e -> I c
- Generics.SOP: mapKKK :: () => (a -> b -> c) -> K a d -> K b e -> K c f
+ Generics.SOP: mapKKK :: forall k1 k2 k3 a b c (d :: k1) (e :: k2) (f :: k3). (a -> b -> c) -> K a d -> K b e -> K c f
- Generics.SOP: newtype (:.:) (f :: l -> Type) (g :: k -> l) (p :: k)
+ Generics.SOP: newtype ( (f :: l -> Type) :.: (g :: k -> l) ) (p :: k)
- Generics.SOP: para_SList :: SListI xs => r ([] :: [k]) -> (forall (y :: k) (ys :: [k]). SListI ys => r ys -> r (y : ys)) -> r xs
+ Generics.SOP: para_SList :: forall k (xs :: [k]) r. SListI xs => r ('[] :: [k]) -> (forall (y :: k) (ys :: [k]). SListI ys => r ys -> r (y : ys)) -> r xs
- Generics.SOP: projections :: SListI xs => NP (Projection f xs) xs
+ Generics.SOP: projections :: forall k (xs :: [k]) (f :: k -> Type). SListI xs => NP (Projection f xs) xs
- Generics.SOP: sList :: SListI xs => SList xs
+ Generics.SOP: sList :: forall k (xs :: [k]). SListI xs => SList xs
- Generics.SOP: shape :: SListI xs => Shape xs
+ Generics.SOP: shape :: forall k (xs :: [k]). SListI xs => Shape xs
- Generics.SOP: shift :: () => Injection f xs a2 -> Injection f (x : xs) a2
+ Generics.SOP: shift :: forall a1 (f :: a1 -> Type) (xs :: [a1]) (a2 :: a1) (x :: a1). Injection f xs a2 -> Injection f (x : xs) a2
- Generics.SOP: shiftInjection :: () => Injection f xs a2 -> Injection f (x : xs) a2
+ Generics.SOP: shiftInjection :: forall a1 (f :: a1 -> Type) (xs :: [a1]) (a2 :: a1) (x :: a1). Injection f xs a2 -> Injection f (x : xs) a2
- Generics.SOP: shiftProjection :: () => Projection f xs a2 -> Projection f (x : xs) a2
+ Generics.SOP: shiftProjection :: forall a1 (f :: a1 -> Type) (xs :: [a1]) (a2 :: a1) (x :: a1). Projection f xs a2 -> Projection f (x : xs) a2
- Generics.SOP: tl :: () => NP f (x : xs) -> NP f xs
+ Generics.SOP: tl :: forall k (f :: k -> Type) (x :: k) (xs :: [k]). NP f (x : xs) -> NP f xs
- Generics.SOP: type Injection (f :: k -> Type) (xs :: [k]) = f -.-> (K NS f xs :: k -> Type)
+ Generics.SOP: type Injection (f :: k -> Type) (xs :: [k]) = f -.-> K NS f xs :: k -> Type
- Generics.SOP: type IsWrappedType (a :: Type) (x :: Type) = (Generic a, Code a ~ '['[x]])
+ Generics.SOP: type IsWrappedType (a :: Type) (x :: Type) = (Generic a, Code a ~ '[ '[x]])
- Generics.SOP: type Projection (f :: k -> Type) (xs :: [k]) = (K NP f xs :: k -> Type) -.-> f
+ Generics.SOP: type Projection (f :: k -> Type) (xs :: [k]) = K NP f xs :: k -> Type -.-> f
- Generics.SOP: type SListI = All (Top :: k -> Constraint)
+ Generics.SOP: type SListI = All Top :: k -> Constraint
- Generics.SOP: type SListI2 = All (SListI :: [k] -> Constraint)
+ Generics.SOP: type SListI2 = All SListI :: [k] -> Constraint
- Generics.SOP: type family SameShapeAs (xs :: [a]) (ys :: [b]) :: Constraint
+ Generics.SOP: type family SameShapeAs (xs :: [a]) (ys :: [b])
- Generics.SOP: unComp :: () => (f :.: g) p -> f (g p)
+ Generics.SOP: unComp :: forall l k f (g :: k -> l) (p :: k). (f :.: g) p -> f (g p)
- Generics.SOP: unI :: () => I a -> a
+ Generics.SOP: unI :: I a -> a
- Generics.SOP: unK :: () => K a b -> a
+ Generics.SOP: unK :: forall k a (b :: k). K a b -> a
- Generics.SOP: unPOP :: () => POP f xss -> NP (NP f) xss
+ Generics.SOP: unPOP :: forall k (f :: k -> Type) (xss :: [[k]]). POP f xss -> NP (NP f) xss
- Generics.SOP: unSOP :: () => SOP f xss -> NS (NP f) xss
+ Generics.SOP: unSOP :: forall k (f :: k -> Type) (xss :: [[k]]). SOP f xss -> NS (NP f) xss
- Generics.SOP: unZ :: () => NS f (x : ([] :: [k])) -> f x
+ Generics.SOP: unZ :: forall k f (x :: k). NS f '[x] -> f x
- Generics.SOP.Metadata: [ADT] :: ModuleName -> DatatypeName -> NP ConstructorInfo xss -> DatatypeInfo xss
+ Generics.SOP.Metadata: [ADT] :: ModuleName -> DatatypeName -> NP ConstructorInfo xss -> POP StrictnessInfo xss -> DatatypeInfo xss
- Generics.SOP.Metadata: [Newtype] :: ModuleName -> DatatypeName -> ConstructorInfo '[x] -> DatatypeInfo '['[x]]
+ Generics.SOP.Metadata: [Newtype] :: ModuleName -> DatatypeName -> ConstructorInfo '[x] -> DatatypeInfo '[ '[x]]
- Generics.SOP.Type.Metadata: ADT :: ModuleName -> DatatypeName -> [ConstructorInfo] -> DatatypeInfo
+ Generics.SOP.Type.Metadata: ADT :: ModuleName -> DatatypeName -> [ConstructorInfo] -> [[StrictnessInfo]] -> DatatypeInfo
- Generics.SOP.Universe: type IsWrappedType (a :: Type) (x :: Type) = (Generic a, Code a ~ '['[x]])
+ Generics.SOP.Universe: type IsWrappedType (a :: Type) (x :: Type) = (Generic a, Code a ~ '[ '[x]])
Files
- CHANGELOG.md +11/−0
- Setup.hs +0/−2
- generics-sop.cabal +3/−3
- src/Generics/SOP.hs +14/−1
- src/Generics/SOP/GGP.hs +14/−1
- src/Generics/SOP/Metadata.hs +52/−10
- src/Generics/SOP/TH.hs +84/−1
- src/Generics/SOP/Type/Metadata.hs +129/−4
- src/Generics/SOP/Universe.hs +1/−1
CHANGELOG.md view
@@ -1,3 +1,14 @@+# 0.5.0.0 (2019-05-09)++* Add strictness info to the metadata. This means that+ code directly using the `ADT` constructor has to be+ modified because it now has a new fourth argument.+ (See #76 and #87.)++* Depend on `sop-core-0.5.0.*` which changes the+ definition of `SameShapeAs` to improve compiler+ performance and adds "ejections".+ # 0.4.0.1 (2018-10-23) * Remove `GHC.Event` import in `Generics.SOP.Instances`
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
generics-sop.cabal view
@@ -1,5 +1,5 @@ name: generics-sop-version: 0.4.0.1+version: 0.5.0.0 synopsis: Generic Programming using True Sums of Products description: A library to support the definition of generic functions.@@ -42,7 +42,7 @@ build-type: Simple cabal-version: >=1.10 extra-source-files: CHANGELOG.md doctest.sh-tested-with: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.3, GHC == 8.6.1+tested-with: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5 source-repository head type: git@@ -66,7 +66,7 @@ Generics.SOP.NS Generics.SOP.Sing build-depends: base >= 4.9 && < 5,- sop-core == 0.4.0.*,+ sop-core == 0.5.0.*, template-haskell >= 2.8 && < 2.15, ghc-prim >= 0.3 && < 0.6 hs-source-dirs: src
src/Generics/SOP.hs view
@@ -25,7 +25,7 @@ -- witness the isomorphism. -- -- 3. Since all 'Rep' types are sums of products, you can define--- functions over them by performing induction on the structure, of+-- functions over them by performing induction on the structure, or -- by using predefined combinators that the library provides. Such -- functions then work for all 'Rep' types. --@@ -224,9 +224,19 @@ Generic(..) , Rep , IsProductType+ , ProductCode+ , productTypeFrom+ , productTypeTo , IsEnumType+ , enumTypeFrom+ , enumTypeTo , IsWrappedType+ , WrappedCode+ , wrappedTypeFrom+ , wrappedTypeTo , IsNewtype+ , newtypeFrom+ , newtypeTo -- * n-ary datatypes , NP(..) , NS(..)@@ -292,6 +302,9 @@ -- ** Destructing sums , unZ , HIndex(..)+ , Ejection+ , ejections+ , shiftEjection -- ** Dealing with @'All' c@ , hcliftA' , hcliftA2'
src/Generics/SOP/GGP.hs view
@@ -46,9 +46,22 @@ type family ToInfo (a :: Type -> Type) :: SOP.T.DatatypeInfo type instance ToInfo (M1 D (MetaData n m p False) a) =- SOP.T.ADT m n (ToSumInfo a '[])+ SOP.T.ADT m n (ToSumInfo a '[]) (ToStrictnessInfoss a '[]) type instance ToInfo (M1 D (MetaData n m p True) a) = SOP.T.Newtype m n (ToSingleConstructorInfo a)++type family ToStrictnessInfoss (a :: Type -> Type) (xss :: [[SOP.T.StrictnessInfo]]) :: [[SOP.T.StrictnessInfo]]+type instance ToStrictnessInfoss (a :+: b) xss = ToStrictnessInfoss a (ToStrictnessInfoss b xss)+type instance ToStrictnessInfoss V1 xss = xss+type instance ToStrictnessInfoss (M1 C _ a) xss = ToStrictnessInfos a '[] ': xss++type family ToStrictnessInfos (a :: Type -> Type) (xs :: [SOP.T.StrictnessInfo]) :: [SOP.T.StrictnessInfo]+type instance ToStrictnessInfos (a :*: b) xs = ToStrictnessInfos a (ToStrictnessInfos b xs)+type instance ToStrictnessInfos U1 xs = xs+type instance ToStrictnessInfos (M1 S s a) xs = ToStrictnessInfo s ': xs++type family ToStrictnessInfo (s :: Meta) :: SOP.T.StrictnessInfo+type instance ToStrictnessInfo (MetaSel _ su ss ds) = 'SOP.T.StrictnessInfo su ss ds type family ToSumInfo (a :: Type -> Type) (xs :: [SOP.T.ConstructorInfo]) :: [SOP.T.ConstructorInfo] type instance ToSumInfo (a :+: b) xs = ToSumInfo a (ToSumInfo b xs)
src/Generics/SOP/Metadata.hs view
@@ -15,10 +15,18 @@ ( module Generics.SOP.Metadata -- * re-exports , Associativity(..)+ , DecidedStrictness(..)+ , SourceStrictness(..)+ , SourceUnpackedness(..) ) where import Data.Kind (Type)-import GHC.Generics (Associativity(..))+import GHC.Generics+ ( Associativity(..)+ , DecidedStrictness(..)+ , SourceStrictness(..)+ , SourceUnpackedness(..)+ ) import Generics.SOP.Constraint import Generics.SOP.NP@@ -35,16 +43,25 @@ -- data DatatypeInfo :: [[Type]] -> Type where -- Standard algebraic datatype- ADT :: ModuleName -> DatatypeName -> NP ConstructorInfo xss -> DatatypeInfo xss+ ADT ::+ ModuleName+ -> DatatypeName+ -> NP ConstructorInfo xss+ -> POP StrictnessInfo xss+ -> DatatypeInfo xss -- Newtype- Newtype :: ModuleName -> DatatypeName -> ConstructorInfo '[x] -> DatatypeInfo '[ '[x] ]+ Newtype ::+ ModuleName+ -> DatatypeName+ -> ConstructorInfo '[x]+ -> DatatypeInfo '[ '[x] ] -- | The module name where a datatype is defined. -- -- @since 0.2.3.0 -- moduleName :: DatatypeInfo xss -> ModuleName-moduleName (ADT name _ _) = name+moduleName (ADT name _ _ _) = name moduleName (Newtype name _ _) = name -- | The name of a datatype (or newtype).@@ -52,7 +69,7 @@ -- @since 0.2.3.0 -- datatypeName :: DatatypeInfo xss -> DatatypeName-datatypeName (ADT _ name _ ) = name+datatypeName (ADT _ name _ _) = name datatypeName (Newtype _ name _) = name -- | The constructor info for a datatype (or newtype).@@ -60,14 +77,25 @@ -- @since 0.2.3.0 -- constructorInfo :: DatatypeInfo xss -> NP ConstructorInfo xss-constructorInfo (ADT _ _ cs) = cs+constructorInfo (ADT _ _ cs _) = cs constructorInfo (Newtype _ _ c) = c :* Nil -deriving instance All (Show `Compose` ConstructorInfo) xs => Show (DatatypeInfo xs)-deriving instance All (Eq `Compose` ConstructorInfo) xs => Eq (DatatypeInfo xs)-deriving instance (All (Eq `Compose` ConstructorInfo) xs, All (Ord `Compose` ConstructorInfo) xs) => Ord (DatatypeInfo xs)+deriving instance+ ( All (Show `Compose` ConstructorInfo) xs+ , All (Show `Compose` NP StrictnessInfo) xs+ ) => Show (DatatypeInfo xs)+deriving instance+ ( All (Eq `Compose` ConstructorInfo) xs+ , All (Eq `Compose` NP StrictnessInfo) xs+ ) => Eq (DatatypeInfo xs)+deriving instance+ ( All (Eq `Compose` ConstructorInfo) xs+ , All (Ord `Compose` ConstructorInfo) xs+ , All (Eq `Compose` NP StrictnessInfo) xs+ , All (Ord `Compose` NP StrictnessInfo) xs+ ) => Ord (DatatypeInfo xs) --- | Metadata for a single constructors.+-- | Metadata for a single constructor. -- -- This is indexed by the product structure of the constructor components. --@@ -91,6 +119,20 @@ deriving instance All (Show `Compose` FieldInfo) xs => Show (ConstructorInfo xs) deriving instance All (Eq `Compose` FieldInfo) xs => Eq (ConstructorInfo xs) deriving instance (All (Eq `Compose` FieldInfo) xs, All (Ord `Compose` FieldInfo) xs) => Ord (ConstructorInfo xs)++-- | Metadata for strictness information of a field.+--+-- Indexed by the type of the field.+--+-- @since 0.4.0.0+--+data StrictnessInfo :: Type -> Type where+ StrictnessInfo ::+ SourceUnpackedness+ -> SourceStrictness+ -> DecidedStrictness+ -> StrictnessInfo a+ deriving (Show, Eq, Ord, Functor) -- | For records, this functor maps the component to its selector name. data FieldInfo :: Type -> Type where
src/Generics/SOP/TH.hs view
@@ -10,7 +10,7 @@ , deriveMetadataType ) where -import Control.Monad (replicateM)+import Control.Monad (join, replicateM) import Data.List (foldl') import Data.Maybe (fromMaybe) import Data.Proxy@@ -193,7 +193,11 @@ deriveGenericForDataType :: (Name -> Q Type) -> Q Type -> [Con] -> Q [Dec] deriveGenericForDataType f typ cons = do+#if MIN_VERSION_template_haskell(2,15,0)+ let codeSyn = tySynInstD (tySynEqn Nothing [t| Code $typ |] (codeFor f cons))+#else let codeSyn = tySynInstD ''Code $ tySynEqn [typ] (codeFor f cons)+#endif inst <- instanceD (cxt []) [t| Generic $typ |]@@ -301,7 +305,11 @@ metadataType :: Q Type -> Bool -> Name -> [Con] -> Q Dec metadataType typ isNewtype typeName cs =+#if MIN_VERSION_template_haskell(2,15,0)+ tySynInstD (tySynEqn Nothing [t| DatatypeInfoOf $typ |] (metadataType' isNewtype typeName cs))+#else tySynInstD ''DatatypeInfoOf (tySynEqn [typ] (metadataType' isNewtype typeName cs))+#endif -- | Derive term-level metadata. metadata' :: Bool -> Name -> [Con] -> Q Exp@@ -315,9 +323,27 @@ | otherwise = [| SOP.ADT $(stringE (nameModule' typeName)) $(stringE (nameBase typeName)) $(npE $ map mdCon cs)+ $(popE $ map mdStrictness cs) |] + mdStrictness :: Con -> Q [Q Exp]+ mdStrictness (NormalC n bts) = mdConStrictness n (map fst bts)+ mdStrictness (RecC n vbts) = mdConStrictness n (map (\ (_, b, _) -> b) vbts)+ mdStrictness (InfixC (b1, _) n (b2, _)) = mdConStrictness n [b1, b2]+ mdStrictness (ForallC _ _ _) = fail "Existentials not supported"+ mdStrictness (GadtC _ _ _) = fail "GADTs not supported"+ mdStrictness (RecGadtC _ _ _) = fail "GADTs not supported" + mdConStrictness :: Name -> [Bang] -> Q [Q Exp]+ mdConStrictness n bs = do+ dss <- reifyConStrictness n+ return (zipWith (\ (Bang su ss) ds ->+ [| SOP.StrictnessInfo+ $(mdSourceUnpackedness su)+ $(mdSourceStrictness ss)+ $(mdDecidedStrictness ds)+ |]) bs dss)+ mdCon :: Con -> Q Exp mdCon (NormalC n _) = [| SOP.Constructor $(stringE (nameBase n)) |] mdCon (RecC n ts) = [| SOP.Record $(stringE (nameBase n))@@ -335,6 +361,21 @@ mdField :: VarStrictType -> Q Exp mdField (n, _, _) = [| SOP.FieldInfo $(stringE (nameBase n)) |] + mdSourceUnpackedness :: SourceUnpackedness -> Q Exp+ mdSourceUnpackedness NoSourceUnpackedness = [| SOP.NoSourceUnpackedness |]+ mdSourceUnpackedness SourceNoUnpack = [| SOP.SourceNoUnpack |]+ mdSourceUnpackedness SourceUnpack = [| SOP.SourceUnpack |]++ mdSourceStrictness :: SourceStrictness -> Q Exp+ mdSourceStrictness NoSourceStrictness = [| SOP.NoSourceStrictness |]+ mdSourceStrictness SourceLazy = [| SOP.SourceLazy |]+ mdSourceStrictness SourceStrict = [| SOP.SourceStrict |]++ mdDecidedStrictness :: DecidedStrictness -> Q Exp+ mdDecidedStrictness DecidedLazy = [| SOP.DecidedLazy |]+ mdDecidedStrictness DecidedStrict = [| SOP.DecidedStrict |]+ mdDecidedStrictness DecidedUnpack = [| SOP.DecidedUnpack |]+ mdAssociativity :: FixityDirection -> Q Exp mdAssociativity InfixL = [| SOP.LeftAssociative |] mdAssociativity InfixR = [| SOP.RightAssociative |]@@ -352,9 +393,27 @@ | otherwise = [t| 'SOP.T.ADT $(stringT (nameModule' typeName)) $(stringT (nameBase typeName)) $(promotedTypeList $ map mdCon cs)+ $(promotedTypeListOfList $ map mdStrictness cs) |] + mdStrictness :: Con -> Q [Q Type]+ mdStrictness (NormalC n bts) = mdConStrictness n (map fst bts)+ mdStrictness (RecC n vbts) = mdConStrictness n (map (\ (_, b, _) -> b) vbts)+ mdStrictness (InfixC (b1, _) n (b2, _)) = mdConStrictness n [b1, b2]+ mdStrictness (ForallC _ _ _) = fail "Existentials not supported"+ mdStrictness (GadtC _ _ _) = fail "GADTs not supported"+ mdStrictness (RecGadtC _ _ _) = fail "GADTs not supported" + mdConStrictness :: Name -> [Bang] -> Q [Q Type]+ mdConStrictness n bs = do+ dss <- reifyConStrictness n+ return (zipWith (\ (Bang su ss) ds ->+ [t| 'SOP.T.StrictnessInfo+ $(mdSourceUnpackedness su)+ $(mdSourceStrictness ss)+ $(mdDecidedStrictness ds)+ |]) bs dss)+ mdCon :: Con -> Q Type mdCon (NormalC n _) = [t| 'SOP.T.Constructor $(stringT (nameBase n)) |] mdCon (RecC n ts) = [t| 'SOP.T.Record $(stringT (nameBase n))@@ -372,6 +431,21 @@ mdField :: VarStrictType -> Q Type mdField (n, _, _) = [t| 'SOP.T.FieldInfo $(stringT (nameBase n)) |] + mdSourceUnpackedness :: SourceUnpackedness -> Q Type+ mdSourceUnpackedness NoSourceUnpackedness = [t| 'SOP.NoSourceUnpackedness |]+ mdSourceUnpackedness SourceNoUnpack = [t| 'SOP.SourceNoUnpack |]+ mdSourceUnpackedness SourceUnpack = [t| 'SOP.SourceUnpack |]++ mdSourceStrictness :: SourceStrictness -> Q Type+ mdSourceStrictness NoSourceStrictness = [t| 'SOP.NoSourceStrictness |]+ mdSourceStrictness SourceLazy = [t| 'SOP.SourceLazy |]+ mdSourceStrictness SourceStrict = [t| 'SOP.SourceStrict |]++ mdDecidedStrictness :: DecidedStrictness -> Q Type+ mdDecidedStrictness DecidedLazy = [t| 'SOP.DecidedLazy |]+ mdDecidedStrictness DecidedStrict = [t| 'SOP.DecidedStrict |]+ mdDecidedStrictness DecidedUnpack = [t| 'SOP.DecidedUnpack |]+ mdAssociativity :: FixityDirection -> Q Type mdAssociativity InfixL = [t| 'SOP.T.LeftAssociative |] mdAssociativity InfixR = [t| 'SOP.T.RightAssociative |]@@ -395,6 +469,11 @@ npE [] = [| Nil |] npE (e:es) = [| $e :* $(npE es) |] +-- Construct a POP.+popE :: [Q [Q Exp]] -> Q Exp+popE ess =+ [| POP $(npE (map (join . fmap npE) ess)) |]+ -- Like npE, but construct a pattern instead npP :: [Q Pat] -> Q Pat npP [] = conP 'Nil []@@ -421,6 +500,10 @@ promotedTypeList :: [Q Type] -> Q Type promotedTypeList [] = promotedNilT promotedTypeList (t:ts) = [t| $promotedConsT $t $(promotedTypeList ts) |]++promotedTypeListOfList :: [Q [Q Type]] -> Q Type+promotedTypeListOfList =+ promotedTypeList . map (join . fmap promotedTypeList) promotedTypeListSubst :: (Name -> Q Type) -> [Q Type] -> Q Type promotedTypeListSubst _ [] = promotedNilT
src/Generics/SOP/Type/Metadata.hs view
@@ -35,7 +35,12 @@ import Data.Kind (Type) import Data.Proxy (Proxy (..))-import GHC.Generics (Associativity(..))+import GHC.Generics+ ( Associativity(..)+ , DecidedStrictness(..)+ , SourceStrictness(..)+ , SourceUnpackedness(..)+ ) import GHC.Types import GHC.TypeLits @@ -62,7 +67,7 @@ -- @since 0.3.0.0 -- data DatatypeInfo =- ADT ModuleName DatatypeName [ConstructorInfo]+ ADT ModuleName DatatypeName [ConstructorInfo] [[StrictnessInfo]] -- ^ Standard algebraic datatype | Newtype ModuleName DatatypeName ConstructorInfo -- ^ Newtype@@ -79,6 +84,13 @@ | Record ConstructorName [FieldInfo] -- ^ Record constructor +-- | Strictness information for a single field (to be used promoted).+--+-- @since 0.4.0.0+--+data StrictnessInfo =+ StrictnessInfo SourceUnpackedness SourceStrictness DecidedStrictness+ -- | Metadata for a single record field (to be used promoted). -- -- @since 0.3.0.0@@ -120,13 +132,18 @@ demoteDatatypeInfo :: proxy x -> M.DatatypeInfo xss instance- (KnownSymbol m, KnownSymbol d, DemoteConstructorInfos cs xss)- => DemoteDatatypeInfo ('ADT m d cs) xss where+ ( KnownSymbol m+ , KnownSymbol d+ , DemoteConstructorInfos cs xss+ , DemoteStrictnessInfoss sss xss+ )+ => DemoteDatatypeInfo ('ADT m d cs sss) xss where demoteDatatypeInfo _ = M.ADT (symbolVal (Proxy :: Proxy m)) (symbolVal (Proxy :: Proxy d)) (demoteConstructorInfos (Proxy :: Proxy cs))+ (POP (demoteStrictnessInfoss (Proxy :: Proxy sss))) instance (KnownSymbol m, KnownSymbol d, DemoteConstructorInfo c '[ x ])@@ -188,6 +205,48 @@ demoteConstructorInfo _ = M.Record (symbolVal (Proxy :: Proxy s)) (demoteFieldInfos (Proxy :: Proxy fs)) ++class DemoteStrictnessInfoss (sss :: [[StrictnessInfo]]) (xss :: [[Type]]) where+ demoteStrictnessInfoss :: proxy sss -> NP (NP M.StrictnessInfo) xss++instance DemoteStrictnessInfoss '[] '[] where+ demoteStrictnessInfoss _ = Nil++instance+ (DemoteStrictnessInfos ss xs, DemoteStrictnessInfoss sss xss)+ => DemoteStrictnessInfoss (ss ': sss) (xs ': xss) where+ demoteStrictnessInfoss _ =+ demoteStrictnessInfos (Proxy :: Proxy ss )+ :* demoteStrictnessInfoss (Proxy :: Proxy sss)++class DemoteStrictnessInfos (ss :: [StrictnessInfo]) (xs :: [Type]) where+ demoteStrictnessInfos :: proxy ss -> NP M.StrictnessInfo xs++instance DemoteStrictnessInfos '[] '[] where+ demoteStrictnessInfos _ = Nil++instance+ (DemoteStrictnessInfo s x, DemoteStrictnessInfos ss xs)+ => DemoteStrictnessInfos (s ': ss) (x ': xs) where+ demoteStrictnessInfos _ =+ demoteStrictnessInfo (Proxy :: Proxy s )+ :* demoteStrictnessInfos (Proxy :: Proxy ss)++class DemoteStrictnessInfo (s :: StrictnessInfo) (x :: Type) where+ demoteStrictnessInfo :: proxy s -> M.StrictnessInfo x++instance+ ( DemoteSourceUnpackedness su+ , DemoteSourceStrictness ss+ , DemoteDecidedStrictness ds+ )+ => DemoteStrictnessInfo ('StrictnessInfo su ss ds) x where+ demoteStrictnessInfo _ =+ M.StrictnessInfo+ (demoteSourceUnpackedness (Proxy :: Proxy su))+ (demoteSourceStrictness (Proxy :: Proxy ss))+ (demoteDecidedStrictness (Proxy :: Proxy ds))+ -- | Class for computing term-level field information from -- type-level field information. --@@ -246,4 +305,70 @@ instance DemoteAssociativity 'NotAssociative where demoteAssociativity _ = M.NotAssociative++-- | Class for computing term-level source unpackedness information+-- from type-level source unpackedness information.+--+-- @since 0.4.0.0+--+class DemoteSourceUnpackedness (a :: SourceUnpackedness) where+ -- | Given a proxy of some type-level source unpackedness information,+ -- return the corresponding term-level information.+ --+ -- @since 0.4.0.0+ --+ demoteSourceUnpackedness :: proxy a -> M.SourceUnpackedness++instance DemoteSourceUnpackedness 'NoSourceUnpackedness where+ demoteSourceUnpackedness _ = M.NoSourceUnpackedness++instance DemoteSourceUnpackedness 'SourceNoUnpack where+ demoteSourceUnpackedness _ = M.SourceNoUnpack++instance DemoteSourceUnpackedness 'SourceUnpack where+ demoteSourceUnpackedness _ = M.SourceUnpack++-- | Class for computing term-level source strictness information+-- from type-level source strictness information.+--+-- @since 0.4.0.0+--+class DemoteSourceStrictness (a :: SourceStrictness) where+ -- | Given a proxy of some type-level source strictness information,+ -- return the corresponding term-level information.+ --+ -- @since 0.4.0.0+ --+ demoteSourceStrictness :: proxy a -> M.SourceStrictness++instance DemoteSourceStrictness 'NoSourceStrictness where+ demoteSourceStrictness _ = M.NoSourceStrictness++instance DemoteSourceStrictness 'SourceLazy where+ demoteSourceStrictness _ = M.SourceLazy++instance DemoteSourceStrictness 'SourceStrict where+ demoteSourceStrictness _ = M.SourceStrict++-- | Class for computing term-level decided strictness information+-- from type-level decided strictness information.+--+-- @since 0.4.0.0+--+class DemoteDecidedStrictness (a :: DecidedStrictness) where+ -- | Given a proxy of some type-level source strictness information,+ -- return the corresponding term-level information.+ --+ -- @since 0.4.0.0+ --+ demoteDecidedStrictness :: proxy a -> M.DecidedStrictness++instance DemoteDecidedStrictness 'DecidedLazy where+ demoteDecidedStrictness _ = M.DecidedLazy++instance DemoteDecidedStrictness 'DecidedStrict where+ demoteDecidedStrictness _ = M.DecidedStrict++instance DemoteDecidedStrictness 'DecidedUnpack where+ demoteDecidedStrictness _ = M.DecidedUnpack
src/Generics/SOP/Universe.hs view
@@ -28,7 +28,7 @@ -- -- The SOP approach to generic programming is based on viewing -- datatypes as a representation ('Rep') built from the sum of--- products of its components. The components of are datatype+-- products of its components. The components of a datatype -- are specified using the 'Code' type family. -- -- The isomorphism between the original Haskell datatype and its