-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Generic Programming using True Sums of Products
--   
--   A library to support the definition of generic functions. Datatypes
--   are viewed in a uniform, structured way: the choice between
--   constructors is represented using an n-ary sum, and the arguments of
--   each constructor are represented using an n-ary product.
--   
--   The module Generics.SOP is the main module of this library and
--   contains more detailed documentation.
--   
--   Since version 0.4.0.0, this package is now based on
--   sop-core. The core package contains all the
--   functionality of n-ary sums and products, whereas this package
--   provides the datatype-generic programming support on top.
--   
--   Examples of using this library are provided by the following packages:
--   
--   
--   
- basic-sop basic examples,
--   
- pretty-sop generic pretty printing,
--   
- lens-sop generically computed lenses,
--   
- json-sop generic JSON conversions.
--   
--   
--   A detailed description of the ideas behind this library is provided by
--   the paper:
--   
--   
--   
- Edsko de Vries and Andres Löh. True Sums of Products.
--   Workshop on Generic Programming (WGP) 2014.
--   
@package generics-sop
@version 0.5.1.4

module Generics.SOP.BasicFunctors

module Generics.SOP.Classes

module Generics.SOP.Constraint

module Generics.SOP.Dict

module Generics.SOP.NP

-- | Metadata about what a datatype looks like
--   
--   In generics-sop, the metadata is completely independent of
--   the main universe. Many generic functions will use this metadata, but
--   other don't, and yet others might need completely different metadata.
--   
--   This module defines a datatype to represent standard metadata, i.e.,
--   names of the datatype, its constructors, and possibly its record
--   selectors. Metadata descriptions are in general GADTs indexed by the
--   code of the datatype they're associated with, so matching on the
--   metadata will reveal information about the shape of the datatype.
module Generics.SOP.Metadata

-- | Metadata for a single constructor.
--   
--   This is indexed by the product structure of the constructor
--   components.
data ConstructorInfo (a :: [Type])
[Constructor] :: forall (a :: [Type]). SListI a => ConstructorName -> ConstructorInfo a
[Infix] :: forall x y. ConstructorName -> Associativity -> Fixity -> ConstructorInfo '[x, y]
[Record] :: forall (a :: [Type]). SListI a => ConstructorName -> NP FieldInfo a -> ConstructorInfo a

-- | The fixity of an infix constructor.
type Fixity = Int

-- | The name of a datatype (or newtype).
datatypeName :: forall (xss :: [[Type]]). DatatypeInfo xss -> DatatypeName

-- | The module name where a datatype is defined.
moduleName :: forall (xss :: [[Type]]). DatatypeInfo xss -> ModuleName

-- | The name of a constructor.
constructorName :: forall (xs :: [Type]). ConstructorInfo xs -> ConstructorName

-- | Metadata for a datatype.
--   
--   A value of type DatatypeInfo c contains the
--   information about a datatype that is not contained in
--   Code c. This information consists primarily of the
--   names of the datatype, its constructors, and possibly its record
--   selectors.
--   
--   The constructor indicates whether the datatype has been declared using
--   newtype or not.
data DatatypeInfo (a :: [[Type]])
[ADT] :: forall (a :: [[Type]]). ModuleName -> DatatypeName -> NP ConstructorInfo a -> POP StrictnessInfo a -> DatatypeInfo a
[Newtype] :: forall x. ModuleName -> DatatypeName -> ConstructorInfo '[x] -> DatatypeInfo '[ '[x]]

-- | The constructor info for a datatype (or newtype).
constructorInfo :: forall (xss :: [[Type]]). DatatypeInfo xss -> NP ConstructorInfo xss

-- | For records, this functor maps the component to its selector name.
data FieldInfo a
[FieldInfo] :: forall a. FieldName -> FieldInfo a

-- | The name of a field.
fieldName :: FieldInfo a -> FieldName

-- | The name of a datatype.
type DatatypeName = String

-- | The name of a module.
type ModuleName = String

-- | The name of a data constructor.
type ConstructorName = String

-- | The name of a field / record selector.
type FieldName = String

-- | Metadata for strictness information of a field.
--   
--   Indexed by the type of the field.
data StrictnessInfo a
[StrictnessInfo] :: forall a. SourceUnpackedness -> SourceStrictness -> DecidedStrictness -> StrictnessInfo a

-- | Datatype to represent the associativity of a constructor
data Associativity
LeftAssociative :: Associativity
RightAssociative :: Associativity
NotAssociative :: Associativity

-- | The strictness that GHC infers for a field during compilation. Whereas
--   there are nine different combinations of SourceUnpackedness and
--   SourceStrictness, the strictness that GHC decides will
--   ultimately be one of lazy, strict, or unpacked. What GHC decides is
--   affected both by what the user writes in the source code and by GHC
--   flags. As an example, consider this data type:
--   
--   
--   data E = ExampleConstructor {-# UNPACK #-} !Int !Int Int
--   
--   
--   
--   
- If compiled without optimization or other language extensions,
--   then the fields of ExampleConstructor will have
--   DecidedStrict, DecidedStrict, and DecidedLazy,
--   respectively.
--   
- If compiled with -XStrictData enabled, then the fields
--   will have DecidedStrict, DecidedStrict, and
--   DecidedStrict, respectively.
--   
- If compiled with -O2 enabled, then the fields will have
--   DecidedUnpack, DecidedStrict, and DecidedLazy,
--   respectively.
--   
data DecidedStrictness
DecidedLazy :: DecidedStrictness
DecidedStrict :: DecidedStrictness
DecidedUnpack :: DecidedStrictness

-- | The strictness of a field as the user wrote it in the source code. For
--   example, in the following data type:
--   
--   
--   data E = ExampleConstructor Int ~Int !Int
--   
--   
--   The fields of ExampleConstructor have
--   NoSourceStrictness, SourceLazy, and SourceStrict,
--   respectively.
data SourceStrictness
NoSourceStrictness :: SourceStrictness
SourceLazy :: SourceStrictness
SourceStrict :: SourceStrictness

-- | The unpackedness of a field as the user wrote it in the source code.
--   For example, in the following data type:
--   
--   
--   data E = ExampleConstructor     Int
--              {-# NOUNPACK #-} Int
--              {-#   UNPACK #-} Int
--   
--   
--   The fields of ExampleConstructor have
--   NoSourceUnpackedness, SourceNoUnpack, and
--   SourceUnpack, respectively.
data SourceUnpackedness
NoSourceUnpackedness :: SourceUnpackedness
SourceNoUnpack :: SourceUnpackedness
SourceUnpack :: SourceUnpackedness
instance Data.SOP.Constraint.All (Data.SOP.Constraint.Compose GHC.Classes.Eq Generics.SOP.Metadata.FieldInfo) xs => GHC.Classes.Eq (Generics.SOP.Metadata.ConstructorInfo xs)
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)
instance GHC.Classes.Eq (Generics.SOP.Metadata.FieldInfo a)
instance GHC.Classes.Eq (Generics.SOP.Metadata.StrictnessInfo a)
instance GHC.Internal.Base.Functor Generics.SOP.Metadata.FieldInfo
instance GHC.Internal.Base.Functor Generics.SOP.Metadata.StrictnessInfo
instance (Data.SOP.Constraint.All (Data.SOP.Constraint.Compose GHC.Classes.Eq Generics.SOP.Metadata.FieldInfo) xs, Data.SOP.Constraint.All (Data.SOP.Constraint.Compose GHC.Classes.Ord Generics.SOP.Metadata.FieldInfo) xs) => GHC.Classes.Ord (Generics.SOP.Metadata.ConstructorInfo xs)
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)
instance GHC.Classes.Ord (Generics.SOP.Metadata.FieldInfo a)
instance GHC.Classes.Ord (Generics.SOP.Metadata.StrictnessInfo a)
instance Data.SOP.Constraint.All (Data.SOP.Constraint.Compose GHC.Internal.Show.Show Generics.SOP.Metadata.FieldInfo) xs => GHC.Internal.Show.Show (Generics.SOP.Metadata.ConstructorInfo xs)
instance (Data.SOP.Constraint.All (Data.SOP.Constraint.Compose GHC.Internal.Show.Show Generics.SOP.Metadata.ConstructorInfo) xs, Data.SOP.Constraint.All (Data.SOP.Constraint.Compose GHC.Internal.Show.Show (Data.SOP.NP.NP Generics.SOP.Metadata.StrictnessInfo)) xs) => GHC.Internal.Show.Show (Generics.SOP.Metadata.DatatypeInfo xs)
instance GHC.Internal.Show.Show (Generics.SOP.Metadata.FieldInfo a)
instance GHC.Internal.Show.Show (Generics.SOP.Metadata.StrictnessInfo a)

module Generics.SOP.NS

module Generics.SOP.Sing

-- | Type-level metadata
--   
--   This module provides datatypes (to be used promoted) that can
--   represent the metadata of Haskell datatypes on the type level.
--   
--   We do not reuse the term-level metadata types, because these are GADTs
--   that incorporate additional invariants. We could (at least in GHC 8)
--   impose the same invariants on the type level as well, but some tests
--   have revealed that the resulting type are rather inconvenient to work
--   with.
--   
--   So we use simple datatypes to represent the type-level metadata, even
--   if this means that some invariants are not explicitly captured.
--   
--   We establish a relation between the term- and type-level versions of
--   the metadata by automatically computing the term-level version from
--   the type-level version.
--   
--   As we now have two versions of metadata (term-level and type-level)
--   with very similar, yet slightly different datatype definitions, the
--   names between the modules clash, and this module is recommended to be
--   imported qualified when needed.
--   
--   The interface exported by this module is still somewhat experimental.
module Generics.SOP.Type.Metadata

-- | Metadata for a single constructors (to be used promoted).
data ConstructorInfo

-- | Normal constructor
Constructor :: ConstructorName -> ConstructorInfo

-- | Infix constructor
Infix :: ConstructorName -> Associativity -> Fixity -> ConstructorInfo

-- | Record constructor
Record :: ConstructorName -> [FieldInfo] -> ConstructorInfo

-- | The fixity of an infix constructor.
type Fixity = Nat

-- | Metadata for a datatype (to be used promoted).
--   
--   A type of kind DatatypeInfo contains meta-information
--   about a datatype that is not contained in its code. This information
--   consists primarily of the names of the datatype, its constructors, and
--   possibly its record selectors.
--   
--   The constructor indicates whether the datatype has been declared using
--   newtype or not.
data DatatypeInfo

-- | Standard algebraic datatype
ADT :: ModuleName -> DatatypeName -> [ConstructorInfo] -> [[StrictnessInfo]] -> DatatypeInfo

-- | Newtype
Newtype :: ModuleName -> DatatypeName -> ConstructorInfo -> DatatypeInfo

-- | Metadata for a single record field (to be used promoted).
data FieldInfo
FieldInfo :: FieldName -> FieldInfo

-- | The name of a datatype.
type DatatypeName = Symbol

-- | The name of a module.
type ModuleName = Symbol

-- | The name of a data constructor.
type ConstructorName = Symbol

-- | The name of a field / record selector.
type FieldName = Symbol

-- | Strictness information for a single field (to be used promoted).
data StrictnessInfo
StrictnessInfo :: SourceUnpackedness -> SourceStrictness -> DecidedStrictness -> StrictnessInfo

-- | Class for computing term-level datatype information from type-level
--   datatype information.
class DemoteDatatypeInfo (x :: DatatypeInfo) (xss :: [[Type]])

-- | Given a proxy of some type-level datatype information, return the
--   corresponding term-level information.
demoteDatatypeInfo :: DemoteDatatypeInfo x xss => proxy x -> DatatypeInfo xss

-- | Class for computing term-level constructor information from type-level
--   constructor information.
class DemoteConstructorInfos (cs :: [ConstructorInfo]) (xss :: [[Type]])

-- | Given a proxy of some type-level constructor information, return the
--   corresponding term-level information as a product.
demoteConstructorInfos :: DemoteConstructorInfos cs xss => proxy cs -> NP ConstructorInfo xss
class DemoteStrictnessInfoss (sss :: [[StrictnessInfo]]) (xss :: [[Type]])
demoteStrictnessInfoss :: DemoteStrictnessInfoss sss xss => proxy sss -> NP (NP StrictnessInfo) xss

-- | Class for computing term-level constructor information from type-level
--   constructor information.
class DemoteConstructorInfo (x :: ConstructorInfo) (xs :: [Type])

-- | Given a proxy of some type-level constructor information, return the
--   corresponding term-level information.
demoteConstructorInfo :: DemoteConstructorInfo x xs => proxy x -> ConstructorInfo xs

-- | Class for computing term-level associativity information from
--   type-level associativity information.
class DemoteAssociativity (a :: Associativity)

-- | Given a proxy of some type-level associativity information, return the
--   corresponding term-level information.
demoteAssociativity :: DemoteAssociativity a => proxy a -> Associativity

-- | Class for computing term-level field information from type-level field
--   information.
class SListI xs => DemoteFieldInfos (fs :: [FieldInfo]) (xs :: [Type])

-- | Given a proxy of some type-level field information, return the
--   corresponding term-level information as a product.
demoteFieldInfos :: DemoteFieldInfos fs xs => proxy fs -> NP FieldInfo xs
class DemoteStrictnessInfos (ss :: [StrictnessInfo]) (xs :: [Type])
demoteStrictnessInfos :: DemoteStrictnessInfos ss xs => proxy ss -> NP StrictnessInfo xs
class DemoteStrictnessInfo (s :: StrictnessInfo) x
demoteStrictnessInfo :: DemoteStrictnessInfo s x => proxy s -> StrictnessInfo x

-- | Class for computing term-level source unpackedness information from
--   type-level source unpackedness information.
class DemoteSourceUnpackedness (a :: SourceUnpackedness)

-- | Given a proxy of some type-level source unpackedness information,
--   return the corresponding term-level information.
demoteSourceUnpackedness :: DemoteSourceUnpackedness a => proxy a -> SourceUnpackedness

-- | Class for computing term-level source strictness information from
--   type-level source strictness information.
class DemoteSourceStrictness (a :: SourceStrictness)

-- | Given a proxy of some type-level source strictness information, return
--   the corresponding term-level information.
demoteSourceStrictness :: DemoteSourceStrictness a => proxy a -> SourceStrictness

-- | Class for computing term-level decided strictness information from
--   type-level decided strictness information.
class DemoteDecidedStrictness (a :: DecidedStrictness)

-- | Given a proxy of some type-level source strictness information, return
--   the corresponding term-level information.
demoteDecidedStrictness :: DemoteDecidedStrictness a => proxy a -> DecidedStrictness

-- | Class for computing term-level field information from type-level field
--   information.
class DemoteFieldInfo (x :: FieldInfo) a

-- | Given a proxy of some type-level field information, return the
--   corresponding term-level information.
demoteFieldInfo :: DemoteFieldInfo x a => proxy x -> FieldInfo a

-- | Datatype to represent the associativity of a constructor
data Associativity
LeftAssociative :: Associativity
RightAssociative :: Associativity
NotAssociative :: Associativity
instance Generics.SOP.Type.Metadata.DemoteAssociativity 'GHC.Internal.Generics.LeftAssociative
instance Generics.SOP.Type.Metadata.DemoteAssociativity 'GHC.Internal.Generics.NotAssociative
instance Generics.SOP.Type.Metadata.DemoteAssociativity 'GHC.Internal.Generics.RightAssociative
instance (GHC.Internal.TypeLits.KnownSymbol s, Data.SOP.Constraint.SListI xs) => Generics.SOP.Type.Metadata.DemoteConstructorInfo ('Generics.SOP.Type.Metadata.Constructor s) xs
instance (GHC.Internal.TypeLits.KnownSymbol s, Generics.SOP.Type.Metadata.DemoteAssociativity a, GHC.Internal.TypeNats.KnownNat f) => Generics.SOP.Type.Metadata.DemoteConstructorInfo ('Generics.SOP.Type.Metadata.Infix s a f) '[y, z]
instance (GHC.Internal.TypeLits.KnownSymbol s, Generics.SOP.Type.Metadata.DemoteFieldInfos fs xs) => Generics.SOP.Type.Metadata.DemoteConstructorInfo ('Generics.SOP.Type.Metadata.Record s fs) xs
instance (Generics.SOP.Type.Metadata.DemoteConstructorInfo c xs, Generics.SOP.Type.Metadata.DemoteConstructorInfos cs xss) => Generics.SOP.Type.Metadata.DemoteConstructorInfos (c : cs) (xs : xss)
instance Generics.SOP.Type.Metadata.DemoteConstructorInfos '[] '[]
instance (GHC.Internal.TypeLits.KnownSymbol m, GHC.Internal.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
instance (GHC.Internal.TypeLits.KnownSymbol m, GHC.Internal.TypeLits.KnownSymbol d, Generics.SOP.Type.Metadata.DemoteConstructorInfo c '[x]) => Generics.SOP.Type.Metadata.DemoteDatatypeInfo ('Generics.SOP.Type.Metadata.Newtype m d c) '[ '[x]]
instance Generics.SOP.Type.Metadata.DemoteDecidedStrictness 'GHC.Internal.Generics.DecidedLazy
instance Generics.SOP.Type.Metadata.DemoteDecidedStrictness 'GHC.Internal.Generics.DecidedStrict
instance Generics.SOP.Type.Metadata.DemoteDecidedStrictness 'GHC.Internal.Generics.DecidedUnpack
instance GHC.Internal.TypeLits.KnownSymbol s => Generics.SOP.Type.Metadata.DemoteFieldInfo ('Generics.SOP.Type.Metadata.FieldInfo s) a
instance (Generics.SOP.Type.Metadata.DemoteFieldInfo f x, Generics.SOP.Type.Metadata.DemoteFieldInfos fs xs) => Generics.SOP.Type.Metadata.DemoteFieldInfos (f : fs) (x : xs)
instance Generics.SOP.Type.Metadata.DemoteFieldInfos '[] '[]
instance Generics.SOP.Type.Metadata.DemoteSourceStrictness 'GHC.Internal.Generics.NoSourceStrictness
instance Generics.SOP.Type.Metadata.DemoteSourceStrictness 'GHC.Internal.Generics.SourceLazy
instance Generics.SOP.Type.Metadata.DemoteSourceStrictness 'GHC.Internal.Generics.SourceStrict
instance Generics.SOP.Type.Metadata.DemoteSourceUnpackedness 'GHC.Internal.Generics.NoSourceUnpackedness
instance Generics.SOP.Type.Metadata.DemoteSourceUnpackedness 'GHC.Internal.Generics.SourceNoUnpack
instance Generics.SOP.Type.Metadata.DemoteSourceUnpackedness 'GHC.Internal.Generics.SourceUnpack
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
instance (Generics.SOP.Type.Metadata.DemoteStrictnessInfo s x, Generics.SOP.Type.Metadata.DemoteStrictnessInfos ss xs) => Generics.SOP.Type.Metadata.DemoteStrictnessInfos (s : ss) (x : xs)
instance Generics.SOP.Type.Metadata.DemoteStrictnessInfos '[] '[]
instance (Generics.SOP.Type.Metadata.DemoteStrictnessInfos ss xs, Generics.SOP.Type.Metadata.DemoteStrictnessInfoss sss xss) => Generics.SOP.Type.Metadata.DemoteStrictnessInfoss (ss : sss) (xs : xss)
instance Generics.SOP.Type.Metadata.DemoteStrictnessInfoss '[] '[]

-- | Derive generics-sop boilerplate instances from GHC's
--   Generic.
--   
--   The technique being used here is described in the following paper:
--   
--   
--   
- José Pedro Magalhães and Andres Löh. Generic Generic
--   Programming. Practical Aspects of Declarative Languages (PADL)
--   2014.
--   
module Generics.SOP.GGP

-- | Compute the SOP code of a datatype.
--   
--   This requires that Rep is defined, which in turn requires that
--   the type has a Generic (from module GHC.Generics)
--   instance.
--   
--   This is the default definition for Code. For more info, see
--   Generic.
type GCode a = ToSumCode Rep a '[] :: [[Type]]

-- | Constraint for the class that computes gfrom.
type GFrom a = GSumFrom Rep a

-- | Constraint for the class that computes gto.
type GTo a = GSumTo Rep a

-- | Constraint for the class that computes gdatatypeInfo.
type GDatatypeInfo a = DemoteDatatypeInfo GDatatypeInfoOf a GCode a

-- | Compute the datatype info of a datatype.
type GDatatypeInfoOf a = ToInfo Rep a

-- | An automatically computed version of from.
--   
--   This requires that the type being converted has a Generic (from
--   module GHC.Generics) instance.
--   
--   This is the default definition for from. For more info, see
--   Generic.
gfrom :: (GFrom a, Generic a) => a -> SOP I (GCode a)

-- | An automatically computed version of to.
--   
--   This requires that the type being converted has a Generic (from
--   module GHC.Generics) instance.
--   
--   This is the default definition for to. For more info, see
--   Generic.
gto :: (GTo a, Generic a) => SOP I (GCode a) -> a

-- | An automatically computed version of datatypeInfo.
--   
--   This requires that the type being converted has a Generic (from
--   module GHC.Generics) instance.
--   
--   This is the default definition for datatypeInfo. For more info,
--   see HasDatatypeInfo.
gdatatypeInfo :: forall proxy a. GDatatypeInfo a => proxy a -> DatatypeInfo (GCode a)
instance (Generics.SOP.GGP.GFieldInfos a, Generics.SOP.GGP.GFieldInfos b) => Generics.SOP.GGP.GFieldInfos (a GHC.Internal.Generics.:*: b)
instance GHC.Internal.Generics.Selector c => Generics.SOP.GGP.GFieldInfos (GHC.Internal.Generics.M1 GHC.Internal.Generics.S c a)
instance Generics.SOP.GGP.GFieldInfos GHC.Internal.Generics.U1
instance (Generics.SOP.GGP.GProductFrom a, Generics.SOP.GGP.GProductFrom b) => Generics.SOP.GGP.GProductFrom (a GHC.Internal.Generics.:*: b)
instance Generics.SOP.GGP.GSingleFrom a => Generics.SOP.GGP.GProductFrom (GHC.Internal.Generics.M1 GHC.Internal.Generics.S c a)
instance Generics.SOP.GGP.GProductFrom GHC.Internal.Generics.U1
instance (Generics.SOP.GGP.GProductTo a, Generics.SOP.GGP.GProductTo b) => Generics.SOP.GGP.GProductTo (a GHC.Internal.Generics.:*: b)
instance Generics.SOP.GGP.GSingleTo a => Generics.SOP.GGP.GProductTo (GHC.Internal.Generics.M1 GHC.Internal.Generics.S c a)
instance Generics.SOP.GGP.GProductTo GHC.Internal.Generics.U1
instance Generics.SOP.GGP.GSingleFrom (GHC.Internal.Generics.K1 i a)
instance Generics.SOP.GGP.GSingleTo (GHC.Internal.Generics.K1 i a)
instance (Generics.SOP.GGP.GSumFrom a, Generics.SOP.GGP.GSumFrom b) => Generics.SOP.GGP.GSumFrom (a GHC.Internal.Generics.:+: b)
instance Generics.SOP.GGP.GSumFrom a => Generics.SOP.GGP.GSumFrom (GHC.Internal.Generics.M1 GHC.Internal.Generics.D c a)
instance Generics.SOP.GGP.GProductFrom a => Generics.SOP.GGP.GSumFrom (GHC.Internal.Generics.M1 GHC.Internal.Generics.C c a)
instance Generics.SOP.GGP.GSumFrom GHC.Internal.Generics.V1
instance (Generics.SOP.GGP.GSumTo a, Generics.SOP.GGP.GSumTo b) => Generics.SOP.GGP.GSumTo (a GHC.Internal.Generics.:+: b)
instance Generics.SOP.GGP.GProductTo a => Generics.SOP.GGP.GSumTo (GHC.Internal.Generics.M1 GHC.Internal.Generics.C c a)
instance Generics.SOP.GGP.GSumTo a => Generics.SOP.GGP.GSumTo (GHC.Internal.Generics.M1 GHC.Internal.Generics.D c a)
instance Generics.SOP.GGP.GSumTo GHC.Internal.Generics.V1

-- | Codes and interpretations
module Generics.SOP.Universe

-- | The (generic) representation of a datatype.
--   
--   A datatype is isomorphic to the sum-of-products of its code. The
--   isomorphism is witnessed by from and to from the
--   Generic class.
type Rep a = SOP I Code a

-- | The class of representable datatypes.
--   
--   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 a datatype are specified using the
--   Code type family.
--   
--   The isomorphism between the original Haskell datatype and its
--   representation is witnessed by the methods of this class, from
--   and to. So for instances of this class, the following laws
--   should (in general) hold:
--   
--   
--   to . from === id :: a -> a
--   from . to === id :: Rep a -> Rep a
--   
--   
--   You typically don't define instances of this class by hand, but rather
--   derive the class instance automatically.
--   
--   Option 1: Derive via the built-in GHC-generics. For this, you
--   need to use the DeriveGeneric extension to first derive an
--   instance of the Generic class from module GHC.Generics.
--   With this, you can then give an empty instance for Generic, and
--   the default definitions will just work. The pattern looks as follows:
--   
--   
--   import qualified GHC.Generics as GHC
--   import Generics.SOP
--   
--   ...
--   
--   data T = ... deriving (GHC.Generic, ...)
--   
--   instance Generic T -- empty
--   instance HasDatatypeInfo T -- empty, if you want/need metadata
--   
--   
--   Option 2: Derive via Template Haskell. For this, you need to
--   enable the TemplateHaskell extension. You can then use
--   deriveGeneric from module Generics.SOP.TH to have the
--   instance generated for you. The pattern looks as follows:
--   
--   
--   import Generics.SOP
--   import Generics.SOP.TH
--   
--   ...
--   
--   data T = ...
--   
--   deriveGeneric ''T -- derives HasDatatypeInfo as well
--   
--   
--   Tradeoffs: Whether to use Option 1 or 2 is mainly a matter of
--   personal taste. The version based on Template Haskell probably has
--   less run-time overhead.
--   
--   Non-standard instances: It is possible to give Generic
--   instances manually that deviate from the standard scheme, as long as
--   at least
--   
--   
--   to . from === id :: a -> a
--   
--   
--   still holds.
class All SListI :: [Type] -> Constraint Code a => Generic a where {
    
    -- | The code of a datatype.
    --   
    --   This is a list of lists of its components. The outer list contains one
    --   element per constructor. The inner list contains one element per
    --   constructor argument (field).
    --   
    --   <i>Example:</i> The datatype
    --   
    --   <pre>
    --   data Tree = Leaf Int | Node Tree Tree
    --   </pre>
    --   
    --   is supposed to have the following code:
    --   
    --   <pre>
    --   type instance Code (Tree a) =
    --     '[ '[ Int ]
    --      , '[ Tree, Tree ]
    --      ]
    --   </pre>
    type Code a :: [[Type]];
    type Code a = GCode a;
}

-- | Converts from a value to its structural representation.
from :: Generic a => a -> Rep a
($dmfrom) :: (Generic a, GFrom a, Generic a, Rep a ~ SOP I (GCode a)) => a -> Rep a

-- | Converts from a structural representation back to the original value.
to :: Generic a => Rep a -> a
($dmto) :: (Generic a, GTo a, Generic a, Rep a ~ SOP I (GCode a)) => Rep a -> a

-- | A class of datatypes that have associated metadata.
--   
--   It is possible to use the sum-of-products approach to generic
--   programming without metadata. If you need metadata in a function, an
--   additional constraint on this class is in order.
--   
--   You typically don't define instances of this class by hand, but rather
--   derive the class instance automatically. See the documentation of
--   Generic for the options.
class Generic a => HasDatatypeInfo a where {
    
    -- | Type-level datatype info
    type DatatypeInfoOf a :: DatatypeInfo;
    type DatatypeInfoOf a = GDatatypeInfoOf a;
}

-- | Term-level datatype info; by default, the term-level datatype info is
--   produced from the type-level info.
datatypeInfo :: HasDatatypeInfo a => proxy a -> DatatypeInfo (Code a)
($dmdatatypeInfo) :: (HasDatatypeInfo a, GDatatypeInfo a, GCode a ~ Code a) => proxy a -> DatatypeInfo (Code a)

-- | Constraint that captures that a datatype is a product type, i.e., a
--   type with a single constructor.
--   
--   It also gives access to the code for the arguments of that
--   constructor.
type IsProductType a (xs :: [Type]) = (Generic a, Code a ~ '[xs])

-- | Direct access to the part of the code that is relevant for a product
--   type.
type ProductCode a = Head Code a

-- | Convert from a product type to its product representation.
productTypeFrom :: forall a (xs :: [Type]). IsProductType a xs => a -> NP I xs

-- | Convert a product representation to the original type.
productTypeTo :: forall a (xs :: [Type]). IsProductType a xs => NP I xs -> a

-- | Constraint that captures that a datatype is an enumeration type, i.e.,
--   none of the constructors have any arguments.
type IsEnumType a = (Generic a, All [Type] ~ '[] :: [Type] Code a)

-- | Convert from an enum type to its sum representation.
enumTypeFrom :: IsEnumType a => a -> NS (K () :: [Type] -> Type) (Code a)

-- | Convert a sum representation to ihe original type.
enumTypeTo :: IsEnumType a => NS (K () :: [Type] -> Type) (Code a) -> a

-- | Constraint that captures that a datatype is a single-constructor,
--   single-field datatype. This always holds for newtype-defined types,
--   but it can also be true for data-defined types.
--   
--   The constraint also gives access to the type that is wrapped.
type IsWrappedType a x = (Generic a, Code a ~ '[ '[x]])

-- | Direct access to the part of the code that is relevant for wrapped
--   types and newtypes.
type WrappedCode a = Head Head Code a

-- | Convert from a wrapped type to its inner type.
wrappedTypeFrom :: IsWrappedType a x => a -> x

-- | Convert a type to a wrapped type.
wrappedTypeTo :: IsWrappedType a x => x -> a

-- | Constraint that captures that a datatype is a newtype. This makes use
--   of the fact that newtypes are always coercible to the type they wrap,
--   whereas datatypes are not.
type IsNewtype a x = (IsWrappedType a x, Coercible a x)

-- | Convert a newtype to its inner type.
--   
--   This is a specialised synonym for coerce.
newtypeFrom :: IsNewtype a x => a -> x

-- | Convert a type to a newtype.
--   
--   This is a specialised synonym for coerce.
newtypeTo :: IsNewtype a x => x -> a

-- | Generate generics-sop boilerplate instances using Template
--   Haskell.
module Generics.SOP.TH

-- | Generate generics-sop boilerplate for the given datatype.
--   
--   This function takes the name of a datatype and generates:
--   
--   
--   
- a Code instance
--   
- a Generic instance
--   
- a HasDatatypeInfo instance
--   
--   
--   Note that the generated code will require the TypeFamilies
--   and DataKinds extensions to be enabled for the module.
--   
--   Example: If you have the datatype
--   
--   
--   data Tree = Leaf Int | Node Tree Tree
--   
--   
--   and say
--   
--   
--   deriveGeneric ''Tree
--   
--   
--   then you get code that is equivalent to:
--   
--   
--   instance Generic Tree where
--   
--     type Code Tree = '[ '[Int], '[Tree, Tree] ]
--   
--     from (Leaf x)   = SOP (   Z (I x :* Nil))
--     from (Node l r) = SOP (S (Z (I l :* I r :* Nil)))
--   
--     to (SOP    (Z (I x :* Nil)))         = Leaf x
--     to (SOP (S (Z (I l :* I r :* Nil)))) = Node l r
--     to (SOP (S (S x)))                   = x `seq` error "inaccessible"
--   
--   instance HasDatatypeInfo Tree where
--     type DatatypeInfoOf Tree =
--       T.ADT "Main" "Tree"
--         '[ T.Constructor "Leaf", T.Constructor "Node" ]
--   
--     datatypeInfo _ =
--       T.demoteDatatypeInfo (Proxy :: Proxy (DatatypeInfoOf Tree))
--   
--   
--   Limitations: Generation does not work for GADTs, for datatypes
--   that involve existential quantification, for datatypes with unboxed
--   fields.
deriveGeneric :: Name -> Q [Dec]

-- | Like deriveGeneric, but omit the HasDatatypeInfo
--   instance.
deriveGenericOnly :: Name -> Q [Dec]

-- | Variant of deriveGeneric that allows to restrict the type
--   parameters.
--   
--   Experimental function, exposed primarily for benchmarking.
deriveGenericSubst :: Name -> (Name -> Q Type) -> Q [Dec]

-- | Variant of deriveGenericOnly that allows to restrict the type
--   parameters.
--   
--   Experimental function, exposed primarily for benchmarking.
deriveGenericOnlySubst :: Name -> (Name -> Q Type) -> Q [Dec]

-- | Like deriveGenericOnly, but don't derive class instance, only
--   functions.
--   
--   Example: If you say
--   
--   
--   deriveGenericFunctions ''Tree "TreeCode" "fromTree" "toTree"
--   
--   
--   then you get code that is equivalent to:
--   
--   
--   type TreeCode = '[ '[Int], '[Tree, Tree] ]
--   
--   fromTree :: Tree -> SOP I TreeCode
--   fromTree (Leaf x)   = SOP (   Z (I x :* Nil))
--   fromTree (Node l r) = SOP (S (Z (I l :* I r :* Nil)))
--   
--   toTree :: SOP I TreeCode -> Tree
--   toTree (SOP    (Z (I x :* Nil)))         = Leaf x
--   toTree (SOP (S (Z (I l :* I r :* Nil)))) = Node l r
--   toTree (SOP (S (S x)))                   = x `seq` error "inaccessible"
--   
deriveGenericFunctions :: Name -> String -> String -> String -> Q [Dec]

-- | Derive DatatypeInfo value for the type.
--   
--   Example: If you say
--   
--   
--   deriveMetadataValue ''Tree "TreeCode" "treeDatatypeInfo"
--   
--   
--   then you get code that is equivalent to:
--   
--   
--   treeDatatypeInfo :: DatatypeInfo TreeCode
--   treeDatatypeInfo = ADT "Main" "Tree"
--       (Constructor "Leaf" :* Constructor "Node" :* Nil)
--   
--   
--   Note: CodeType needs to be derived with
--   deriveGenericFunctions.

-- | Deprecated: Use deriveMetadataType and
--   demoteDatatypeInfo instead.
deriveMetadataValue :: Name -> String -> String -> Q [Dec]

-- | Derive DatatypeInfo type for the type.
--   
--   Example: If you say
--   
--   
--   deriveMetadataType ''Tree "TreeDatatypeInfo"
--   
--   
--   then you get code that is equivalent to:
--   
--   
--   type TreeDatatypeInfo =
--     T.ADT "Main" "Tree"
--       [ T.Constructor "Leaf", T.Constructor "Node" ]
--   
deriveMetadataType :: Name -> String -> Q [Dec]

-- | Instances for Generic and HasMetadata.
--   
--   We define instances for datatypes from generics-sop and
--   base that are supported.
--   
--   (There are only instances defined in this module, so the documentation
--   is empty.)
module Generics.SOP.Instances
instance Generics.SOP.Universe.Generic ((Data.SOP.Classes.-.->) f g a)
instance Generics.SOP.Universe.Generic ((GHC.Internal.Generics.:*:) f g p)
instance Generics.SOP.Universe.Generic ((GHC.Internal.Generics.:+:) f g p)
instance Generics.SOP.Universe.Generic ((Data.SOP.BasicFunctors.:.:) f g p)
instance Generics.SOP.Universe.Generic ((GHC.Internal.Generics.:.:) f g p)
instance Generics.SOP.Universe.Generic GHC.Internal.Data.Semigroup.Internal.All
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Exception.AllocationLimitExceeded
instance Generics.SOP.Universe.Generic (GHC.Internal.Data.Semigroup.Internal.Alt f a)
instance Generics.SOP.Universe.Generic GHC.Internal.Data.Semigroup.Internal.Any
instance Generics.SOP.Universe.Generic (Data.Semigroup.Arg a b)
instance Generics.SOP.Universe.Generic (System.Console.GetOpt.ArgDescr a)
instance Generics.SOP.Universe.Generic (System.Console.GetOpt.ArgOrder a)
instance Generics.SOP.Universe.Generic GHC.Internal.Exception.Type.ArithException
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Exception.ArrayException
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Exception.AssertionFailed
instance Generics.SOP.Universe.Generic GHC.Internal.Generics.Associativity
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Exception.AsyncException
instance Generics.SOP.Universe.Generic GHC.Internal.Conc.Sync.BlockReason
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Exception.BlockedIndefinitelyOnMVar
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Exception.BlockedIndefinitelyOnSTM
instance Generics.SOP.Universe.Generic GHC.Types.Bool
instance Generics.SOP.Universe.Generic (GHC.Internal.IO.Buffer.Buffer e)
instance Generics.SOP.Universe.Generic (GHC.Internal.IO.Encoding.Types.BufferCodec from to state)
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Handle.Types.BufferMode
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Buffer.BufferState
instance Generics.SOP.Universe.Generic GHC.Internal.ByteOrder.ByteOrder
instance Generics.SOP.Universe.Generic GHC.Internal.Generics.C
instance Generics.SOP.Universe.Generic GHC.Internal.RTS.Flags.CCFlags
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CChar
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CClock
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CDouble
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CFloat
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CInt
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CIntMax
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CIntPtr
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CLLong
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CLong
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CPtrdiff
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CSChar
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CSUSeconds
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CShort
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CSigAtomic
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CSize
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CTime
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CUChar
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CUInt
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CUIntMax
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CUIntPtr
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CULLong
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CULong
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CUSeconds
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CUShort
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Types.CWchar
instance Generics.SOP.Universe.Generic GHC.Internal.Stack.Types.CallStack
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Encoding.Failure.CodingFailureMode
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Encoding.Types.CodingProgress
instance Generics.SOP.Universe.Generic (Data.Complex.Complex a)
instance Generics.SOP.Universe.Generic (Data.Functor.Compose.Compose f g a)
instance Generics.SOP.Universe.Generic GHC.Internal.RTS.Flags.ConcFlags
instance Generics.SOP.Universe.Generic (GHC.Internal.Data.Functor.Const.Const a b)
instance Generics.SOP.Universe.Generic GHC.Internal.Data.Data.ConstrRep
instance Generics.SOP.Universe.Generic GHC.Internal.Generics.D
instance Generics.SOP.Universe.Generic GHC.Internal.Data.Data.DataRep
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Exception.Deadlock
instance Generics.SOP.Universe.Generic GHC.Internal.RTS.Flags.DebugFlags
instance Generics.SOP.Universe.Generic GHC.Internal.Generics.DecidedStrictness
instance Generics.SOP.Universe.Generic GHC.Internal.RTS.Flags.DoCostCentres
instance Generics.SOP.Universe.Generic GHC.Internal.RTS.Flags.DoHeapProfile
instance Generics.SOP.Universe.Generic GHC.Internal.RTS.Flags.DoTrace
instance Generics.SOP.Universe.Generic (GHC.Internal.Data.Ord.Down a)
instance Generics.SOP.Universe.Generic (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Generics.SOP.Universe.Generic Data.Fixed.E0
instance Generics.SOP.Universe.Generic Data.Fixed.E1
instance Generics.SOP.Universe.Generic Data.Fixed.E12
instance Generics.SOP.Universe.Generic Data.Fixed.E2
instance Generics.SOP.Universe.Generic Data.Fixed.E3
instance Generics.SOP.Universe.Generic Data.Fixed.E6
instance Generics.SOP.Universe.Generic Data.Fixed.E9
instance Generics.SOP.Universe.Generic (GHC.Internal.Data.Either.Either a b)
instance Generics.SOP.Universe.Generic (GHC.Internal.Data.Semigroup.Internal.Endo a)
instance Generics.SOP.Universe.Generic GHC.Internal.Foreign.C.Error.Errno
instance Generics.SOP.Universe.Generic GHC.Internal.Exception.ErrorCall
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Exception.ExitCode
instance Generics.SOP.Universe.Generic GHC.Internal.Float.FFFormat
instance Generics.SOP.Universe.Generic Text.Printf.FieldFormat
instance Generics.SOP.Universe.Generic GHC.Internal.Fingerprint.Type.Fingerprint
instance Generics.SOP.Universe.Generic (GHC.Internal.Data.Monoid.First a)
instance Generics.SOP.Universe.Generic (Data.Semigroup.First a)
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Exception.FixIOException
instance Generics.SOP.Universe.Generic (Data.Fixed.Fixed a)
instance Generics.SOP.Universe.Generic GHC.Internal.Data.Data.Fixity
instance Generics.SOP.Universe.Generic GHC.Internal.Generics.Fixity
instance Generics.SOP.Universe.Generic Text.Printf.FormatAdjustment
instance Generics.SOP.Universe.Generic Text.Printf.FormatParse
instance Generics.SOP.Universe.Generic Text.Printf.FormatSign
instance Generics.SOP.Universe.Generic GHC.Internal.Stats.GCDetails
instance Generics.SOP.Universe.Generic GHC.Internal.RTS.Flags.GCFlags
instance Generics.SOP.Universe.Generic GHC.Internal.Unicode.GeneralCategory
instance Generics.SOP.Universe.Generic GHC.Internal.RTS.Flags.GiveGCStats
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Handle.HandlePosn
instance Generics.SOP.Universe.Generic (Data.SOP.BasicFunctors.I a)
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Device.IODeviceType
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Exception.IOErrorType
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Exception.IOException
instance Generics.SOP.Universe.Generic GHC.Internal.IO.IOMode.IOMode
instance Generics.SOP.Universe.Generic (GHC.Internal.Data.Functor.Identity.Identity a)
instance Generics.SOP.Universe.Generic (Data.SOP.BasicFunctors.K a b)
instance Generics.SOP.Universe.Generic (GHC.Internal.Generics.K1 i c p)
instance Generics.SOP.Universe.Generic (GHC.Internal.Data.Monoid.Last a)
instance Generics.SOP.Universe.Generic (Data.Semigroup.Last a)
instance Generics.SOP.Universe.Generic GHC.Internal.Text.Read.Lex.Lexeme
instance Generics.SOP.Universe.Generic [a]
instance Generics.SOP.Universe.Generic GHC.Internal.ExecutionStack.Internal.Location
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Handle.Lock.Common.LockMode
instance Generics.SOP.Universe.Generic (GHC.Internal.Generics.M1 i c f p)
instance Generics.SOP.Universe.Generic GHC.Internal.IO.MaskingState
instance Generics.SOP.Universe.Generic (Data.Semigroup.Max a)
instance Generics.SOP.Universe.Generic (GHC.Internal.Maybe.Maybe a)
instance Generics.SOP.Universe.Generic (Data.Semigroup.Min a)
instance Generics.SOP.Universe.Generic GHC.Internal.RTS.Flags.MiscFlags
instance Generics.SOP.Universe.Generic GHC.Internal.Control.Exception.Base.NestedAtomically
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Handle.Types.Newline
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Handle.Types.NewlineMode
instance Generics.SOP.Universe.Generic GHC.Internal.Control.Exception.Base.NoMethodError
instance Generics.SOP.Universe.Generic (GHC.Internal.Base.NonEmpty a)
instance Generics.SOP.Universe.Generic GHC.Internal.Control.Exception.Base.NonTermination
instance Generics.SOP.Universe.Generic GHC.Internal.Text.Read.Lex.Number
instance Generics.SOP.Universe.Generic (System.Console.GetOpt.OptDescr a)
instance Generics.SOP.Universe.Generic GHC.Types.Ordering
instance Generics.SOP.Universe.Generic (GHC.Internal.Generics.Par1 p)
instance Generics.SOP.Universe.Generic GHC.Internal.RTS.Flags.ParFlags
instance Generics.SOP.Universe.Generic GHC.Internal.Control.Exception.Base.PatternMatchFail
instance Generics.SOP.Universe.Generic (Data.Functor.Product.Product f g a)
instance Generics.SOP.Universe.Generic (GHC.Internal.Data.Semigroup.Internal.Product a)
instance Generics.SOP.Universe.Generic GHC.Internal.RTS.Flags.ProfFlags
instance Generics.SOP.Universe.Generic (GHC.Internal.Data.Proxy.Proxy t)
instance Generics.SOP.Universe.Generic GHC.Internal.Generics.R
instance Generics.SOP.Universe.Generic GHC.Internal.RTS.Flags.RTSFlags
instance Generics.SOP.Universe.Generic GHC.Internal.Stats.RTSStats
instance Generics.SOP.Universe.Generic GHC.Internal.Control.Exception.Base.RecConError
instance Generics.SOP.Universe.Generic GHC.Internal.Control.Exception.Base.RecSelError
instance Generics.SOP.Universe.Generic GHC.Internal.Control.Exception.Base.RecUpdError
instance Generics.SOP.Universe.Generic GHC.Types.RuntimeRep
instance Generics.SOP.Universe.Generic GHC.Internal.Generics.S
instance Generics.SOP.Universe.Generic GHC.Internal.IO.Device.SeekMode
instance Generics.SOP.Universe.Generic GHC.Internal.Generics.SourceStrictness
instance Generics.SOP.Universe.Generic GHC.Internal.Generics.SourceUnpackedness
instance Generics.SOP.Universe.Generic GHC.Internal.ExecutionStack.Internal.SrcLoc
instance Generics.SOP.Universe.Generic GHC.Internal.Stack.Types.SrcLoc
instance Generics.SOP.Universe.Generic GHC.Internal.StaticPtr.StaticPtrInfo
instance Generics.SOP.Universe.Generic (Data.Functor.Sum.Sum f g a)
instance Generics.SOP.Universe.Generic (GHC.Internal.Data.Semigroup.Internal.Sum a)
instance Generics.SOP.Universe.Generic GHC.Internal.Conc.Sync.ThreadStatus
instance Generics.SOP.Universe.Generic GHC.Internal.RTS.Flags.TickyFlags
instance Generics.SOP.Universe.Generic GHC.Internal.RTS.Flags.TraceFlags
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j, k)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j, k, l)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j, k, l, m)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s)
instance Generics.SOP.Universe.Generic (a, b)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, t26)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, t26, t27)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, t26, t27, t28)
instance Generics.SOP.Universe.Generic (a, b, c)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, t26, t27, t28, t29)
instance Generics.SOP.Universe.Generic (a, b, c, d)
instance Generics.SOP.Universe.Generic (a, b, c, d, e)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h)
instance Generics.SOP.Universe.Generic (a, b, c, d, e, f, g, h, i)
instance Generics.SOP.Universe.Generic GHC.Internal.Control.Exception.Base.TypeError
instance Generics.SOP.Universe.Generic (GHC.Internal.Generics.U1 p)
instance Generics.SOP.Universe.Generic ()
instance Generics.SOP.Universe.Generic (GHC.Internal.Generics.V1 p)
instance Generics.SOP.Universe.Generic GHC.Types.VecCount
instance Generics.SOP.Universe.Generic GHC.Types.VecElem
instance Generics.SOP.Universe.Generic GHC.Internal.Data.Version.Version
instance Generics.SOP.Universe.Generic GHC.Internal.Base.Void
instance Generics.SOP.Universe.Generic (Data.Semigroup.WrappedMonoid m)
instance Generics.SOP.Universe.HasDatatypeInfo ((Data.SOP.Classes.-.->) f g a)
instance Generics.SOP.Universe.HasDatatypeInfo ((GHC.Internal.Generics.:*:) f g p)
instance Generics.SOP.Universe.HasDatatypeInfo ((GHC.Internal.Generics.:+:) f g p)
instance Generics.SOP.Universe.HasDatatypeInfo ((Data.SOP.BasicFunctors.:.:) f g p)
instance Generics.SOP.Universe.HasDatatypeInfo ((GHC.Internal.Generics.:.:) f g p)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Data.Semigroup.Internal.All
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Exception.AllocationLimitExceeded
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.Data.Semigroup.Internal.Alt f a)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Data.Semigroup.Internal.Any
instance Generics.SOP.Universe.HasDatatypeInfo (Data.Semigroup.Arg a b)
instance Generics.SOP.Universe.HasDatatypeInfo (System.Console.GetOpt.ArgDescr a)
instance Generics.SOP.Universe.HasDatatypeInfo (System.Console.GetOpt.ArgOrder a)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Exception.Type.ArithException
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Exception.ArrayException
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Exception.AssertionFailed
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Generics.Associativity
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Exception.AsyncException
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Conc.Sync.BlockReason
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Exception.BlockedIndefinitelyOnMVar
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Exception.BlockedIndefinitelyOnSTM
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Types.Bool
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.IO.Buffer.Buffer e)
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.IO.Encoding.Types.BufferCodec from to state)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Handle.Types.BufferMode
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Buffer.BufferState
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.ByteOrder.ByteOrder
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Generics.C
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.RTS.Flags.CCFlags
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CChar
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CClock
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CDouble
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CFloat
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CInt
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CIntMax
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CIntPtr
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CLLong
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CLong
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CPtrdiff
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CSChar
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CSUSeconds
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CShort
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CSigAtomic
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CSize
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CTime
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CUChar
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CUInt
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CUIntMax
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CUIntPtr
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CULLong
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CULong
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CUSeconds
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CUShort
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Types.CWchar
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Stack.Types.CallStack
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Encoding.Failure.CodingFailureMode
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Encoding.Types.CodingProgress
instance Generics.SOP.Universe.HasDatatypeInfo (Data.Complex.Complex a)
instance Generics.SOP.Universe.HasDatatypeInfo (Data.Functor.Compose.Compose f g a)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.RTS.Flags.ConcFlags
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.Data.Functor.Const.Const a b)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Data.Data.ConstrRep
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Generics.D
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Data.Data.DataRep
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Exception.Deadlock
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.RTS.Flags.DebugFlags
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Generics.DecidedStrictness
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.RTS.Flags.DoCostCentres
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.RTS.Flags.DoHeapProfile
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.RTS.Flags.DoTrace
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.Data.Ord.Down a)
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Generics.SOP.Universe.HasDatatypeInfo Data.Fixed.E0
instance Generics.SOP.Universe.HasDatatypeInfo Data.Fixed.E1
instance Generics.SOP.Universe.HasDatatypeInfo Data.Fixed.E12
instance Generics.SOP.Universe.HasDatatypeInfo Data.Fixed.E2
instance Generics.SOP.Universe.HasDatatypeInfo Data.Fixed.E3
instance Generics.SOP.Universe.HasDatatypeInfo Data.Fixed.E6
instance Generics.SOP.Universe.HasDatatypeInfo Data.Fixed.E9
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.Data.Either.Either a b)
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.Data.Semigroup.Internal.Endo a)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Foreign.C.Error.Errno
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Exception.ErrorCall
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Exception.ExitCode
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Float.FFFormat
instance Generics.SOP.Universe.HasDatatypeInfo Text.Printf.FieldFormat
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Fingerprint.Type.Fingerprint
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.Data.Monoid.First a)
instance Generics.SOP.Universe.HasDatatypeInfo (Data.Semigroup.First a)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Exception.FixIOException
instance Generics.SOP.Universe.HasDatatypeInfo (Data.Fixed.Fixed a)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Data.Data.Fixity
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Generics.Fixity
instance Generics.SOP.Universe.HasDatatypeInfo Text.Printf.FormatAdjustment
instance Generics.SOP.Universe.HasDatatypeInfo Text.Printf.FormatParse
instance Generics.SOP.Universe.HasDatatypeInfo Text.Printf.FormatSign
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Stats.GCDetails
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.RTS.Flags.GCFlags
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Unicode.GeneralCategory
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.RTS.Flags.GiveGCStats
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Handle.HandlePosn
instance Generics.SOP.Universe.HasDatatypeInfo (Data.SOP.BasicFunctors.I a)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Device.IODeviceType
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Exception.IOErrorType
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Exception.IOException
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.IOMode.IOMode
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.Data.Functor.Identity.Identity a)
instance Generics.SOP.Universe.HasDatatypeInfo (Data.SOP.BasicFunctors.K a b)
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.Generics.K1 i c p)
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.Data.Monoid.Last a)
instance Generics.SOP.Universe.HasDatatypeInfo (Data.Semigroup.Last a)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Text.Read.Lex.Lexeme
instance Generics.SOP.Universe.HasDatatypeInfo [a]
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.ExecutionStack.Internal.Location
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Handle.Lock.Common.LockMode
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.Generics.M1 i c f p)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.MaskingState
instance Generics.SOP.Universe.HasDatatypeInfo (Data.Semigroup.Max a)
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.Maybe.Maybe a)
instance Generics.SOP.Universe.HasDatatypeInfo (Data.Semigroup.Min a)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.RTS.Flags.MiscFlags
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Control.Exception.Base.NestedAtomically
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Handle.Types.Newline
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Handle.Types.NewlineMode
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Control.Exception.Base.NoMethodError
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.Base.NonEmpty a)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Control.Exception.Base.NonTermination
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Text.Read.Lex.Number
instance Generics.SOP.Universe.HasDatatypeInfo (System.Console.GetOpt.OptDescr a)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Types.Ordering
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.Generics.Par1 p)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.RTS.Flags.ParFlags
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Control.Exception.Base.PatternMatchFail
instance Generics.SOP.Universe.HasDatatypeInfo (Data.Functor.Product.Product f g a)
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.Data.Semigroup.Internal.Product a)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.RTS.Flags.ProfFlags
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.Data.Proxy.Proxy t)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Generics.R
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.RTS.Flags.RTSFlags
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Stats.RTSStats
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Control.Exception.Base.RecConError
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Control.Exception.Base.RecSelError
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Control.Exception.Base.RecUpdError
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Types.RuntimeRep
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Generics.S
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.IO.Device.SeekMode
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Generics.SourceStrictness
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Generics.SourceUnpackedness
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.ExecutionStack.Internal.SrcLoc
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Stack.Types.SrcLoc
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.StaticPtr.StaticPtrInfo
instance Generics.SOP.Universe.HasDatatypeInfo (Data.Functor.Sum.Sum f g a)
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.Data.Semigroup.Internal.Sum a)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Conc.Sync.ThreadStatus
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.RTS.Flags.TickyFlags
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.RTS.Flags.TraceFlags
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j, k)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j, k, l)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j, k, l, m)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j, k, l, m, n)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, t26)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, t26, t27)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, t26, t27, t28)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, t26, t27, t28, t29)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h)
instance Generics.SOP.Universe.HasDatatypeInfo (a, b, c, d, e, f, g, h, i)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Control.Exception.Base.TypeError
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.Generics.U1 p)
instance Generics.SOP.Universe.HasDatatypeInfo ()
instance Generics.SOP.Universe.HasDatatypeInfo (GHC.Internal.Generics.V1 p)
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Types.VecCount
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Types.VecElem
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Data.Version.Version
instance Generics.SOP.Universe.HasDatatypeInfo GHC.Internal.Base.Void
instance Generics.SOP.Universe.HasDatatypeInfo (Data.Semigroup.WrappedMonoid m)

-- | Main module of generics-sop
--   
--   In most cases, you will probably want to import just this module, and
--   possibly Generics.SOP.TH if you want to use Template Haskell to
--   generate Generic instances for you.
--   
--   
Generic programming with sums of products
--   
--   You need this library if you want to define your own generic functions
--   in the sum-of-products SOP style. Generic programming in the SOP style
--   follows the following idea:
--   
--   
--   
- A large class of datatypes can be viewed in a uniform, structured
--   way: the choice between constructors is represented using an n-ary sum
--   (called NS), and the arguments of each constructor are
--   represented using an n-ary product (called NP).
--   
- The library captures the notion of a datatype being representable
--   in the following way. There is a class Generic, which for a
--   given datatype A, associates the isomorphic SOP
--   representation with the original type under the name Rep
--   A. The class also provides functions from and to
--   that convert between A and Rep A and witness
--   the isomorphism.
--   
- Since all Rep types are sums of products, you can define
--   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.
--   
- By combining the conversion functions from and to
--   with the function that works on Rep types, we obtain a function
--   that works on all types that are in the Generic class.
--   
- Most types can very easily be made an instance of Generic.
--   For example, if the datatype can be represented using GHC's built-in
--   approach to generic programming and has an instance for the
--   Generic class from module GHC.Generics, then an instance
--   of the SOP Generic can automatically be derived. There is also
--   Template Haskell code in Generics.SOP.TH that allows to
--   auto-generate an instance of Generic for most types.
--   
--   
--   
Example
--   
--   
Instantiating a datatype for use with SOP generics
--   
--   Let's assume we have the datatypes:
--   
--   
--   data A   = C Bool | D A Int | E (B ())
--   data B a = F | G a Char Bool
--   
--   
--   To create Generic instances for A and B via
--   GHC.Generics, we say
--   
--   
--   {-# LANGUAGE DeriveGeneric #-}
--   
--   import qualified GHC.Generics as GHC
--   import Generics.SOP
--   
--   data A   = C Bool | D A Int | E (B ())
--     deriving (Show, GHC.Generic)
--   data B a = F | G a Char Bool
--     deriving (Show, GHC.Generic)
--   
--   instance Generic A     -- empty
--   instance Generic (B a) -- empty
--   
--   
--   Now we can convert between A and Rep A (and
--   between B and Rep B). For example,
--   
--   
--   >>> from (D (C True) 3) :: Rep A
--   SOP (S (Z (I (C True) :* I 3 :* Nil)))
--   
--   >>> to it :: A
--   D (C True) 3
--   
--   
--   Note that the transformation is shallow: In D (C True) 3, the
--   inner value C True of type A is not affected by the
--   transformation.
--   
--   For more details about Rep A, have a look at the
--   Generics.SOP.Universe module.
--   
--   
Defining a generic function
--   
--   As an example of a generic function, let us define a generic version
--   of rnf from the deepseq package.
--   
--   The type of rnf is
--   
--   
--   NFData a => a -> ()
--   
--   
--   and the idea is that for a term x of type a in the
--   NFData class, rnf x forces complete evaluation of
--   x (i.e., evaluation to normal form), and returns
--   ().
--   
--   We call the generic version of this function grnf. A direct
--   definition in SOP style, making use of structural recursion on the
--   sums and products, looks as follows:
--   
--   
--   grnf :: (Generic a, All2 NFData (Code a)) => a -> ()
--   grnf x = grnfS (from x)
--   
--   grnfS :: (All2 NFData xss) => SOP I xss -> ()
--   grnfS (SOP (Z xs))  = grnfP xs
--   grnfS (SOP (S xss)) = grnfS (SOP xss)
--   
--   grnfP :: (All NFData xs) => NP I xs -> ()
--   grnfP Nil         = ()
--   grnfP (I x :* xs) = x `deepseq` (grnfP xs)
--   
--   
--   The grnf function performs the conversion between a
--   and Rep a by applying from and then applies
--   grnfS. The type of grnf indicates that a
--   must be in the Generic class so that we can apply from,
--   and that all the components of a (i.e., all the types that
--   occur as constructor arguments) must be in the NFData class
--   (All2).
--   
--   The function grnfS traverses the outer sum structure of the
--   sum of products (note that Rep a = SOP I
--   (Code a)). It encodes which constructor was used to
--   construct the original argument of type a. Once we've found
--   the constructor in question (Z), we traverse the arguments of
--   that constructor using grnfP.
--   
--   The function grnfP traverses the product structure of the
--   constructor arguments. Each argument is evaluated using the
--   deepseq function from the NFData class. This requires
--   that all components of the product must be in the NFData
--   class (All) and triggers the corresponding constraints on the
--   other functions. Once the end of the product is reached (Nil),
--   we return ().
--   
--   
Defining a generic function using combinators
--   
--   In many cases, generic functions can be written in a much more concise
--   way by avoiding the explicit structural recursion and resorting to the
--   powerful combinators provided by this library instead.
--   
--   For example, the grnf function can also be defined as a
--   one-liner as follows:
--   
--   
--   grnf :: (Generic a, All2 NFData (Code a)) => a -> ()
--   grnf = rnf . hcollapse . hcmap (Proxy :: Proxy NFData) (mapIK rnf) . from
--   
--   
--   mapIK and friends (mapII, mapKI, etc.) are small
--   helpers for working with I and K functors, for example
--   mapIK is defined as mapIK f = \ (I x) ->
--   K (f x)
--   
--   The following interaction should provide an idea of the individual
--   transformation steps:
--   
--   
--   >>> let x = G 2.5 'A' False :: B Double
--   
--   >>> from x
--   SOP (S (Z (I 2.5 :* I 'A' :* I False :* Nil)))
--   
--   >>> hcmap (Proxy :: Proxy NFData) (mapIK rnf) it
--   SOP (S (Z (K () :* K () :* K () :* Nil)))
--   
--   >>> hcollapse it
--   [(),(),()]
--   
--   >>> rnf it
--   ()
--   
--   
--   The from call converts into the structural representation. Via
--   hcmap, we apply rnf to all the components. The result
--   is a sum of products of the same shape, but the components are no
--   longer heterogeneous (I), but homogeneous (K
--   ()). A homogeneous structure can be collapsed (hcollapse)
--   into a normal Haskell list. Finally, rnf actually forces
--   evaluation of this list (and thereby actually drives the evaluation of
--   all the previous steps) and produces the final result.
--   
--   
Using a generic function
--   
--   We can directly invoke grnf on any type that is an instance
--   of class Generic.
--   
--   
--   >>> grnf (G 2.5 'A' False)
--   ()
--   
--   >>> grnf (G 2.5 undefined False)
--   *** Exception: Prelude.undefined
--   ...
--   
--   
--   Note that the type of grnf requires that all components of
--   the type are in the NFData class. For a recursive datatype such
--   as B, this means that we have to make A (and in this
--   case, also B) an instance of NFData in order to be
--   able to use the grnf function. But we can use grnf
--   to supply the instance definitions:
--   
--   
--   instance NFData A where rnf = grnf
--   instance NFData a => NFData (B a) where rnf = grnf
--   
--   
--   
More examples
--   
--   The best way to learn about how to define generic functions in the SOP
--   style is to look at a few simple examples. Examples are provided by
--   the following packages:
--   
--   
--   
- basic-sop basic examples,
--   
- pretty-sop generic pretty printing,
--   
- lens-sop generically computed lenses,
--   
- json-sop generic JSON conversions.
--   
--   
--   The generic functions in these packages use a wide variety of the
--   combinators that are offered by the library.
--   
--   
Paper
--   
--   A detailed description of the ideas behind this library is provided by
--   the paper:
--   
--   
--   
- Edsko de Vries and Andres Löh. True Sums of Products.
--   Workshop on Generic Programming (WGP) 2014.
--   
module Generics.SOP

-- | The class of representable datatypes.
--   
--   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 a datatype are specified using the
--   Code type family.
--   
--   The isomorphism between the original Haskell datatype and its
--   representation is witnessed by the methods of this class, from
--   and to. So for instances of this class, the following laws
--   should (in general) hold:
--   
--   
--   to . from === id :: a -> a
--   from . to === id :: Rep a -> Rep a
--   
--   
--   You typically don't define instances of this class by hand, but rather
--   derive the class instance automatically.
--   
--   Option 1: Derive via the built-in GHC-generics. For this, you
--   need to use the DeriveGeneric extension to first derive an
--   instance of the Generic class from module GHC.Generics.
--   With this, you can then give an empty instance for Generic, and
--   the default definitions will just work. The pattern looks as follows:
--   
--   
--   import qualified GHC.Generics as GHC
--   import Generics.SOP
--   
--   ...
--   
--   data T = ... deriving (GHC.Generic, ...)
--   
--   instance Generic T -- empty
--   instance HasDatatypeInfo T -- empty, if you want/need metadata
--   
--   
--   Option 2: Derive via Template Haskell. For this, you need to
--   enable the TemplateHaskell extension. You can then use
--   deriveGeneric from module Generics.SOP.TH to have the
--   instance generated for you. The pattern looks as follows:
--   
--   
--   import Generics.SOP
--   import Generics.SOP.TH
--   
--   ...
--   
--   data T = ...
--   
--   deriveGeneric ''T -- derives HasDatatypeInfo as well
--   
--   
--   Tradeoffs: Whether to use Option 1 or 2 is mainly a matter of
--   personal taste. The version based on Template Haskell probably has
--   less run-time overhead.
--   
--   Non-standard instances: It is possible to give Generic
--   instances manually that deviate from the standard scheme, as long as
--   at least
--   
--   
--   to . from === id :: a -> a
--   
--   
--   still holds.
class All SListI :: [Type] -> Constraint Code a => Generic a where {
    
    -- | The code of a datatype.
    --   
    --   This is a list of lists of its components. The outer list contains one
    --   element per constructor. The inner list contains one element per
    --   constructor argument (field).
    --   
    --   <i>Example:</i> The datatype
    --   
    --   <pre>
    --   data Tree = Leaf Int | Node Tree Tree
    --   </pre>
    --   
    --   is supposed to have the following code:
    --   
    --   <pre>
    --   type instance Code (Tree a) =
    --     '[ '[ Int ]
    --      , '[ Tree, Tree ]
    --      ]
    --   </pre>
    type Code a :: [[Type]];
    type Code a = GCode a;
}

-- | Converts from a value to its structural representation.
from :: Generic a => a -> Rep a
($dmfrom) :: (Generic a, GFrom a, Generic a, Rep a ~ SOP I (GCode a)) => a -> Rep a

-- | Converts from a structural representation back to the original value.
to :: Generic a => Rep a -> a
($dmto) :: (Generic a, GTo a, Generic a, Rep a ~ SOP I (GCode a)) => Rep a -> a

-- | The (generic) representation of a datatype.
--   
--   A datatype is isomorphic to the sum-of-products of its code. The
--   isomorphism is witnessed by from and to from the
--   Generic class.
type Rep a = SOP I Code a

-- | Constraint that captures that a datatype is a product type, i.e., a
--   type with a single constructor.
--   
--   It also gives access to the code for the arguments of that
--   constructor.
type IsProductType a (xs :: [Type]) = (Generic a, Code a ~ '[xs])

-- | Direct access to the part of the code that is relevant for a product
--   type.
type ProductCode a = Head Code a

-- | Convert from a product type to its product representation.
productTypeFrom :: forall a (xs :: [Type]). IsProductType a xs => a -> NP I xs

-- | Convert a product representation to the original type.
productTypeTo :: forall a (xs :: [Type]). IsProductType a xs => NP I xs -> a

-- | Constraint that captures that a datatype is an enumeration type, i.e.,
--   none of the constructors have any arguments.
type IsEnumType a = (Generic a, All [Type] ~ '[] :: [Type] Code a)

-- | Convert from an enum type to its sum representation.
enumTypeFrom :: IsEnumType a => a -> NS (K () :: [Type] -> Type) (Code a)

-- | Convert a sum representation to ihe original type.
enumTypeTo :: IsEnumType a => NS (K () :: [Type] -> Type) (Code a) -> a

-- | Constraint that captures that a datatype is a single-constructor,
--   single-field datatype. This always holds for newtype-defined types,
--   but it can also be true for data-defined types.
--   
--   The constraint also gives access to the type that is wrapped.
type IsWrappedType a x = (Generic a, Code a ~ '[ '[x]])

-- | Direct access to the part of the code that is relevant for wrapped
--   types and newtypes.
type WrappedCode a = Head Head Code a

-- | Convert from a wrapped type to its inner type.
wrappedTypeFrom :: IsWrappedType a x => a -> x

-- | Convert a type to a wrapped type.
wrappedTypeTo :: IsWrappedType a x => x -> a

-- | Constraint that captures that a datatype is a newtype. This makes use
--   of the fact that newtypes are always coercible to the type they wrap,
--   whereas datatypes are not.
type IsNewtype a x = (IsWrappedType a x, Coercible a x)

-- | Convert a newtype to its inner type.
--   
--   This is a specialised synonym for coerce.
newtypeFrom :: IsNewtype a x => a -> x

-- | Convert a type to a newtype.
--   
--   This is a specialised synonym for coerce.
newtypeTo :: IsNewtype a x => x -> a

-- | An n-ary product.
--   
--   The product is parameterized by a type constructor f and
--   indexed by a type-level list xs. The length of the list
--   determines the number of elements in the product, and if the
--   i-th element of the list is of type x, then the
--   i-th element of the product is of type f x.
--   
--   The constructor names are chosen to resemble the names of the list
--   constructors.
--   
--   Two common instantiations of f are the identity functor
--   I and the constant functor K. For I, the product
--   becomes a heterogeneous list, where the type-level list describes the
--   types of its components. For K a, the product becomes
--   a homogeneous list, where the contents of the type-level list are
--   ignored, but its length still specifies the number of elements.
--   
--   In the context of the SOP approach to generic programming, an n-ary
--   product describes the structure of the arguments of a single data
--   constructor.
--   
--   Examples:
--   
--   
--   I 'x'    :* I True  :* Nil  ::  NP I       '[ Char, Bool ]
--   K 0      :* K 1     :* Nil  ::  NP (K Int) '[ Char, Bool ]
--   Just 'x' :* Nothing :* Nil  ::  NP Maybe   '[ Char, Bool ]
--   
data NP (a :: k -> Type) (b :: [k])
[Nil] :: forall {k} (a :: k -> Type). NP a ('[] :: [k])
[:*] :: forall {k} (a :: k -> Type) (x :: k) (xs :: [k]). a x -> NP a xs -> NP a (x ': xs)
infixr 5 :*

-- | An n-ary sum.
--   
--   The sum is parameterized by a type constructor f and indexed
--   by a type-level list xs. The length of the list determines
--   the number of choices in the sum and if the i-th element of
--   the list is of type x, then the i-th choice of the
--   sum is of type f x.
--   
--   The constructor names are chosen to resemble Peano-style natural
--   numbers, i.e., Z is for "zero", and S is for
--   "successor". Chaining S and Z chooses the corresponding
--   component of the sum.
--   
--   Examples:
--   
--   
--   Z         :: f x -> NS f (x ': xs)
--   S . Z     :: f y -> NS f (x ': y ': xs)
--   S . S . Z :: f z -> NS f (x ': y ': z ': xs)
--   ...
--   
--   
--   Note that empty sums (indexed by an empty list) have no non-bottom
--   elements.
--   
--   Two common instantiations of f are the identity functor
--   I and the constant functor K. For I, the sum
--   becomes a direct generalization of the Either type to
--   arbitrarily many choices. For K a, the result is a
--   homogeneous choice type, where the contents of the type-level list are
--   ignored, but its length specifies the number of options.
--   
--   In the context of the SOP approach to generic programming, an n-ary
--   sum describes the top-level structure of a datatype, which is a choice
--   between all of its constructors.
--   
--   Examples:
--   
--   
--   Z (I 'x')      :: NS I       '[ Char, Bool ]
--   S (Z (I True)) :: NS I       '[ Char, Bool ]
--   S (Z (K 1))    :: NS (K Int) '[ Char, Bool ]
--   
data NS (a :: k -> Type) (b :: [k])
[Z] :: forall {k} (a :: k -> Type) (x :: k) (xs :: [k]). a x -> NS a (x ': xs)
[S] :: forall {k} (a :: k -> Type) (xs :: [k]) (x :: k). NS a xs -> NS a (x ': xs)

-- | A sum of products.
--   
--   This is a 'newtype' for an NS of an NP. The elements of
--   the (inner) products are applications of the parameter f. The
--   type SOP is indexed by the list of lists that determines the
--   sizes of both the (outer) sum and all the (inner) products, as well as
--   the types of all the elements of the inner products.
--   
--   A SOP I reflects the structure of a normal
--   Haskell datatype. The sum structure represents the choice between the
--   different constructors, the product structure represents the arguments
--   of each constructor.
newtype SOP (f :: k -> Type) (xss :: [[k]])
SOP :: NS (NP f) xss -> SOP (f :: k -> Type) (xss :: [[k]])

-- | Unwrap a sum of products.
unSOP :: forall {k} (f :: k -> Type) (xss :: [[k]]). SOP f xss -> NS (NP f) xss

-- | A product of products.
--   
--   This is a 'newtype' for an NP of an NP. The elements of
--   the inner products are applications of the parameter f. The
--   type POP is indexed by the list of lists that determines the
--   lengths of both the outer and all the inner products, as well as the
--   types of all the elements of the inner products.
--   
--   A POP is reminiscent of a two-dimensional table (but the inner
--   lists can all be of different length). In the context of the SOP
--   approach to generic programming, a POP is useful to represent
--   information that is available for all arguments of all constructors of
--   a datatype.
newtype POP (f :: k -> Type) (xss :: [[k]])
POP :: NP (NP f) xss -> POP (f :: k -> Type) (xss :: [[k]])

-- | Unwrap a product of products.
unPOP :: forall {k} (f :: k -> Type) (xss :: [[k]]). POP f xss -> NP (NP f) xss

-- | Metadata for a datatype.
--   
--   A value of type DatatypeInfo c contains the
--   information about a datatype that is not contained in
--   Code c. This information consists primarily of the
--   names of the datatype, its constructors, and possibly its record
--   selectors.
--   
--   The constructor indicates whether the datatype has been declared using
--   newtype or not.
data DatatypeInfo (a :: [[Type]])
[ADT] :: forall (a :: [[Type]]). ModuleName -> DatatypeName -> NP ConstructorInfo a -> POP StrictnessInfo a -> DatatypeInfo a
[Newtype] :: forall x. ModuleName -> DatatypeName -> ConstructorInfo '[x] -> DatatypeInfo '[ '[x]]

-- | The module name where a datatype is defined.
moduleName :: forall (xss :: [[Type]]). DatatypeInfo xss -> ModuleName

-- | The name of a datatype (or newtype).
datatypeName :: forall (xss :: [[Type]]). DatatypeInfo xss -> DatatypeName

-- | The constructor info for a datatype (or newtype).
constructorInfo :: forall (xss :: [[Type]]). DatatypeInfo xss -> NP ConstructorInfo xss

-- | Metadata for a single constructor.
--   
--   This is indexed by the product structure of the constructor
--   components.
data ConstructorInfo (a :: [Type])
[Constructor] :: forall (a :: [Type]). SListI a => ConstructorName -> ConstructorInfo a
[Infix] :: forall x y. ConstructorName -> Associativity -> Fixity -> ConstructorInfo '[x, y]
[Record] :: forall (a :: [Type]). SListI a => ConstructorName -> NP FieldInfo a -> ConstructorInfo a

-- | The name of a constructor.
constructorName :: forall (xs :: [Type]). ConstructorInfo xs -> ConstructorName

-- | For records, this functor maps the component to its selector name.
data FieldInfo a
[FieldInfo] :: forall a. FieldName -> FieldInfo a

-- | The name of a field.
fieldName :: FieldInfo a -> FieldName

-- | A class of datatypes that have associated metadata.
--   
--   It is possible to use the sum-of-products approach to generic
--   programming without metadata. If you need metadata in a function, an
--   additional constraint on this class is in order.
--   
--   You typically don't define instances of this class by hand, but rather
--   derive the class instance automatically. See the documentation of
--   Generic for the options.
class Generic a => HasDatatypeInfo a where {
    
    -- | Type-level datatype info
    type DatatypeInfoOf a :: DatatypeInfo;
    type DatatypeInfoOf a = GDatatypeInfoOf a;
}

-- | Term-level datatype info; by default, the term-level datatype info is
--   produced from the type-level info.
datatypeInfo :: HasDatatypeInfo a => proxy a -> DatatypeInfo (Code a)
($dmdatatypeInfo) :: (HasDatatypeInfo a, GDatatypeInfo a, GCode a ~ Code a) => proxy a -> DatatypeInfo (Code a)

-- | The name of a datatype.
type DatatypeName = String

-- | The name of a module.
type ModuleName = String

-- | The name of a data constructor.
type ConstructorName = String

-- | The name of a field / record selector.
type FieldName = String

-- | Datatype to represent the associativity of a constructor
data Associativity
LeftAssociative :: Associativity
RightAssociative :: Associativity
NotAssociative :: Associativity

-- | The fixity of an infix constructor.
type Fixity = Int

-- | A generalization of pure or return to higher kinds.
class HPure (h :: k -> Type -> l -> Type)

-- | Corresponds to pure directly.
--   
--   Instances:
--   
--   
--   hpure, pure_NP  :: SListI  xs  => (forall a. f a) -> NP  f xs
--   hpure, pure_POP :: SListI2 xss => (forall a. f a) -> POP f xss
--   
hpure :: forall (xs :: l) f. (HPure h, SListIN h xs) => (forall (a :: k). () => f a) -> h f xs

-- | A variant of hpure that allows passing in a constrained
--   argument.
--   
--   Calling hcpure f s where s :: h f xs causes
--   f to be applied at all the types that are contained in
--   xs. Therefore, the constraint c has to be satisfied
--   for all elements of xs, which is what AllN h c
--   xs states.
--   
--   Instances:
--   
--   
--   hcpure, cpure_NP  :: (All  c xs ) => proxy c -> (forall a. c a => f a) -> NP  f xs
--   hcpure, cpure_POP :: (All2 c xss) => proxy c -> (forall a. c a => f a) -> POP f xss
--   
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

-- | Obtain the head of an n-ary product.
hd :: forall {k} f (x :: k) (xs :: [k]). NP f (x ': xs) -> f x

-- | Obtain the tail of an n-ary product.
tl :: forall {k} (f :: k -> Type) (x :: k) (xs :: [k]). NP f (x ': xs) -> NP f xs

-- | The type of projections from an n-ary product.
--   
--   A projection is a function from the n-ary product to a single element.
type Projection (f :: k -> Type) (xs :: [k]) = K NP f xs :: k -> Type -.-> f

-- | Compute all projections from an n-ary product.
--   
--   Each element of the resulting product contains one of the projections.
projections :: forall {k} (xs :: [k]) (f :: k -> Type). SListI xs => NP (Projection f xs) xs
shiftProjection :: forall {a1} (f :: a1 -> Type) (xs :: [a1]) (a2 :: a1) (x :: a1). Projection f xs a2 -> Projection f (x ': xs) a2

-- | Lifted functions.
newtype ( (f :: k -> Type) -.-> (g :: k -> Type) ) (a :: k)
Fn :: (f a -> g a) -> (-.->) (f :: k -> Type) (g :: k -> Type) (a :: k)
[apFn] :: (-.->) (f :: k -> Type) (g :: k -> Type) (a :: k) -> f a -> g a
infixr 1 -.->

-- | Construct a lifted function.
--   
--   Same as Fn. Only available for uniformity with the higher-arity
--   versions.
fn :: forall {k} f (a :: k) f'. (f a -> f' a) -> (f -.-> f') a

-- | Construct a binary lifted function.
fn_2 :: forall {k} f (a :: k) f' f''. (f a -> f' a -> f'' a) -> (f -.-> (f' -.-> f'')) a

-- | Construct a ternary lifted function.
fn_3 :: forall {k} f (a :: k) f' f'' f'''. (f a -> f' a -> f'' a -> f''' a) -> (f -.-> (f' -.-> (f'' -.-> f'''))) a

-- | Construct a quarternary lifted function.
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

-- | Maps a structure containing sums to the corresponding product
--   structure.
type family Prod (h :: k -> Type -> l -> Type) :: k -> Type -> l -> Type

-- | A generalization of <*>.
class (Prod Prod h ~ Prod h, HPure Prod h) => HAp (h :: k -> Type -> l -> Type)

-- | Corresponds to <*>.
--   
--   For products (NP) as well as products of products (POP),
--   the correspondence is rather direct. We combine a structure containing
--   (lifted) functions and a compatible structure containing corresponding
--   arguments into a compatible structure containing results.
--   
--   The same combinator can also be used to combine a product structure of
--   functions with a sum structure of arguments, which then results in
--   another sum structure of results. The sum structure determines which
--   part of the product structure will be used.
--   
--   Instances:
--   
--   
--   hap, ap_NP  :: NP  (f -.-> g) xs  -> NP  f xs  -> NP  g xs
--   hap, ap_NS  :: NP  (f -.-> g) xs  -> NS  f xs  -> NS  g xs
--   hap, ap_POP :: POP (f -.-> g) xss -> POP f xss -> POP g xss
--   hap, ap_SOP :: POP (f -.-> g) xss -> SOP f xss -> SOP g xss
--   
hap :: forall (f :: k -> Type) (g :: k -> Type) (xs :: l). HAp h => Prod h (f -.-> g) xs -> h f xs -> h g xs

-- | A generalized form of liftA, which in turn is a generalized
--   map.
--   
--   Takes a lifted function and applies it to every element of a structure
--   while preserving its shape.
--   
--   Specification:
--   
--   
--   hliftA f xs = hpure (fn f) ` <a>hap</a> ` xs
--   
--   
--   Instances:
--   
--   
--   hliftA, liftA_NP  :: SListI  xs  => (forall a. f a -> f' a) -> NP  f xs  -> NP  f' xs
--   hliftA, liftA_NS  :: SListI  xs  => (forall a. f a -> f' a) -> NS  f xs  -> NS  f' xs
--   hliftA, liftA_POP :: SListI2 xss => (forall a. f a -> f' a) -> POP f xss -> POP f' xss
--   hliftA, liftA_SOP :: SListI2 xss => (forall a. f a -> f' a) -> SOP f xss -> SOP f' xss
--   
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

-- | A generalized form of liftA2, which in turn is a generalized
--   zipWith.
--   
--   Takes a lifted binary function and uses it to combine two structures
--   of equal shape into a single structure.
--   
--   It either takes two product structures to a product structure, or one
--   product and one sum structure to a sum structure.
--   
--   Specification:
--   
--   
--   hliftA2 f xs ys = hpure (fn_2 f) ` <a>hap</a> ` xs ` <a>hap</a> ` ys
--   
--   
--   Instances:
--   
--   
--   hliftA2, liftA2_NP  :: SListI  xs  => (forall a. f a -> f' a -> f'' a) -> NP  f xs  -> NP  f' xs  -> NP  f'' xs
--   hliftA2, liftA2_NS  :: SListI  xs  => (forall a. f a -> f' a -> f'' a) -> NP  f xs  -> NS  f' xs  -> NS  f'' xs
--   hliftA2, liftA2_POP :: SListI2 xss => (forall a. f a -> f' a -> f'' a) -> POP f xss -> POP f' xss -> POP f'' xss
--   hliftA2, liftA2_SOP :: SListI2 xss => (forall a. f a -> f' a -> f'' a) -> POP f xss -> SOP f' xss -> SOP f'' xss
--   
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

-- | A generalized form of liftA3, which in turn is a generalized
--   zipWith3.
--   
--   Takes a lifted ternary function and uses it to combine three
--   structures of equal shape into a single structure.
--   
--   It either takes three product structures to a product structure, or
--   two product structures and one sum structure to a sum structure.
--   
--   Specification:
--   
--   
--   hliftA3 f xs ys zs = hpure (fn_3 f) ` <a>hap</a> ` xs ` <a>hap</a> ` ys ` <a>hap</a> ` zs
--   
--   
--   Instances:
--   
--   
--   hliftA3, liftA3_NP  :: SListI  xs  => (forall a. f a -> f' a -> f'' a -> f''' a) -> NP  f xs  -> NP  f' xs  -> NP  f'' xs  -> NP  f''' xs
--   hliftA3, liftA3_NS  :: SListI  xs  => (forall a. f a -> f' a -> f'' a -> f''' a) -> NP  f xs  -> NP  f' xs  -> NS  f'' xs  -> NS  f''' xs
--   hliftA3, liftA3_POP :: SListI2 xss => (forall a. f a -> f' a -> f'' a -> f''' a) -> POP f xss -> POP f' xss -> POP f'' xss -> POP f''' xs
--   hliftA3, liftA3_SOP :: SListI2 xss => (forall a. f a -> f' a -> f'' a -> f''' a) -> POP f xss -> POP f' xss -> SOP f'' xss -> SOP f''' xs
--   
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

-- | Variant of hliftA that takes a constrained function.
--   
--   Specification:
--   
--   
--   hcliftA p f xs = hcpure p (fn f) ` <a>hap</a> ` xs
--   
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

-- | Variant of hliftA2 that takes a constrained function.
--   
--   Specification:
--   
--   
--   hcliftA2 p f xs ys = hcpure p (fn_2 f) ` <a>hap</a> ` xs ` <a>hap</a> ` ys
--   
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

-- | Variant of hliftA3 that takes a constrained function.
--   
--   Specification:
--   
--   
--   hcliftA3 p f xs ys zs = hcpure p (fn_3 f) ` <a>hap</a> ` xs ` <a>hap</a> ` ys ` <a>hap</a> ` zs
--   
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

-- | Another name for hliftA.
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

-- | Another name for hliftA2.
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

-- | Another name for hliftA3.
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

-- | Another name for hcliftA.
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

-- | Another name for hcliftA2.
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

-- | Another name for hcliftA3.
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

-- | The type of injections into an n-ary sum.
--   
--   If you expand the type synonyms and newtypes involved, you get
--   
--   
--   Injection f xs a = (f -.-> K (NS f xs)) a ~= f a -> K (NS f xs) a ~= f a -> NS f xs
--   
--   
--   If we pick a to be an element of xs, this indeed
--   corresponds to an injection into the sum.
type Injection (f :: k -> Type) (xs :: [k]) = f -.-> K NS f xs :: k -> Type

-- | Compute all injections into an n-ary sum.
--   
--   Each element of the resulting product contains one of the injections.
injections :: forall {k} (xs :: [k]) (f :: k -> Type). SListI xs => NP (Injection f xs) xs

-- | Shift an injection.
--   
--   Given an injection, return an injection into a sum that is one
--   component larger.
shift :: forall {a1} (f :: a1 -> Type) (xs :: [a1]) (a2 :: a1) (x :: a1). Injection f xs a2 -> Injection f (x ': xs) a2

-- | Shift an injection.
--   
--   Given an injection, return an injection into a sum that is one
--   component larger.
shiftInjection :: forall {a1} (f :: a1 -> Type) (xs :: [a1]) (a2 :: a1) (x :: a1). Injection f xs a2 -> Injection f (x ': xs) a2

-- | Maps a structure containing products to the corresponding sum
--   structure.
type family UnProd (h :: k -> Type -> l -> Type) :: k -> Type -> l -> Type

-- | A class for applying all injections corresponding to a sum-like
--   structure to a table containing suitable arguments.
class UnProd Prod h ~ h => HApInjs (h :: k -> Type -> l -> Type)

-- | For a given table (product-like structure), produce a list where each
--   element corresponds to the application of an injection function into
--   the corresponding sum-like structure.
--   
--   Instances:
--   
--   
--   hapInjs, apInjs_NP  :: SListI  xs  => NP  f xs -> [NS  f xs ]
--   hapInjs, apInjs_SOP :: SListI2 xss => POP f xs -> [SOP f xss]
--   
--   
--   Examples:
--   
--   
--   >>> hapInjs (I 'x' :* I True :* I 2 :* Nil) :: [NS I '[Char, Bool, Int]]
--   [Z (I 'x'),S (Z (I True)),S (S (Z (I 2)))]
--   
--   
--   
--   >>> hapInjs (POP ((I 'x' :* Nil) :* (I True :* I 2 :* Nil) :* Nil)) :: [SOP I '[ '[Char], '[Bool, Int]]]
--   [SOP (Z (I 'x' :* Nil)),SOP (S (Z (I True :* I 2 :* Nil)))]
--   
--   
--   Unfortunately the type-signatures are required in GHC-7.10 and older.
hapInjs :: forall (xs :: l) (f :: k -> Type). (HApInjs h, SListIN h xs) => Prod h f xs -> [h f xs]

-- | Apply injections to a product.
--   
--   Given a product containing all possible choices, produce a list of
--   sums by applying each injection to the appropriate element.
--   
--   Example:
--   
--   
--   >>> apInjs_NP (I 'x' :* I True :* I 2 :* Nil)
--   [Z (I 'x'),S (Z (I True)),S (S (Z (I 2)))]
--   
apInjs_NP :: forall {k} (xs :: [k]) (f :: k -> Type). SListI xs => NP f xs -> [NS f xs]

-- | Apply injections to a product of product.
--   
--   This operates on the outer product only. Given a product containing
--   all possible choices (that are products), produce a list of sums (of
--   products) by applying each injection to the appropriate element.
--   
--   Example:
--   
--   
--   >>> apInjs_POP (POP ((I 'x' :* Nil) :* (I True :* I 2 :* Nil) :* Nil))
--   [SOP (Z (I 'x' :* Nil)),SOP (S (Z (I True :* I 2 :* Nil)))]
--   
apInjs_POP :: forall {k} (xss :: [[k]]) (f :: k -> Type). SListI xss => POP f xss -> [SOP f xss]

-- | 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'
--   
unZ :: forall {k} f (x :: k). NS f '[x] -> f x

-- | A class for determining which choice in a sum-like structure a value
--   represents.
class HIndex (h :: k -> Type -> l -> Type)

-- | If h is a sum-like structure representing a choice between
--   n different options, and x is a value of type h
--   f xs, then hindex x returns a number between
--   0 and n - 1 representing the index of the choice
--   made by x.
--   
--   Instances:
--   
--   
--   hindex, index_NS  :: NS  f xs -> Int
--   hindex, index_SOP :: SOP f xs -> Int
--   
--   
--   Examples:
--   
--   
--   >>> hindex (S (S (Z (I False))))
--   2
--   
--   >>> hindex (Z (K ()))
--   0
--   
--   >>> hindex (SOP (S (Z (I True :* I 'x' :* Nil))))
--   1
--   
hindex :: forall (f :: k -> Type) (xs :: l). HIndex h => h f xs -> Int

-- | The type of ejections from an n-ary sum.
--   
--   An ejection is the pattern matching function for one part of the n-ary
--   sum.
--   
--   It is the opposite of an Injection.
type Ejection (f :: k -> Type) (xs :: [k]) = K NS f xs :: k -> Type -.-> Maybe :.: f

-- | Compute all ejections from an n-ary sum.
--   
--   Each element of the resulting product contains one of the ejections.
ejections :: forall {k} (xs :: [k]) (f :: k -> Type). SListI xs => NP (Ejection f xs) xs

shiftEjection :: forall {a1} (f :: a1 -> Type) (x :: a1) (xs :: [a1]) (a2 :: a1). Ejection f xs a2 -> Ejection f (x ': xs) a2

-- | Lift a constrained function operating on a list-indexed structure to a
--   function on a list-of-list-indexed structure.
--   
--   This is a variant of hcliftA.
--   
--   Specification:
--   
--   
--   hcliftA' p f xs = hpure (fn_2 $ \ AllDictC -> f) ` <a>hap</a> ` allDict_NP p ` <a>hap</a> ` xs
--   
--   
--   Instances:
--   
--   
--   hcliftA' :: All2 c xss => proxy c -> (forall xs. All c xs => f xs -> f' xs) -> NP f xss -> NP f' xss
--   hcliftA' :: All2 c xss => proxy c -> (forall xs. All c xs => f xs -> f' xs) -> NS f xss -> NS f' xss
--   
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

-- | Like hcliftA', but for binary functions.
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

-- | Like hcliftA', but for ternary functions.
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

-- | Compare two sums with respect to the choice they are making.
--   
--   A value that chooses the first option is considered smaller than one
--   that chooses the second option.
--   
--   If the choices are different, then either the first (if the first is
--   smaller than the second) or the third (if the first is larger than the
--   second) argument are called. If both choices are equal, then the
--   second argument is called, which has access to the elements contained
--   in the sums.
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

-- | Constrained version of compare_NS.
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

-- | Compare two sums of products with respect to the choice in the sum
--   they are making.
--   
--   Only the sum structure is used for comparison. This is a small wrapper
--   around ccompare_NS for a common special case.
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

-- | Constrained version of compare_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

-- | Maps products to lists, and sums to identities.
type family CollapseTo (h :: k -> Type -> l -> Type) x

-- | A class for collapsing a heterogeneous structure into a homogeneous
--   one.
class HCollapse (h :: k -> Type -> l -> Type)

-- | Collapse a heterogeneous structure with homogeneous elements into a
--   homogeneous structure.
--   
--   If a heterogeneous structure is instantiated to the constant functor
--   K, then it is in fact homogeneous. This function maps such a
--   value to a simpler Haskell datatype reflecting that. An NS
--   (K a) contains a single a, and an NP
--   (K a) contains a list of as.
--   
--   Instances:
--   
--   
--   hcollapse, collapse_NP  :: NP  (K a) xs  ->  [a]
--   hcollapse, collapse_NS  :: NS  (K a) xs  ->   a
--   hcollapse, collapse_POP :: POP (K a) xss -> [[a]]
--   hcollapse, collapse_SOP :: SOP (K a) xss ->  [a]
--   
hcollapse :: forall (xs :: l) a. (HCollapse h, SListIN h xs) => h (K a :: k -> Type) xs -> CollapseTo h a

-- | A generalization of traverse_ or foldMap.
class HTraverse_ (h :: k -> Type -> l -> Type)

-- | Corresponds to traverse_.
--   
--   Instances:
--   
--   
--   hctraverse_, ctraverse__NP  :: (All  c xs , Applicative g) => proxy c -> (forall a. c a => f a -> g ()) -> NP  f xs  -> g ()
--   hctraverse_, ctraverse__NS  :: (All2 c xs , Applicative g) => proxy c -> (forall a. c a => f a -> g ()) -> NS  f xs  -> g ()
--   hctraverse_, ctraverse__POP :: (All  c xss, Applicative g) => proxy c -> (forall a. c a => f a -> g ()) -> POP f xss -> g ()
--   hctraverse_, ctraverse__SOP :: (All2 c xss, Applicative g) => proxy c -> (forall a. c a => f a -> g ()) -> SOP f xss -> g ()
--   
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 ()

-- | Unconstrained version of hctraverse_.
--   
--   Instances:
--   
--   
--   traverse_, traverse__NP  :: (SListI  xs , Applicative g) => (forall a. f a -> g ()) -> NP  f xs  -> g ()
--   traverse_, traverse__NS  :: (SListI  xs , Applicative g) => (forall a. f a -> g ()) -> NS  f xs  -> g ()
--   traverse_, traverse__POP :: (SListI2 xss, Applicative g) => (forall a. f a -> g ()) -> POP f xss -> g ()
--   traverse_, traverse__SOP :: (SListI2 xss, Applicative g) => (forall a. f a -> g ()) -> SOP f xss -> g ()
--   
htraverse_ :: forall (xs :: l) g f. (HTraverse_ h, SListIN h xs, Applicative g) => (forall (a :: k). () => f a -> g ()) -> h f xs -> g ()

-- | Special case of hctraverse_.
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

-- | Flipped version of hctraverse_.
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 ()

-- | A generalization of sequenceA.
class HAp h => HSequence (h :: k -> Type -> l -> Type)

-- | Corresponds to sequenceA.
--   
--   Lifts an applicative functor out of a structure.
--   
--   Instances:
--   
--   
--   hsequence', sequence'_NP  :: (SListI  xs , Applicative f) => NP  (f :.: g) xs  -> f (NP  g xs )
--   hsequence', sequence'_NS  :: (SListI  xs , Applicative f) => NS  (f :.: g) xs  -> f (NS  g xs )
--   hsequence', sequence'_POP :: (SListI2 xss, Applicative f) => POP (f :.: g) xss -> f (POP g xss)
--   hsequence', sequence'_SOP :: (SListI2 xss, Applicative f) => SOP (f :.: g) xss -> f (SOP g xss)
--   
hsequence' :: forall (xs :: l) f (g :: k -> Type). (HSequence h, SListIN h xs, Applicative f) => h (f :.: g) xs -> f (h g xs)

-- | Corresponds to traverse.
--   
--   Instances:
--   
--   
--   hctraverse', ctraverse'_NP  :: (All  c xs , Applicative g) => proxy c -> (forall a. c a => f a -> g (f' a)) -> NP  f xs  -> g (NP  f' xs )
--   hctraverse', ctraverse'_NS  :: (All2 c xs , Applicative g) => proxy c -> (forall a. c a => f a -> g (f' a)) -> NS  f xs  -> g (NS  f' xs )
--   hctraverse', ctraverse'_POP :: (All  c xss, Applicative g) => proxy c -> (forall a. c a => f a -> g (f' a)) -> POP f xss -> g (POP f' xss)
--   hctraverse', ctraverse'_SOP :: (All2 c xss, Applicative g) => proxy c -> (forall a. c a => f a -> g (f' a)) -> SOP f xss -> g (SOP f' xss)
--   
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)

-- | Unconstrained variant of hctraverse'.
--   
--   Instances:
--   
--   
--   htraverse', traverse'_NP  :: (SListI  xs , Applicative g) => (forall a. c a => f a -> g (f' a)) -> NP  f xs  -> g (NP  f' xs )
--   htraverse', traverse'_NS  :: (SListI2 xs , Applicative g) => (forall a. c a => f a -> g (f' a)) -> NS  f xs  -> g (NS  f' xs )
--   htraverse', traverse'_POP :: (SListI  xss, Applicative g) => (forall a. c a => f a -> g (f' a)) -> POP f xss -> g (POP f' xss)
--   htraverse', traverse'_SOP :: (SListI2 xss, Applicative g) => (forall a. c a => f a -> g (f' a)) -> SOP f xss -> g (SOP f' xss)
--   
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)

-- | Special case of hsequence' where g = I.
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)

-- | Special case of hsequence' where g = K a.
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)

-- | Special case of hctraverse' where f' = I.
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)

-- | Flipped version of hctraverse.
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)

-- | A class for expanding sum structures into corresponding product
--   structures, filling in the slots not targeted by the sum with default
--   values.
class HExpand (h :: k -> Type -> l -> Type)

-- | Expand a given sum structure into a corresponding product structure by
--   placing the value contained in the sum into the corresponding position
--   in the product, and using the given default value for all other
--   positions.
--   
--   Instances:
--   
--   
--   hexpand, expand_NS  :: SListI xs   => (forall x . f x) -> NS  f xs  -> NP  f xs
--   hexpand, expand_SOP :: SListI2 xss => (forall x . f x) -> SOP f xss -> POP f xss
--   
--   
--   Examples:
--   
--   
--   >>> hexpand Nothing (S (Z (Just 3))) :: NP Maybe '[Char, Int, Bool]
--   Nothing :* Just 3 :* Nothing :* Nil
--   
--   >>> hexpand [] (SOP (S (Z ([1,2] :* "xyz" :* Nil)))) :: POP [] '[ '[Bool], '[Int, Char] ]
--   POP (([] :* Nil) :* ([1,2] :* "xyz" :* Nil) :* Nil)
--   
hexpand :: forall (xs :: l) f. (HExpand h, SListIN (Prod h) xs) => (forall (x :: k). () => f x) -> h f xs -> Prod h f xs

-- | Variant of hexpand that allows passing a constrained default.
--   
--   Instances:
--   
--   
--   hcexpand, cexpand_NS  :: All  c xs  => proxy c -> (forall x . c x => f x) -> NS  f xs  -> NP  f xs
--   hcexpand, cexpand_SOP :: All2 c xss => proxy c -> (forall x . c x => f x) -> SOP f xss -> POP f xss
--   
--   
--   Examples:
--   
--   
--   >>> hcexpand (Proxy :: Proxy Bounded) (I minBound) (S (Z (I 20))) :: NP I '[Bool, Int, Ordering]
--   I False :* I 20 :* I LT :* Nil
--   
--   >>> hcexpand (Proxy :: Proxy Num) (I 0) (SOP (S (Z (I 1 :* I 2 :* Nil)))) :: POP I '[ '[Double], '[Int, Int] ]
--   POP ((I 0.0 :* Nil) :* (I 1 :* I 2 :* Nil) :* Nil)
--   
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

-- | A class for transforming structures into related structures with a
--   different index list, as long as the index lists have the same shape
--   and the elements and interpretation functions are suitably related.
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)

-- | Transform a structure into a related structure given a conversion
--   function for the elements.
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

-- | Safely coerce a structure into a representationally equal structure.
--   
--   This is a special case of htrans, but can be implemented more
--   efficiently; for example in terms of unsafeCoerce.
--   
--   Examples:
--   
--   
--   >>> hcoerce (I (Just LT) :* I (Just 'x') :* I (Just True) :* Nil) :: NP Maybe '[Ordering, Char, Bool]
--   Just LT :* Just 'x' :* Just True :* Nil
--   
--   >>> hcoerce (SOP (Z (K True :* K False :* Nil))) :: SOP I '[ '[Bool, Bool], '[Bool] ]
--   SOP (Z (I True :* I False :* Nil))
--   
hcoerce :: forall (f :: k1 -> Type) (g :: k2 -> Type) (xs :: l1) (ys :: l2). (HTrans h1 h2, AllZipN (Prod h1) (LiftedCoercible f g) xs ys) => h1 f xs -> h2 g ys

-- | Specialization of hcoerce.
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

-- | Specialization of hcoerce.
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

-- | Construct a homogeneous n-ary product from a normal Haskell list.
--   
--   Returns Nothing if the length of the list does not exactly
--   match the expected size of the product.
fromList :: forall {k} (xs :: [k]) a. SListI xs => [a] -> Maybe (NP (K a :: k -> Type) xs)

-- | The constant type functor.
--   
--   Like Constant, but kind-polymorphic in its second argument and
--   with a shorter name.
newtype K a (b :: k)
K :: a -> K a (b :: k)

-- | Extract the contents of a K value.
unK :: forall {k} a (b :: k). K a b -> a

-- | The identity type functor.
--   
--   Like Identity, but with a shorter name.
newtype I a
I :: a -> I a

-- | Extract the contents of an I value.
unI :: I a -> a

-- | Composition of functors.
--   
--   Like Compose, but kind-polymorphic and with a shorter name.
newtype ( (f :: l -> Type) :.: (g :: k -> l) ) (p :: k)
Comp :: f (g p) -> (:.:) (f :: l -> Type) (g :: k -> l) (p :: k)
infixr 7 :.:

-- | Extract the contents of a Comp value.
unComp :: forall {l} {k} f (g :: k -> l) (p :: k). (f :.: g) p -> f (g p)

-- | Lift the given function.
mapII :: (a -> b) -> I a -> I b

-- | Lift the given function.
mapIK :: forall {k} a b (c :: k). (a -> b) -> I a -> K b c

-- | Lift the given function.
mapKI :: forall {k} a b (c :: k). (a -> b) -> K a c -> I b

-- | Lift the given function.
mapKK :: forall {k1} {k2} a b (c :: k1) (d :: k2). (a -> b) -> K a c -> K b d

-- | Lift the given function.
mapIII :: (a -> b -> c) -> I a -> I b -> I c

-- | Lift the given function.
mapIIK :: forall {k} a b c (d :: k). (a -> b -> c) -> I a -> I b -> K c d

-- | Lift the given function.
mapIKI :: forall {k} a b c (d :: k). (a -> b -> c) -> I a -> K b d -> I c

-- | Lift the given function.
mapIKK :: forall {k1} {k2} a b c (d :: k1) (e :: k2). (a -> b -> c) -> I a -> K b d -> K c e

-- | Lift the given function.
mapKII :: forall {k} a b c (d :: k). (a -> b -> c) -> K a d -> I b -> I c

-- | Lift the given function.
mapKIK :: forall {k1} {k2} a b c (d :: k1) (e :: k2). (a -> b -> c) -> K a d -> I b -> K c e

-- | Lift the given function.
mapKKI :: forall {k1} {k2} a b c (d :: k1) (e :: k2). (a -> b -> c) -> K a d -> K b e -> I c

-- | Lift the given function.
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

-- | Require a constraint for every element of a list.
--   
--   If you have a datatype that is indexed over a type-level list, then
--   you can use All to indicate that all elements of that
--   type-level list must satisfy a given constraint.
--   
--   Example: The constraint
--   
--   
--   All Eq '[ Int, Bool, Char ]
--   
--   
--   is equivalent to the constraint
--   
--   
--   (Eq Int, Eq Bool, Eq Char)
--   
--   
--   Example: A type signature such as
--   
--   
--   f :: All Eq xs => NP I xs -> ...
--   
--   
--   means that f can assume that all elements of the n-ary
--   product satisfy Eq.
--   
--   Note on superclasses: ghc cannot deduce superclasses from All
--   constraints. You might expect the following to compile
--   
--   
--   class (Eq a) => MyClass a
--   
--   foo :: (All Eq xs) => NP f xs -> z
--   foo = [..]
--   
--   bar :: (All MyClass xs) => NP f xs -> x
--   bar = foo
--   
--   
--   but it will fail with an error saying that it was unable to deduce the
--   class constraint AllF Eq xs (or similar) in the
--   definition of bar. In cases like this you can use Dict
--   from Data.SOP.Dict to prove conversions between constraints.
--   See this answer on SO for more details.
class (AllF c xs, SListI xs) => All (c :: k -> Constraint) (xs :: [k])

-- | Require a constraint for every element of a list of lists.
--   
--   If you have a datatype that is indexed over a type-level list of
--   lists, then you can use All2 to indicate that all elements of
--   the inner lists must satisfy a given constraint.
--   
--   Example: The constraint
--   
--   
--   All2 Eq '[ '[ Int ], '[ Bool, Char ] ]
--   
--   
--   is equivalent to the constraint
--   
--   
--   (Eq Int, Eq Bool, Eq Char)
--   
--   
--   Example: A type signature such as
--   
--   
--   f :: All2 Eq xss => SOP I xs -> ...
--   
--   
--   means that f can assume that all elements of the sum of
--   product satisfy Eq.
--   
--   Since 0.4.0.0, this is merely a synonym for 'All (All c)'.
type All2 (c :: k -> Constraint) = All All c

-- | Constrained paramorphism for a type-level list.
--   
--   The advantage of writing functions in terms of cpara_SList is
--   that they are then typically not recursive, and can be unfolded
--   statically if the type-level list is statically known.
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

-- | Constrained case distinction on a type-level list.
ccase_SList :: forall {a} c (xs :: [a]) proxy r. All c xs => proxy c -> r ('[] :: [a]) -> (forall (y :: a) (ys :: [a]). (c y, All c ys) => r (y ': ys)) -> r xs

-- | Require a constraint pointwise for every pair of elements from two
--   lists.
--   
--   Example: The constraint
--   
--   
--   AllZip (~) '[ Int, Bool, Char ] '[ a, b, c ]
--   
--   
--   is equivalent to the constraint
--   
--   
--   (Int ~ a, Bool ~ b, Char ~ c)
--   
class (SListI xs, SListI ys, SameShapeAs xs ys, SameShapeAs ys xs, AllZipF c xs ys) => AllZip (c :: a -> b -> Constraint) (xs :: [a]) (ys :: [b])

-- | Require a constraint pointwise for every pair of elements from two
--   lists of lists.
class (AllZipF AllZip f xss yss, SListI xss, SListI yss, SameShapeAs xss yss, SameShapeAs yss xss) => AllZip2 (f :: a -> b -> Constraint) (xss :: [[a]]) (yss :: [[b]])

-- | A generalization of All and All2.
--   
--   The family AllN expands to All or All2 depending
--   on whether the argument is indexed by a list or a list of lists.
type family AllN (h :: k -> Type -> l -> Type) (c :: k -> Constraint) :: l -> Constraint

-- | A generalization of AllZip and AllZip2.
--   
--   The family AllZipN expands to AllZip or AllZip2
--   depending on whther the argument is indexed by a list or a list of
--   lists.
type family AllZipN (h :: k -> Type -> l -> Type) (c :: k1 -> k2 -> Constraint) :: l1 -> l2 -> Constraint

-- | Composition of constraints.
--   
--   Note that the result of the composition must be a constraint, and
--   therefore, in Compose f g, the kind of f is
--   k -> Constraint. The kind of g, however,
--   is l -> k and can thus be a normal type constructor.
--   
--   A typical use case is in connection with All on an NP or
--   an NS. For example, in order to denote that all elements on an
--   NP f xs satisfy Show, we can say All
--   (Compose Show f) xs.
class f g x => Compose (f :: k -> Constraint) (g :: k1 -> k) (x :: k1)
infixr 9 `Compose`

-- | Pairing of constraints.
class (f x, g x) => And (f :: k -> Constraint) (g :: k -> Constraint) (x :: k)
infixl 7 `And`

-- | A constraint that can always be satisfied.
class Top (x :: k)

-- | The constraint LiftedCoercible f g x y is equivalent
--   to Coercible (f x) (g y).
class Coercible f x g y => LiftedCoercible (f :: k -> k1) (g :: k2 -> k1) (x :: k) (y :: k2)

-- | Type family that forces a type-level list to be of the same shape as
--   the given type-level list.
--   
--   Since 0.5.0.0, this only tests the top-level structure of the list,
--   and is intended to be used in conjunction with a separate construct
--   (such as the AllZip, AllZipF combination to tie the
--   recursive knot). The reason is that making SameShapeAs directly
--   recursive leads to quadratic compile times.
--   
--   The main use of this constraint is to help type inference to learn
--   something about otherwise unknown type-level lists.
type family SameShapeAs (xs :: [a]) (ys :: [b])

-- | Explicit singleton list.
--   
--   A singleton list can be used to reveal the structure of a type-level
--   list argument that the function is quantified over. For every
--   type-level list xs, there is one non-bottom value of type
--   SList xs.
--   
--   Note that these singleton lists are polymorphic in the list elements;
--   we do not require a singleton representation for them.
data SList (a :: [k])
[SNil] :: forall {k}. SList ('[] :: [k])
[SCons] :: forall {k} (xs :: [k]) (x :: k). SListI xs => SList (x ': xs)

-- | Implicit singleton list.
--   
--   A singleton list can be used to reveal the structure of a type-level
--   list argument that the function is quantified over.
--   
--   Since 0.4.0.0, this is now defined in terms of All. A singleton
--   list provides a witness for a type-level list where the elements need
--   not satisfy any additional constraints.
type SListI = All Top :: k -> Constraint

-- | Require a singleton for every inner list in a list of lists.
type SListI2 = All SListI :: [k] -> Constraint

-- | Get hold of an explicit singleton (that one can then pattern match on)
--   for a type-level list
sList :: forall {k} (xs :: [k]). SListI xs => SList xs

-- | Paramorphism for a type-level list.
para_SList :: forall {a} (xs :: [a]) r. SListI xs => r ('[] :: [a]) -> (forall (y :: a) (ys :: [a]). SListI ys => r ys -> r (y ': ys)) -> r xs

-- | Case distinction on a type-level list.
case_SList :: forall {a} (xs :: [a]) r. SListI xs => r ('[] :: [a]) -> (forall (y :: a) (ys :: [a]). SListI ys => r (y ': ys)) -> r xs

-- | Occasionally it is useful to have an explicit, term-level,
--   representation of type-level lists (esp because of
--   https://ghc.haskell.org/trac/ghc/ticket/9108 )
data Shape (a :: [k])
[ShapeNil] :: forall {k}. Shape ('[] :: [k])
[ShapeCons] :: forall {k} (xs :: [k]) (x :: k). SListI xs => Shape xs -> Shape (x ': xs)

-- | The shape of a type-level list.
shape :: forall k (xs :: [k]). SListI xs => Shape xs

-- | The length of a type-level list.
lengthSList :: forall k (xs :: [k]) proxy. SListI xs => proxy xs -> Int

-- | Proxy is a type that holds no data, but has a phantom parameter
--   of arbitrary type (or even kind). Its use is to provide type
--   information, even though there is no value available of that type (or
--   it may be too costly to create one).
--   
--   Historically, Proxy :: Proxy a is a safer
--   alternative to the undefined :: a idiom.
--   
--   
--   >>> Proxy :: Proxy (Void, Int -> Int)
--   Proxy
--   
--   
--   Proxy can even hold types of higher kinds,
--   
--   
--   >>> Proxy :: Proxy Either
--   Proxy
--   
--   
--   
--   >>> Proxy :: Proxy Functor
--   Proxy
--   
--   
--   
--   >>> Proxy :: Proxy complicatedStructure
--   Proxy
--   
data Proxy (t :: k)
Proxy :: Proxy (t :: k)
