generics-sop 0.2.1.0 → 0.2.2.0
raw patch · 10 files changed
+248/−2 lines, 10 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Generics.SOP: (:*) :: f x -> NP f xs -> NP f (x : xs)
- Generics.SOP: ADT :: ModuleName -> DatatypeName -> NP ConstructorInfo xss -> DatatypeInfo xss
- Generics.SOP: Constructor :: ConstructorName -> ConstructorInfo xs
- Generics.SOP: FieldInfo :: FieldName -> FieldInfo a
- Generics.SOP: Infix :: ConstructorName -> Associativity -> Fixity -> ConstructorInfo '[x, y]
- Generics.SOP: Newtype :: ModuleName -> DatatypeName -> ConstructorInfo '[x] -> DatatypeInfo '['[x]]
- Generics.SOP: Nil :: NP f '[]
- Generics.SOP: Record :: ConstructorName -> NP FieldInfo xs -> ConstructorInfo xs
- Generics.SOP: S :: NS f xs -> NS f (x : xs)
- Generics.SOP: SCons :: SList (x : xs)
- Generics.SOP: SNil :: SList '[]
- Generics.SOP: ShapeCons :: Shape xs -> Shape (x : xs)
- Generics.SOP: ShapeNil :: Shape '[]
- Generics.SOP: Z :: f x -> NS f (x : xs)
- Generics.SOP.BasicFunctors: instance GHC.Generics.Constructor Generics.SOP.BasicFunctors.C1_0:.:
- Generics.SOP.BasicFunctors: instance GHC.Generics.Constructor Generics.SOP.BasicFunctors.C1_0I
- Generics.SOP.BasicFunctors: instance GHC.Generics.Constructor Generics.SOP.BasicFunctors.C1_0K
- Generics.SOP.BasicFunctors: instance GHC.Generics.Datatype Generics.SOP.BasicFunctors.D1:.:
- Generics.SOP.BasicFunctors: instance GHC.Generics.Datatype Generics.SOP.BasicFunctors.D1I
- Generics.SOP.BasicFunctors: instance GHC.Generics.Datatype Generics.SOP.BasicFunctors.D1K
- Generics.SOP.BasicFunctors: instance forall (k :: BOX) a (b :: k). GHC.Generics.Generic (Generics.SOP.BasicFunctors.K a b)
- Generics.SOP.BasicFunctors: instance forall (k :: BOX) a (b :: k). GHC.Show.Show a => GHC.Show.Show (Generics.SOP.BasicFunctors.K a b)
- Generics.SOP.BasicFunctors: instance forall (l :: BOX) (k :: BOX) (f :: l -> *) (g :: k -> l) (p :: k). GHC.Generics.Generic ((Generics.SOP.BasicFunctors.:.:) f g p)
- Generics.SOP.BasicFunctors: instance forall (l :: BOX) (k :: BOX) (f :: l -> *) (g :: k -> l) (p :: k). GHC.Show.Show (f (g p)) => GHC.Show.Show ((Generics.SOP.BasicFunctors.:.:) f g p)
- Generics.SOP.Constraint: instance forall (k :: BOX) (f :: k -> GHC.Prim.Constraint) (g :: k -> GHC.Prim.Constraint) (x :: k). (f x, g x) => Generics.SOP.Constraint.And f g x
- Generics.SOP.Constraint: instance forall (k :: BOX) (f :: k -> GHC.Prim.Constraint) (xs :: [k]). (Generics.SOP.Constraint.AllF f xs, Generics.SOP.Sing.SListI xs) => Generics.SOP.Constraint.All f xs
- Generics.SOP.Constraint: instance forall (k :: BOX) (f :: k -> GHC.Prim.Constraint) (xss :: [[k]]). (Generics.SOP.Constraint.AllF (Generics.SOP.Constraint.All f) xss, Generics.SOP.Sing.SListI xss) => Generics.SOP.Constraint.All2 f xss
- Generics.SOP.Constraint: instance forall (k :: BOX) (k1 :: BOX) (f :: k -> GHC.Prim.Constraint) (g :: k1 -> k) (x :: k1). f (g x) => Generics.SOP.Constraint.Compose f g x
- Generics.SOP.Constraint: instance forall (k :: BOX) (x :: k). Generics.SOP.Constraint.Top x
- Generics.SOP.Constraint: instance forall (k :: BOX) (xs :: [k]). Generics.SOP.Sing.SListI xs => Generics.SOP.Sing.SingI xs
- Generics.SOP.Constraint: instance forall (k :: BOX) (xss :: [[k]]). (Generics.SOP.Constraint.All Generics.SOP.Sing.SListI xss, Generics.SOP.Sing.SListI xss) => Generics.SOP.Sing.SingI xss
- Generics.SOP.Dict: Dict :: Dict c a
- Generics.SOP.Instances: instance Generics.SOP.Universe.Generic Data.Char.GeneralCategory
- Generics.SOP.Instances: instance Generics.SOP.Universe.HasDatatypeInfo Data.Char.GeneralCategory
- Generics.SOP.Metadata: ADT :: ModuleName -> DatatypeName -> NP ConstructorInfo xss -> DatatypeInfo xss
- Generics.SOP.Metadata: Constructor :: ConstructorName -> ConstructorInfo xs
- Generics.SOP.Metadata: FieldInfo :: FieldName -> FieldInfo a
- Generics.SOP.Metadata: Infix :: ConstructorName -> Associativity -> Fixity -> ConstructorInfo '[x, y]
- Generics.SOP.Metadata: Newtype :: ModuleName -> DatatypeName -> ConstructorInfo '[x] -> DatatypeInfo '['[x]]
- Generics.SOP.Metadata: Record :: ConstructorName -> NP FieldInfo xs -> ConstructorInfo xs
- Generics.SOP.NP: (:*) :: f x -> NP f xs -> NP f (x : xs)
- Generics.SOP.NP: Nil :: NP f '[]
- Generics.SOP.NP: instance forall (k :: BOX) (f :: k -> *) (xs :: [k]). (Generics.SOP.Constraint.All (Generics.SOP.Constraint.Compose GHC.Classes.Eq f) xs, Generics.SOP.Constraint.All (Generics.SOP.Constraint.Compose GHC.Classes.Ord f) xs) => GHC.Classes.Ord (Generics.SOP.NP.NP f xs)
- Generics.SOP.NP: instance forall (k :: BOX) (f :: k -> *) (xs :: [k]). Generics.SOP.Constraint.All (Generics.SOP.Constraint.Compose GHC.Classes.Eq f) xs => GHC.Classes.Eq (Generics.SOP.NP.NP f xs)
- Generics.SOP.NP: instance forall (k :: BOX) (f :: k -> *) (xs :: [k]). Generics.SOP.Constraint.All (Generics.SOP.Constraint.Compose GHC.Show.Show f) xs => GHC.Show.Show (Generics.SOP.NP.NP f xs)
- Generics.SOP.NP: instance forall (k :: BOX) (f :: k -> *) (xss :: [[k]]). GHC.Classes.Eq (Generics.SOP.NP.NP (Generics.SOP.NP.NP f) xss) => GHC.Classes.Eq (Generics.SOP.NP.POP f xss)
- Generics.SOP.NP: instance forall (k :: BOX) (f :: k -> *) (xss :: [[k]]). GHC.Classes.Ord (Generics.SOP.NP.NP (Generics.SOP.NP.NP f) xss) => GHC.Classes.Ord (Generics.SOP.NP.POP f xss)
- Generics.SOP.NP: instance forall (k :: BOX) (f :: k -> *) (xss :: [[k]]). GHC.Show.Show (Generics.SOP.NP.NP (Generics.SOP.NP.NP f) xss) => GHC.Show.Show (Generics.SOP.NP.POP f xss)
- Generics.SOP.NS: S :: NS f xs -> NS f (x : xs)
- Generics.SOP.NS: Z :: f x -> NS f (x : xs)
- Generics.SOP.NS: instance forall (k :: BOX) (f :: k -> *) (xs :: [k]). (Generics.SOP.Constraint.All (Generics.SOP.Constraint.Compose GHC.Classes.Eq f) xs, Generics.SOP.Constraint.All (Generics.SOP.Constraint.Compose GHC.Classes.Ord f) xs) => GHC.Classes.Ord (Generics.SOP.NS.NS f xs)
- Generics.SOP.NS: instance forall (k :: BOX) (f :: k -> *) (xs :: [k]). Generics.SOP.Constraint.All (Generics.SOP.Constraint.Compose GHC.Classes.Eq f) xs => GHC.Classes.Eq (Generics.SOP.NS.NS f xs)
- Generics.SOP.NS: instance forall (k :: BOX) (f :: k -> *) (xs :: [k]). Generics.SOP.Constraint.All (Generics.SOP.Constraint.Compose GHC.Show.Show f) xs => GHC.Show.Show (Generics.SOP.NS.NS f xs)
- Generics.SOP.NS: instance forall (k :: BOX) (f :: k -> *) (xss :: [[k]]). GHC.Classes.Eq (Generics.SOP.NS.NS (Generics.SOP.NP.NP f) xss) => GHC.Classes.Eq (Generics.SOP.NS.SOP f xss)
- Generics.SOP.NS: instance forall (k :: BOX) (f :: k -> *) (xss :: [[k]]). GHC.Classes.Ord (Generics.SOP.NS.NS (Generics.SOP.NP.NP f) xss) => GHC.Classes.Ord (Generics.SOP.NS.SOP f xss)
- Generics.SOP.NS: instance forall (k :: BOX) (f :: k -> *) (xss :: [[k]]). GHC.Show.Show (Generics.SOP.NS.NS (Generics.SOP.NP.NP f) xss) => GHC.Show.Show (Generics.SOP.NS.SOP f xss)
- Generics.SOP.Sing: SCons :: SList (x : xs)
- Generics.SOP.Sing: SNil :: SList '[]
- Generics.SOP.Sing: ShapeCons :: Shape xs -> Shape (x : xs)
- Generics.SOP.Sing: ShapeNil :: Shape '[]
- Generics.SOP.Sing: instance forall (k :: BOX) (x :: k) (xs :: [k]). Generics.SOP.Sing.SListI xs => Generics.SOP.Sing.SListI (x : xs)
- Generics.SOP.Sing: instance forall (k :: BOX) (xs :: [k]). GHC.Classes.Eq (Generics.SOP.Sing.SList xs)
- Generics.SOP.Sing: instance forall (k :: BOX) (xs :: [k]). GHC.Classes.Eq (Generics.SOP.Sing.Shape xs)
- Generics.SOP.Sing: instance forall (k :: BOX) (xs :: [k]). GHC.Classes.Ord (Generics.SOP.Sing.SList xs)
- Generics.SOP.Sing: instance forall (k :: BOX) (xs :: [k]). GHC.Classes.Ord (Generics.SOP.Sing.Shape xs)
- Generics.SOP.Sing: instance forall (k :: BOX) (xs :: [k]). GHC.Show.Show (Generics.SOP.Sing.SList xs)
- Generics.SOP.Sing: instance forall (k :: BOX) (xs :: [k]). GHC.Show.Show (Generics.SOP.Sing.Shape xs)
+ Generics.SOP: [:*] :: f x -> NP f xs -> NP f (x : xs)
+ Generics.SOP: [ADT] :: ModuleName -> DatatypeName -> NP ConstructorInfo xss -> DatatypeInfo xss
+ Generics.SOP: [Constructor] :: SListI xs => ConstructorName -> ConstructorInfo xs
+ Generics.SOP: [FieldInfo] :: FieldName -> FieldInfo a
+ Generics.SOP: [Infix] :: ConstructorName -> Associativity -> Fixity -> ConstructorInfo '[x, y]
+ Generics.SOP: [Newtype] :: ModuleName -> DatatypeName -> ConstructorInfo '[x] -> DatatypeInfo '['[x]]
+ Generics.SOP: [Nil] :: NP f '[]
+ Generics.SOP: [Record] :: SListI xs => ConstructorName -> NP FieldInfo xs -> ConstructorInfo xs
+ Generics.SOP: [SCons] :: SListI xs => SList (x : xs)
+ Generics.SOP: [SNil] :: SList '[]
+ Generics.SOP: [S] :: NS f xs -> NS f (x : xs)
+ Generics.SOP: [ShapeCons] :: SListI xs => Shape xs -> Shape (x : xs)
+ Generics.SOP: [ShapeNil] :: Shape '[]
+ Generics.SOP: [Z] :: f x -> NS f (x : xs)
+ Generics.SOP: type Code a = GCode a;
+ Generics.SOP: type family Code a :: [[*]];
+ Generics.SOP: unZ :: NS f '[x] -> f x
+ Generics.SOP: }
+ Generics.SOP.BasicFunctors: instance forall a k (b :: k). GHC.Generics.Generic (Generics.SOP.BasicFunctors.K a b)
+ Generics.SOP.BasicFunctors: instance forall a k (b :: k). GHC.Show.Show a => GHC.Show.Show (Generics.SOP.BasicFunctors.K a b)
+ Generics.SOP.BasicFunctors: instance forall l (f :: l -> GHC.Types.*) k (g :: k -> l) (p :: k). GHC.Generics.Generic ((Generics.SOP.BasicFunctors.:.:) f g p)
+ Generics.SOP.BasicFunctors: instance forall l (f :: l -> GHC.Types.*) k (g :: k -> l) (p :: k). GHC.Show.Show (f (g p)) => GHC.Show.Show ((Generics.SOP.BasicFunctors.:.:) f g p)
+ Generics.SOP.Constraint: instance forall k (f :: k -> GHC.Types.Constraint) (x :: k) (g :: k -> GHC.Types.Constraint). (f x, g x) => Generics.SOP.Constraint.And f g x
+ Generics.SOP.Constraint: instance forall k (f :: k -> GHC.Types.Constraint) (xs :: [k]). (Generics.SOP.Constraint.AllF f xs, Generics.SOP.Sing.SListI xs) => Generics.SOP.Constraint.All f xs
+ Generics.SOP.Constraint: instance forall k (f :: k -> GHC.Types.Constraint) (xss :: [[k]]). (Generics.SOP.Constraint.AllF (Generics.SOP.Constraint.All f) xss, Generics.SOP.Sing.SListI xss) => Generics.SOP.Constraint.All2 f xss
+ Generics.SOP.Constraint: instance forall k (x :: k). Generics.SOP.Constraint.Top x
+ Generics.SOP.Constraint: instance forall k (xs :: [k]). Generics.SOP.Sing.SListI xs => Generics.SOP.Sing.SingI xs
+ Generics.SOP.Constraint: instance forall k (xss :: [[k]]). (Generics.SOP.Constraint.All Generics.SOP.Sing.SListI xss, Generics.SOP.Sing.SListI xss) => Generics.SOP.Sing.SingI xss
+ Generics.SOP.Constraint: instance forall k k1 (f :: k -> GHC.Types.Constraint) (g :: k1 -> k) (x :: k1). f (g x) => Generics.SOP.Constraint.Compose f g x
+ Generics.SOP.Dict: [Dict] :: c a => Dict c a
+ Generics.SOP.Instances: instance Generics.SOP.Universe.Generic GHC.Unicode.GeneralCategory
+ Generics.SOP.Instances: instance Generics.SOP.Universe.HasDatatypeInfo GHC.Unicode.GeneralCategory
+ Generics.SOP.Metadata: [ADT] :: ModuleName -> DatatypeName -> NP ConstructorInfo xss -> DatatypeInfo xss
+ Generics.SOP.Metadata: [Constructor] :: SListI xs => ConstructorName -> ConstructorInfo xs
+ Generics.SOP.Metadata: [FieldInfo] :: FieldName -> FieldInfo a
+ Generics.SOP.Metadata: [Infix] :: ConstructorName -> Associativity -> Fixity -> ConstructorInfo '[x, y]
+ Generics.SOP.Metadata: [Newtype] :: ModuleName -> DatatypeName -> ConstructorInfo '[x] -> DatatypeInfo '['[x]]
+ Generics.SOP.Metadata: [Record] :: SListI xs => ConstructorName -> NP FieldInfo xs -> ConstructorInfo xs
+ Generics.SOP.NP: [:*] :: f x -> NP f xs -> NP f (x : xs)
+ Generics.SOP.NP: [Nil] :: NP f '[]
+ Generics.SOP.NP: instance forall k (f :: k -> *) (xs :: [k]). (Generics.SOP.Constraint.All (Generics.SOP.Constraint.Compose GHC.Classes.Eq f) xs, Generics.SOP.Constraint.All (Generics.SOP.Constraint.Compose GHC.Classes.Ord f) xs) => GHC.Classes.Ord (Generics.SOP.NP.NP f xs)
+ Generics.SOP.NP: instance forall k (f :: k -> *) (xs :: [k]). Generics.SOP.Constraint.All (Generics.SOP.Constraint.Compose GHC.Classes.Eq f) xs => GHC.Classes.Eq (Generics.SOP.NP.NP f xs)
+ Generics.SOP.NP: instance forall k (f :: k -> *) (xs :: [k]). Generics.SOP.Constraint.All (Generics.SOP.Constraint.Compose GHC.Show.Show f) xs => GHC.Show.Show (Generics.SOP.NP.NP f xs)
+ Generics.SOP.NP: instance forall k (f :: k -> GHC.Types.*) (xss :: [[k]]). GHC.Classes.Eq (Generics.SOP.NP.NP (Generics.SOP.NP.NP f) xss) => GHC.Classes.Eq (Generics.SOP.NP.POP f xss)
+ Generics.SOP.NP: instance forall k (f :: k -> GHC.Types.*) (xss :: [[k]]). GHC.Classes.Ord (Generics.SOP.NP.NP (Generics.SOP.NP.NP f) xss) => GHC.Classes.Ord (Generics.SOP.NP.POP f xss)
+ Generics.SOP.NP: instance forall k (f :: k -> GHC.Types.*) (xss :: [[k]]). GHC.Show.Show (Generics.SOP.NP.NP (Generics.SOP.NP.NP f) xss) => GHC.Show.Show (Generics.SOP.NP.POP f xss)
+ Generics.SOP.NS: [S] :: NS f xs -> NS f (x : xs)
+ Generics.SOP.NS: [Z] :: f x -> NS f (x : xs)
+ Generics.SOP.NS: instance forall k (f :: k -> *) (xs :: [k]). (Generics.SOP.Constraint.All (Generics.SOP.Constraint.Compose GHC.Classes.Eq f) xs, Generics.SOP.Constraint.All (Generics.SOP.Constraint.Compose GHC.Classes.Ord f) xs) => GHC.Classes.Ord (Generics.SOP.NS.NS f xs)
+ Generics.SOP.NS: instance forall k (f :: k -> *) (xs :: [k]). Generics.SOP.Constraint.All (Generics.SOP.Constraint.Compose GHC.Classes.Eq f) xs => GHC.Classes.Eq (Generics.SOP.NS.NS f xs)
+ Generics.SOP.NS: instance forall k (f :: k -> *) (xs :: [k]). Generics.SOP.Constraint.All (Generics.SOP.Constraint.Compose GHC.Show.Show f) xs => GHC.Show.Show (Generics.SOP.NS.NS f xs)
+ Generics.SOP.NS: instance forall k (f :: k -> GHC.Types.*) (xss :: [[k]]). GHC.Classes.Eq (Generics.SOP.NS.NS (Generics.SOP.NP.NP f) xss) => GHC.Classes.Eq (Generics.SOP.NS.SOP f xss)
+ Generics.SOP.NS: instance forall k (f :: k -> GHC.Types.*) (xss :: [[k]]). GHC.Classes.Ord (Generics.SOP.NS.NS (Generics.SOP.NP.NP f) xss) => GHC.Classes.Ord (Generics.SOP.NS.SOP f xss)
+ Generics.SOP.NS: instance forall k (f :: k -> GHC.Types.*) (xss :: [[k]]). GHC.Show.Show (Generics.SOP.NS.NS (Generics.SOP.NP.NP f) xss) => GHC.Show.Show (Generics.SOP.NS.SOP f xss)
+ Generics.SOP.NS: unZ :: NS f '[x] -> f x
+ Generics.SOP.Sing: [SCons] :: SListI xs => SList (x : xs)
+ Generics.SOP.Sing: [SNil] :: SList '[]
+ Generics.SOP.Sing: [ShapeCons] :: SListI xs => Shape xs -> Shape (x : xs)
+ Generics.SOP.Sing: [ShapeNil] :: Shape '[]
+ Generics.SOP.Sing: instance forall k (xs :: [k]) (x :: k). Generics.SOP.Sing.SListI xs => Generics.SOP.Sing.SListI (x : xs)
+ Generics.SOP.Sing: instance forall k (xs :: [k]). GHC.Classes.Eq (Generics.SOP.Sing.SList xs)
+ Generics.SOP.Sing: instance forall k (xs :: [k]). GHC.Classes.Eq (Generics.SOP.Sing.Shape xs)
+ Generics.SOP.Sing: instance forall k (xs :: [k]). GHC.Classes.Ord (Generics.SOP.Sing.SList xs)
+ Generics.SOP.Sing: instance forall k (xs :: [k]). GHC.Classes.Ord (Generics.SOP.Sing.Shape xs)
+ Generics.SOP.Sing: instance forall k (xs :: [k]). GHC.Show.Show (Generics.SOP.Sing.SList xs)
+ Generics.SOP.Sing: instance forall k (xs :: [k]). GHC.Show.Show (Generics.SOP.Sing.Shape xs)
+ Generics.SOP.Universe: type Code a = GCode a;
+ Generics.SOP.Universe: type family Code a :: [[*]];
+ Generics.SOP.Universe: }
- Generics.SOP: Proxy :: Proxy
+ Generics.SOP: Proxy :: Proxy k
- Generics.SOP: class (All SListI (Code a)) => Generic (a :: *) where type family Code a :: [[*]] Code a = GCode a from = gfrom to = gto
+ Generics.SOP: class (All SListI (Code a)) => Generic (a :: *) where type Code a :: [[*]] type Code a = GCode a from = gfrom to = gto where {
- Generics.SOP: data Proxy (t :: k) :: k -> *
+ Generics.SOP: data Proxy k (t :: k) :: forall k. k -> *
- Generics.SOP: datatypeInfo :: HasDatatypeInfo a => proxy a -> DatatypeInfo (Code a)
+ Generics.SOP: datatypeInfo :: (HasDatatypeInfo a, GDatatypeInfo a) => proxy a -> DatatypeInfo (GCode a)
- Generics.SOP: from :: Generic a => a -> Rep a
+ Generics.SOP: from :: (Generic a, GFrom a, Generic a) => a -> SOP I (GCode a)
- Generics.SOP: injections :: SListI xs => NP (Injection f xs) xs
+ Generics.SOP: injections :: forall xs f. SListI xs => NP (Injection f xs) xs
- Generics.SOP: lengthSList :: SListI xs => proxy xs -> Int
+ Generics.SOP: lengthSList :: forall (xs :: [k]) proxy. SListI xs => proxy xs -> Int
- Generics.SOP: projections :: SListI xs => NP (Projection f xs) xs
+ Generics.SOP: projections :: forall xs f. SListI xs => NP (Projection f xs) xs
- Generics.SOP: shape :: SListI xs => Shape xs
+ Generics.SOP: shape :: forall (xs :: [k]). SListI xs => Shape xs
- Generics.SOP: to :: Generic a => Rep a -> a
+ Generics.SOP: to :: (Generic a, GTo a, Generic a) => SOP I (GCode a) -> a
- Generics.SOP.Constraint: data Constraint :: BOX
+ Generics.SOP.Constraint: data Constraint :: *
- Generics.SOP.Dict: mapAll :: (forall a. Dict c a -> Dict d a) -> Dict (All c) xs -> Dict (All d) xs
+ Generics.SOP.Dict: mapAll :: forall c d xs. (forall a. Dict c a -> Dict d a) -> Dict (All c) xs -> Dict (All d) xs
- Generics.SOP.Dict: mapAll2 :: (forall a. Dict c a -> Dict d a) -> Dict (All2 c) xss -> Dict (All2 d) xss
+ Generics.SOP.Dict: mapAll2 :: forall c d xss. (forall a. Dict c a -> Dict d a) -> Dict (All2 c) xss -> Dict (All2 d) xss
- Generics.SOP.Dict: unAll_NP :: Dict (All c) xs -> NP (Dict c) xs
+ Generics.SOP.Dict: unAll_NP :: forall c xs. Dict (All c) xs -> NP (Dict c) xs
- Generics.SOP.Dict: unAll_POP :: Dict (All2 c) xss -> POP (Dict c) xss
+ Generics.SOP.Dict: unAll_POP :: forall c xss. Dict (All2 c) xss -> POP (Dict c) xss
- Generics.SOP.GGP: gdatatypeInfo :: (GDatatypeInfo a) => proxy a -> DatatypeInfo (GCode a)
+ Generics.SOP.GGP: gdatatypeInfo :: forall proxy a. (GDatatypeInfo a) => proxy a -> DatatypeInfo (GCode a)
- Generics.SOP.GGP: gto :: (GTo a, Generic a) => SOP I (GCode a) -> a
+ Generics.SOP.GGP: gto :: forall a. (GTo a, Generic a) => SOP I (GCode a) -> a
- Generics.SOP.NP: cpure_NP :: All c xs => proxy c -> (forall a. c a => f a) -> NP f xs
+ Generics.SOP.NP: cpure_NP :: forall c xs proxy f. All c xs => proxy c -> (forall a. c a => f a) -> NP f xs
- Generics.SOP.NP: cpure_POP :: All2 c xss => proxy c -> (forall a. c a => f a) -> POP f xss
+ Generics.SOP.NP: cpure_POP :: forall c xss proxy f. All2 c xss => proxy c -> (forall a. c a => f a) -> POP f xss
- Generics.SOP.NP: projections :: SListI xs => NP (Projection f xs) xs
+ Generics.SOP.NP: projections :: forall xs f. SListI xs => NP (Projection f xs) xs
- Generics.SOP.NP: pure_NP :: SListI xs => (forall a. f a) -> NP f xs
+ Generics.SOP.NP: pure_NP :: forall f xs. SListI xs => (forall a. f a) -> NP f xs
- Generics.SOP.NS: injections :: SListI xs => NP (Injection f xs) xs
+ Generics.SOP.NS: injections :: forall xs f. SListI xs => NP (Injection f xs) xs
- Generics.SOP.Sing: lengthSList :: SListI xs => proxy xs -> Int
+ Generics.SOP.Sing: lengthSList :: forall (xs :: [k]) proxy. SListI xs => proxy xs -> Int
- Generics.SOP.Sing: shape :: SListI xs => Shape xs
+ Generics.SOP.Sing: shape :: forall (xs :: [k]). SListI xs => Shape xs
- Generics.SOP.Universe: class (All SListI (Code a)) => Generic (a :: *) where type family Code a :: [[*]] Code a = GCode a from = gfrom to = gto
+ Generics.SOP.Universe: class (All SListI (Code a)) => Generic (a :: *) where type Code a :: [[*]] type Code a = GCode a from = gfrom to = gto where {
- Generics.SOP.Universe: datatypeInfo :: HasDatatypeInfo a => proxy a -> DatatypeInfo (Code a)
+ Generics.SOP.Universe: datatypeInfo :: (HasDatatypeInfo a, GDatatypeInfo a) => proxy a -> DatatypeInfo (GCode a)
- Generics.SOP.Universe: from :: Generic a => a -> Rep a
+ Generics.SOP.Universe: from :: (Generic a, GFrom a, Generic a) => a -> SOP I (GCode a)
- Generics.SOP.Universe: to :: Generic a => Rep a -> a
+ Generics.SOP.Universe: to :: (Generic a, GTo a, Generic a) => SOP I (GCode a) -> a
Files
- CHANGELOG.md +140/−0
- generics-sop.cabal +2/−1
- src/Generics/SOP.hs +2/−1
- src/Generics/SOP/Classes.hs +22/−0
- src/Generics/SOP/Constraint.hs +6/−0
- src/Generics/SOP/Dict.hs +41/−0
- src/Generics/SOP/NP.hs +6/−0
- src/Generics/SOP/NS.hs +17/−0
- src/Generics/SOP/Sing.hs +7/−0
- src/Generics/SOP/TH.hs +5/−0
+ CHANGELOG.md view
@@ -0,0 +1,140 @@+# 0.2.2.0++* Introduced `unZ` to destruct a unary sum.++* Add Haddock `@since` annotations for various functions.++# 0.2.1.0 (2016-02-08)++* Now includes a CHANGELOG.++* Should now work with ghc-8.0.1-rc1 and -rc2 (thanks to+ Oleg Grenrus).++* Introduced `hd` and `tl` to project out of a product, and+ `Projection` and `projections` as duals of `Injection` and+ `injections`.++# 0.2 (2015-10-23)++* Now tested with ghc-7.10++* Introduced names `hmap`, `hcmap`, `hzipWith`, `hczipWith` for+ `hliftA`, `hcliftA`, `hliftA2`, `hcliftA2`, respectively.+ Similarly for the specialized versions of these functions.++* The constraint transformers `All` and `All2` are now defined+ as type classes, not type families. As a consequence, the+ partial applications `All c` and `All2 c` are now possible.++* Because of the redefinition of `All` and `All2`, some special+ cases are no longer necessary. For example, `cpure_POP` can+ now be implemented as a nested application of `pure_NP`.++* Because of the redefinition of `All` and `All2`, the functions+ `hcliftA'` and variants (with prime!) are now deprecated.+ One can easily use the normal versions instead.+ For example, the definition of `hcliftA'` is now simply++ hcliftA' p = hcliftA (allP p)+ where+ allP :: proxy c -> Proxy (All c)+ allP _ = Proxy++* Because `All` and `All2` are now type classes, they now have+ superclass constraints implying that the type-level lists they+ are ranging over must have singletons.++ class (SListI xs, ...) => All c xs+ class (SListI xss, ...) => All2 c xss++ Some type signatures can be simplified due to this.++* The `SingI` typeclass and `Sing` datatypes are now deprecated.+ The replacements are called `SListI` and `SList`.+ The `sing` method is now called `sList`. The difference+ is that the new versions reveal only the spine of the list, and+ contain no singleton representation for the elements anymore.++ For one-dimensional type-level lists, replace++ SingI xs => ... ++ by++ SListI xs => ...++ For two-dimensional type-level lists, replace++ SingI xss => ...++ by++ All SListI xss => ...++ Because All itself implies `SListI xss` (see above), this+ constraint is equivalent to the old `Sing xss`.++ The old names are provided for (limited) backward+ compatibility. They map to the new constructs. This will+ work in some, but not all scenarios.++ The function `lengthSing` has also been renamed to+ `lengthSList` for consistency, and the old name is+ deprecated.++* All `Proxy c` arguments have been replaced by `proxy c`+ flexible arguments, so that other type constructors can be+ used as proxies.++* Class-level composition (`Compose`), pairing (`And`), and+ a trivial constraint (`Top`) have been added. Type-level map+ (`Map`) has been removed. Occurrences such as++ All c (Map f xs)++ should now be replaced with++ All (c `Compose` f) xs++* There is a new module called `Generics.SOP.Dict` that contains+ functions for manipulating dictionaries explicitly. These can+ be used to prove theorems about non-trivial class constraints+ such as the ones that get built using `All` and `All2`. Some+ such theorems are provided.++* There is a new TH function `deriveGenericFunctions` that+ derives the code of a datatype and conversion functions, but+ does not create a class instance. (Contributed by Oleg Grenrus.)++* There is a new TH function `deriveMetadataValue` that+ derives a `DatatypeInfo` value for a datatype, but does+ not create an instance of `HasDatatypeInfo`. (Contributed by+ Oleg Grenrus.)++* There is a very simple example file. (Contributed by Oleg+ Grenrus.)++* The function `hcollapse` for `NS` now results in an `a` rather+ than an `I a`, matching the specialized version `collapse_NS`.+ (Suggested by Roman Cheplyaka.)++# 0.1.1.2 (2015-03-27)++* Updated version bounds for ghc-prim (for ghc-7.10).++# 0.1.1.1 (2015-03-20)++* Preparations for ghc-7.10.++* Documentation fix. (Contributed by Roman Cheplyaka.)++# 0.1.1 (2015-01-06)++* Documentation fixes.++* Add superclass constraint (TODO).++* Now derive tuple instance for tuples up to 30 components.+ (Contributed by Michael Orlitzky.)+
generics-sop.cabal view
@@ -1,5 +1,5 @@ name: generics-sop-version: 0.2.1.0+version: 0.2.2.0 synopsis: Generic Programming using True Sums of Products description: A library to support the definition of generic functions.@@ -36,6 +36,7 @@ category: Generics build-type: Simple cabal-version: >=1.10+extra-source-files: CHANGELOG.md tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1 source-repository head
src/Generics/SOP.hs view
@@ -52,7 +52,7 @@ -- -- To create 'Generic' instances for @A@ and @B@ via "GHC.Generics", we say ----- > {-# LANGUAGE DeriveGenerics #-}+-- > {-# LANGUAGE DeriveGeneric #-} -- > -- > import qualified GHC.Generics as GHC -- > import Generics.SOP@@ -221,6 +221,7 @@ -- * n-ary datatypes , NP(..) , NS(..)+ , unZ , SOP(..) , unSOP , POP(..)
src/Generics/SOP/Classes.hs view
@@ -222,10 +222,21 @@ hliftA3 f xs ys zs = hpure (fn_3 f) `hap` xs `hap` ys `hap` zs -- | Another name for 'hliftA'.+--+-- @since 0.2+-- hmap :: (SListIN (Prod h) xs, HAp h) => (forall a. f a -> f' a) -> h f xs -> h f' xs+ -- | Another name for 'hliftA2'.+--+-- @since 0.2+-- hzipWith :: (SListIN (Prod h) xs, HAp h, HAp (Prod h)) => (forall a. f a -> f' a -> f'' a) -> Prod h f xs -> h f' xs -> h f'' xs+ -- | Another name for 'hliftA3'.+--+-- @since 0.2+-- hzipWith3 :: (SListIN (Prod h) xs, HAp h, HAp (Prod h)) => (forall a. f a -> f' a -> f'' a -> f''' a) -> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs hmap = hliftA@@ -267,10 +278,21 @@ hcliftA3 p f xs ys zs = hcpure p (fn_3 f) `hap` xs `hap` ys `hap` zs -- | Another name for 'hcliftA'.+--+-- @since 0.2+-- hcmap :: (AllN (Prod h) c xs, HAp h) => proxy c -> (forall a. c a => f a -> f' a) -> h f xs -> h f' xs+ -- | Another name for 'hcliftA2'.+--+-- @since 0.2+-- hczipWith :: (AllN (Prod h) c xs, HAp h, HAp (Prod h)) => proxy c -> (forall a. c a => f a -> f' a -> f'' a) -> Prod h f xs -> h f' xs -> h f'' xs+ -- | Another name for 'hcliftA3'.+--+-- @since 0.2+-- hczipWith3 :: (AllN (Prod h) c xs, HAp h, HAp (Prod h)) => proxy c -> (forall a. c a => f a -> f' a -> f'' a -> f''' a) -> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs hcmap = hcliftA
src/Generics/SOP/Constraint.hs view
@@ -98,17 +98,23 @@ -- 'NS'. For example, in order to denote that all elements on an -- @'NP' f xs@ satisfy 'Show', we can say @'All' ('Show' :. f) xs@. --+-- @since 0.2+-- class (f (g x)) => (f `Compose` g) x instance (f (g x)) => (f `Compose` g) x infixr 9 `Compose` -- | Pairing of constraints. --+-- @since 0.2+-- class (f x, g x) => (f `And` g) x instance (f x, g x) => (f `And` g) x infixl 7 `And` -- | A constraint that can always be satisfied.+--+-- @since 0.2 -- class Top x instance Top x
src/Generics/SOP/Dict.hs view
@@ -30,20 +30,31 @@ -- second argument so that @'Dict' c@ is of the correct -- kind to be used directly as a parameter to e.g. 'NP'. --+-- @since 0.2+-- data Dict (c :: k -> Constraint) (a :: k) where Dict :: c a => Dict c a -- | A proof that the trivial constraint holds -- over all type-level lists.+--+-- @since 0.2+-- pureAll :: SListI xs => Dict (All Top) xs pureAll = all_NP (hpure Dict) -- | A proof that the trivial constraint holds -- over all type-level lists of lists.+--+-- @since 0.2+-- pureAll2 :: All SListI xss => Dict (All2 Top) xss pureAll2 = all_POP (hpure Dict) -- | Lifts a dictionary conversion over a type-level list.+--+-- @since 0.2+-- mapAll :: forall c d xs . (forall a . Dict c a -> Dict d a) -> Dict (All c) xs -> Dict (All d) xs@@ -51,6 +62,9 @@ -- | Lifts a dictionary conversion over a type-level list -- of lists.+--+-- @since 0.2+-- mapAll2 :: forall c d xss . (forall a . Dict c a -> Dict d a) -> Dict (All2 c) xss -> Dict (All2 d) xss@@ -59,12 +73,18 @@ -- | If two constraints 'c' and 'd' hold over a type-level -- list 'xs', then the combination of both constraints holds -- over that list.+--+-- @since 0.2+-- zipAll :: Dict (All c) xs -> Dict (All d) xs -> Dict (All (c `And` d)) xs zipAll dc @ Dict dd = all_NP (hzipWith (\ Dict Dict -> Dict) (unAll_NP dc) (unAll_NP dd)) -- | If two constraints 'c' and 'd' hold over a type-level -- list of lists 'xss', then the combination of both constraints -- holds over that list of lists.+--+-- @since 0.2+-- zipAll2 :: All SListI xss => Dict (All2 c) xss -> Dict (All2 d) xss -> Dict (All2 (c `And` d)) xss zipAll2 dc dd = all_POP (hzipWith (\ Dict Dict -> Dict) (unAll_POP dc) (unAll_POP dd)) -- TODO: I currently don't understand why the All constraint in the beginning@@ -73,17 +93,26 @@ -- | If we have a constraint 'c' that holds over a type-level -- list 'xs', we can create a product containing proofs that -- each individual list element satisfies 'c'.+--+-- @since 0.2+-- unAll_NP :: forall c xs . Dict (All c) xs -> NP (Dict c) xs unAll_NP Dict = hcpure (Proxy :: Proxy c) Dict -- | If we have a constraint 'c' that holds over a type-level -- list of lists 'xss', we can create a product of products -- containing proofs that all the inner elements satisfy 'c'.+--+-- @since 0.2+-- unAll_POP :: forall c xss . Dict (All2 c) xss -> POP (Dict c) xss unAll_POP Dict = hcpure (Proxy :: Proxy c) Dict -- | If we have a product containing proofs that each element -- of 'xs' satisfies 'c', then 'All c' holds for 'xs'.+--+-- @since 0.2+-- all_NP :: NP (Dict c) xs -> Dict (All c) xs all_NP Nil = Dict all_NP (Dict :* ds) = withDict (all_NP ds) Dict@@ -91,19 +120,31 @@ -- | If we have a product of products containing proofs that -- each inner element of 'xss' satisfies 'c', then 'All2 c' -- holds for 'xss'.+--+-- @since 0.2+-- all_POP :: SListI xss => POP (Dict c) xss -> Dict (All2 c) xss all_POP = all2 . all_NP . hmap all_NP . unPOP -- TODO: Is the constraint necessary? -- | The constraint 'All2 c' is convertible to 'All (All c)'.+--+-- @since 0.2+-- unAll2 :: Dict (All2 c) xss -> Dict (All (All c)) xss unAll2 Dict = Dict -- | The constraint 'All (All c)' is convertible to 'All2 c'.+--+-- @since 0.2+-- all2 :: Dict (All (All c)) xss -> Dict (All2 c) xss all2 Dict = Dict -- | If we have an explicit dictionary, we can unwrap it and -- pass a function that makes use of it.+--+-- @since 0.2+-- withDict :: Dict c a -> (c a => r) -> r withDict Dict x = x
src/Generics/SOP/NP.hs view
@@ -259,10 +259,16 @@ -- * Destructing products -- | Obtain the head of an n-ary product.+--+-- @since 0.2.1.0+-- hd :: NP f (x ': xs) -> f x hd (x :* _xs) = x -- | Obtain the tail of an n-ary product.+--+-- @since 0.2.1.0+-- tl :: NP f (x ': xs) -> NP f xs tl (_x :* xs) = xs
src/Generics/SOP/NS.hs view
@@ -5,6 +5,7 @@ ( -- * Datatypes NS(..) , SOP(..)+ , unZ , unSOP -- * Constructing sums , Injection@@ -100,6 +101,22 @@ deriving instance All (Show `Compose` f) xs => Show (NS f xs) deriving instance All (Eq `Compose` f) xs => Eq (NS f xs) deriving instance (All (Eq `Compose` f) xs, All (Ord `Compose` f) xs) => Ord (NS f xs)++-- | Extract the payload from a unary sum.+--+-- For larger sums, this function would be partial, so it is only+-- provided with a rather restrictive type.+--+-- /Example:/+--+-- >>> unZ (Z (I 'x'))+-- I 'x'+--+-- @since 0.2.2.0+--+unZ :: NS f '[x] -> f x+unZ (Z x) = x+unZ _ = error "inaccessible" -- needed even in GHC 8.0.1 -- | A sum of products. --
src/Generics/SOP/Sing.hs view
@@ -35,6 +35,8 @@ -- list elements; we do not require a singleton representation -- for them. --+-- @since 0.2+-- data SList :: [k] -> * where SNil :: SList '[] SCons :: SListI xs => SList (x ': xs)@@ -52,6 +54,8 @@ -- The class 'SListI' should have instances that match the -- constructors of 'SList'. --+-- @since 0.2+-- class SListI (xs :: [k]) where -- | Get hold of the explicit singleton (that one can then -- pattern match on).@@ -97,6 +101,9 @@ SCons -> ShapeCons shape -- | The length of a type-level list.+--+-- @since 0.2+-- lengthSList :: forall (xs :: [k]) proxy. SListI xs => proxy xs -> Int lengthSList _ = lengthShape (shape :: Shape xs) where
src/Generics/SOP/TH.hs view
@@ -90,6 +90,8 @@ -- > toTree (SOP (S (Z (I l :* I r :* Nil)))) = Node l r -- > toTree _ = error "unreachable" -- to avoid GHC warnings --+-- @since 0.2+-- deriveGenericFunctions :: Name -> String -> String -> String -> Q [Dec] deriveGenericFunctions n codeName fromName toName = do let codeName' = mkName codeName@@ -120,6 +122,9 @@ -- > (Constructor "Leaf" :* Constructor "Node" :* Nil) -- -- /Note:/ CodeType need to be derived with 'deriveGenericFunctions'.+--+-- @since 0.2+-- deriveMetadataValue :: Name -> String -> String -> Q [Dec] deriveMetadataValue n codeName datatypeInfoName = do let codeName' = mkName codeName