-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Surgery for generic data types -- -- Transform data types before passing them to generic functions. @package generic-data-surgery @version 0.2.0.0 -- | Operate on data types: insert/modify/delete fields and constructors. module Generic.Data.Surgery.Internal -- | A sterile Operating Room, where generic data comes to be -- altered. -- -- Generic representation in a simplified shape l at the type -- level (reusing the constructors from GHC.Generics for -- convenience). This representation makes it easy to modify fields and -- constructors. -- -- We may also refer to the representation l as a "row" of -- constructors, if it represents a sum type, otherwise it is a "row" of -- unnamed fields or record fields for single-constructor types. -- -- x corresponds to the last parameter of Rep, and is -- currently ignored by this module (no support for Generic1). newtype OR (l :: k -> Type) (x :: k) OR :: l x -> OR [unOR] :: OR -> l x -- | Move fresh data to the Operating Room, where surgeries can be -- applied. -- -- Convert a generic type to a generic representation. -- --

Details

-- --

Type parameters

-- --
--   a :: Type       -- Generic type
--   l :: k -> Type  -- Generic representation (simplified)
--   x :: k          -- Ignored
--   
-- --

Functional dependencies

-- --
--   a -> l
--   
toOR :: forall a l x. (Generic a, ToORRep a l) => a -> OR l x -- | Move altered data out of the Operating Room, to be consumed by -- some generic function. -- -- Convert a generic representation to a "synthetic" type that behaves -- like a generic type. -- --

Details

-- --

Type parameters

-- --
--   f :: k -> Type  -- Generic representation (proper)
--   l :: k -> Type  -- Generic representation (simplified)
--   x :: k          -- Ignored
--   
-- --

Functional dependencies

-- --
--   f -> l
--   l -> f
--   
-- --

Implementation details

-- -- The synthesized representation is made of balanced binary trees, -- corresponding closely to what GHC would generate for an actual data -- type. -- -- That structure assumed by at least one piece of code out there -- (aeson). fromOR' :: forall f l x. FromOR f l => OR l x -> Data f x -- | Move altered data, produced by some generic function, to the -- operating room. -- -- The inverse of fromOR'. -- --

Details

-- --

Type parameters

-- --
--   f :: k -> Type  -- Generic representation (proper)
--   l :: k -> Type  -- Generic representation (simplified)
--   x :: k          -- Ignored
--   
-- --

Functional dependencies

-- --
--   f -> l
--   l -> f
--   
toOR' :: forall f l x. ToOR f l => Data f x -> OR l x -- | Move restored data out of the Operating Room and back to the -- real world. -- -- The inverse of toOR. -- -- It may be useful to annotate the output type of fromOR, since -- the rest of the type depends on it and the only way to infer it -- otherwise is from the context. The following annotations are possible: -- --
--   fromOR :: OROf a -> a
--   fromOR @a  -- with TypeApplications
--   
-- --

Details

-- --

Type parameters

-- --
--   a :: Type       -- Generic type
--   l :: k -> Type  -- Generic representation (simplified)
--   x :: k          -- Ignored
--   
-- --

Functional dependencies

-- --
--   a -> l
--   
fromOR :: forall a l x. (Generic a, FromORRep a l) => OR l x -> a -- | The simplified generic representation type of type a, that -- toOR and fromOR convert to and from. type OROf a = OR (Linearize (Rep a)) () -- | This constraint means that a is convertible to its -- simplified generic representation. Implies OROf a ~ -- OR l (). type ToORRep a l = ToOR (Rep a) l -- | This constraint means that a is convertible from its -- simplified generic representation. Implies OROf a ~ -- OR l (). type FromORRep a l = FromOR (Rep a) l -- | Similar to ToORRep, but as a constraint on the standard generic -- representation of a directly, f ~ Rep a. type ToOR f l = (GLinearize f, Linearize f ~ l, f ~ Arborify l) -- | Similar to FromORRep, but as a constraint on the standard -- generic representation of a directly, f ~ Rep -- a. type FromOR f l = (GArborify f, Linearize f ~ l, f ~ Arborify l) -- | removeCField @n @t: remove the n-th field, of -- type t, in a non-record single-constructor type. -- -- Inverse of insertCField. -- --

Details

-- --

Type parameters

-- --
--   n  :: Nat        -- Field position
--   t  :: Type       -- Field type
--   lt :: k -> Type  -- Row with    field
--   l  :: k -> Type  -- Row without field
--   x  :: k          -- Ignored
--   
-- --

Signature

-- --
--   OR lt x      -- Data with field
--   ->
--   (t, OR l x)  -- Field value × Data without field
--   
-- --

Functional dependencies

-- --
--   n lt  -> t l
--   n t l -> lt
--   
removeCField :: forall n t lt l x. RmvCField n t lt l => OR lt x -> (t, OR l x) -- | removeRField @"fdName" @n @t: remove the field -- fdName at position n of type t in a record -- type. -- -- Inverse of insertRField. -- --

Details

-- --

Type parameters

-- --
--   fd :: Symbol     -- Field name
--   n  :: Nat        -- Field position
--   t  :: Type       -- Field type
--   lt :: k -> Type  -- Row with    field
--   l  :: k -> Type  -- Row without field
--   x  :: k          -- Ignored
--   
-- --

Signature

-- --
--   OR lt x      -- Data with field
--   ->
--   (t, OR l x)  -- Field value × Data without field
--   
-- --

Functional dependencies

-- --
--   fd lt    -> n  t l
--   n  lt    -> fd t l
--   fd n t l -> lt
--   
removeRField :: forall fd n t lt l x. RmvRField fd n t lt l => OR lt x -> (t, OR l x) -- | insertCField @n @t: insert a field of type t -- at position n in a non-record single-constructor type. -- -- Inverse of removeCField. -- --

Details

-- --

Type parameters

-- --
--   n  :: Nat        -- Field position
--   t  :: Type       -- Field type
--   lt :: k -> Type  -- Row with    field
--   l  :: k -> Type  -- Row without field
--   x  :: k          -- Ignored
--   
-- --

Signature

-- --
--   (t, OR l x)  -- Field value × Data without field
--   ->
--   OR lt x      -- Data with field
--   
-- --

Functional dependencies

-- --
--   n lt  -> t l
--   n t l -> lt
--   
insertCField :: forall n t lt l x. InsCField n t lt l => (t, OR l x) -> OR lt x -- | Curried insertCField. insertCField' :: forall n t lt l x. InsCField n t lt l => t -> OR l x -> OR lt x -- | insertRField @"fdName" @n @t: insert a field named -- fdName of type t at position n in a record -- type. -- -- Inverse of removeRField. -- --

Details

-- --

Type parameters

-- --
--   fd :: Symbol     -- Field name
--   n  :: Nat        -- Field position
--   t  :: Type       -- Field type
--   lt :: k -> Type  -- Row with    field
--   l  :: k -> Type  -- Row without field
--   x  :: k          -- Ignored
--   
-- --

Signature

-- --
--   (t, OR l x)  -- Field value × Data without field
--   ->
--   OR lt x      -- Data with field
--   
-- --

Functional dependencies

-- --
--   fd lt    -> n  t l
--   n  lt    -> fd t l
--   fd n t l -> lt
--   
insertRField :: forall fd n t lt l x. InsRField fd n t lt l => (t, OR l x) -> OR lt x -- | Curried insertRField. insertRField' :: forall fd n t lt l x. InsRField fd n t lt l => t -> OR l x -> OR lt x -- | modifyCField @n @t @t': modify the field at position -- n in a non-record via a function f :: t -> t' -- (changing the type of the field). -- --

Details

-- --

Type parameters

-- --
--   n   :: Nat        -- Field position
--   t   :: Type       -- Initial field type
--   t'  :: Type       -- Final   field type
--   lt  :: k -> Type  -- Row with initial field
--   lt' :: k -> Type  -- Row with final   field
--   l   :: k -> Type  -- Row without field
--   x   :: k          -- Ignored
--   
-- --

Signature

-- --
--   (t -> t')  -- Field modification
--   ->
--   OR lt  x   -- Data with field t
--   ->
--   OR lt' x   -- Data with field t'
--   
-- --

Functional dependencies

-- --
--   n lt   -> t  l
--   n lt'  -> t' l
--   n t  l -> lt
--   n t' l -> lt'
--   
modifyCField :: forall n t t' lt lt' l x. ModCField n t t' lt lt' l => (t -> t') -> OR lt x -> OR lt' x -- | modifyRField @"fdName" @n @t @t': modify the field -- fdName at position n in a record via a function -- f :: t -> t' (changing the type of the field). -- --

Details

-- --

Type parameters

-- --
--   fd  :: Symbol     -- Field name
--   n   :: Nat        -- Field position
--   t   :: Type       -- Initial field type
--   t'  :: Type       -- Final   field type
--   lt  :: k -> Type  -- Row with initial field
--   lt' :: k -> Type  -- Row with final   field
--   l   :: k -> Type  -- Row without field
--   x   :: k          -- Ignored
--   
-- --

Signature

-- --
--   (t -> t')  -- Field modification
--   ->
--   OR lt  x   -- Data with field t
--   ->
--   OR lt' x   -- Data with field t'
--   
-- --

Functional dependencies

-- --
--   fd lt     -> n  t  l
--   fd lt'    -> n  t' l
--   n  lt     -> fd t  l
--   n  lt'    -> fd t' l
--   fd n t  l -> lt
--   fd n t' l -> lt'
--   
modifyRField :: forall fd n t t' lt lt' l x. ModRField fd n t t' lt lt' l => (t -> t') -> OR lt x -> OR lt' x -- | removeConstr @"C" @n @t: remove the n-th -- constructor, named C, with contents isomorphic to the tuple -- t. -- -- Inverse of insertConstr. -- --

Details

-- --

Type parameters

-- --
--   c   :: Symbol     -- Constructor name
--   t   :: Type       -- Tuple type to hold c's contents
--   n   :: Nat        -- Constructor position
--   lc  :: k -> Type  -- Row with    constructor
--   l   :: k -> Type  -- Row without constructor
--   l_t :: k -> Type  -- Field row of constructor c
--   x   :: k          -- Ignored
--   
-- --

Signature

-- --
--   OR lc x            -- Data with constructor
--   ->
--   Either t (OR l x)  -- Constructor (as a tuple) | Data without constructor
--   
-- --

Functional dependencies

-- --
--   c lc      -> n l l_t
--   n lc      -> c l l_t
--   c n l l_t -> lc
--   
-- -- Note that there is no dependency to determine t. removeConstr :: forall c n t lc l l_t x. RmvConstr c n t lc l l_t => OR lc x -> Either t (OR l x) -- | A variant of removeConstr that can infer the tuple type -- t to hold the contents of the removed constructor. -- -- See removeConstr. -- --

Details

-- --

Extra functional dependency

-- --
--   l_t -> t
--   
removeConstrT :: forall c n t lc l l_t x. RmvConstrT c n t lc l l_t => OR lc x -> Either t (OR l x) -- | insertConstr @"C" @n @t: insert a constructor -- C at position n with contents isomorphic to the -- tuple t. -- -- Inverse of removeConstr. -- --

Details

-- --

Type parameters

-- --
--   c   :: Symbol     -- Constructor name
--   t   :: Type       -- Tuple type to hold c's contents
--   n   :: Nat        -- Constructor position
--   lc  :: k -> Type  -- Row with    constructor
--   l   :: k -> Type  -- Row without constructor
--   l_t :: k -> Type  -- Field row of constructor c
--   x   :: k          -- Ignored
--   
-- --

Signature

-- --
--   Either t (OR l x)  -- Constructor (as a tuple) | Data without constructor
--   ->
--   OR lc x            -- Data with constructor
--   
-- --

Functional dependencies

-- --
--   c lc      -> n l l_t
--   n lc      -> c l l_t
--   c n l l_t -> lc
--   
-- -- Note that there is no dependency to determine t. insertConstr :: forall c n t lc l l_t x. InsConstr c n t lc l l_t => Either t (OR l x) -> OR lc x -- | A variant of insertConstr that can infer the tuple type -- t to hold the contents of the inserted constructor. -- -- See insertConstr. -- --

Details

-- --

Extra functional dependency

-- --
--   l_t -> t
--   
insertConstrT :: forall c n t lc l l_t x. InsConstrT c n t lc l l_t => Either t (OR l x) -> OR lc x -- | modifyConstr @"C" @n @t @t': modify the n-th -- constructor, named C, with contents isomorphic to the tuple -- t, to another tuple t'. -- --

Details

-- --

Type parameters

-- --
--   c    :: Symbol     -- Constructor name
--   t    :: Type       -- Tuple type to hold c's initial contents
--   t'   :: Type       -- Tuple type to hold c's final   contents
--   n    :: Nat        -- Constructor position
--   lc   :: k -> Type  -- Row with initial constructor
--   lc'  :: k -> Type  -- Row with final   constructor
--   l    :: k -> Type  -- Row without constructor
--   l_t  :: k -> Type  -- Initial field row of constructor c
--   l_t' :: k -> Type  -- Final   field row of constructor c
--   x    :: k          -- Ignored
--   
-- --

Signature

-- --
--   (t -> t')  -- Constructor modification
--   ->
--   OR lc  x   -- Data with initial constructor
--   ->
--   OR lc' x   -- Data with final   constructor
--   
-- --

Functional dependencies

-- --
--   c lc       -> n l l_t
--   c lc'      -> n l l_t'
--   n lc       -> c l l_t
--   n lc'      -> c l l_t'
--   c n l l_t  -> lc
--   c n l l_t' -> lc'
--   
-- -- Note that there is no dependency to determine t and -- t'. modifyConstr :: forall c n t t' lc lc' l l_t l_t' x. ModConstr c n t t' lc lc' l l_t l_t' => (t -> t') -> OR lc x -> OR lc' x -- | A variant of modifyConstr that can infer the tuple types -- t and t' to hold the contents of the inserted -- constructor. -- -- See modifyConstr. -- --

Details

-- --

Extra functional dependencies

-- --
--   l_t  -> t
--   l_t' -> t'
--   
modifyConstrT :: forall c n t t' lc lc' l l_t l_t' x. ModConstrT c n t t' lc lc' l l_t l_t' => (t -> t') -> OR lc x -> OR lc' x -- | This constraint means that the (unnamed) field row lt -- contains a field of type t at position n, and -- removing it yields row l. type RmvCField n t lt l = (GRemoveField n lt, CFieldSurgery n t lt l) -- | This constraint means that the record field row lt contains a -- field of type t named fd at position n, and -- removing it yields row l. type RmvRField fd n t lt l = (GRemoveField n lt, RFieldSurgery fd n t lt l) -- | This constraint means that inserting a field t at position -- n in the (unnamed) field row l yields row -- lt. type InsCField n t lt l = (GInsertField n lt, CFieldSurgery n t lt l) -- | This constraint means that inserting a field t named -- fd at position n in the record field row l -- yields row lt. type InsRField fd n t lt l = (GInsertField n lt, RFieldSurgery fd n t lt l) -- | This constraint means that modifying a field t to t' -- at position n in the (unnamed) field row lt yields -- row lt'. l is the row of fields common to -- lt and lt'. type ModCField n t t' lt lt' l = (RmvCField n t lt l, InsCField n t' lt' l) -- | This constraint means that modifying a field t named -- fd at position n to t' in the record field -- row lt yields row lt'. l is the row of -- fields common to lt and lt'. type ModRField fd n t t' lt lt' l = (RmvRField fd n t lt l, InsRField fd n t' lt' l) -- | This constraint means that the constructor row lc contains a -- constructor named c at position n, and removing it -- from lc yields row l. Furthermore, constructor -- c contains a field row l_t compatible with the tuple -- type t. type RmvConstr c n t lc l l_t = (GRemoveConstr n lc, GArborify (Arborify l_t), ConstrSurgery c n t lc l l_t) -- | A variant of RmvConstr allowing t to be inferred. type RmvConstrT c n t lc l l_t = (RmvConstr c n t lc l l_t, IsTuple (Arity l_t) t) -- | This constraint means that inserting a constructor c at -- position n in the constructor row l yields row -- lc. Furthermore, constructor c contains a field row -- l_t compatible with the tuple type t. type InsConstr c n t lc l l_t = (GInsertConstr n lc, GLinearize (Arborify l_t), ConstrSurgery c n t lc l l_t) -- | A variant of InsConstr allowing t to be inferred. type InsConstrT c n t lc l l_t = (InsConstr c n t lc l l_t, IsTuple (Arity l_t) t) -- | This constraint means that the constructor row lc contains a -- constructor named c at position n of type isomorphic -- to t, and modifying it to t' yields row -- lc'. type ModConstr c n t t' lc lc' l l_t l_t' = (RmvConstr c n t lc l l_t, InsConstr c n t' lc' l l_t') -- | A variant of ModConstr allowing t and t' to -- be inferred. type ModConstrT c n t t' lc lc' l l_t l_t' = (ModConstr c n t t' lc lc' l l_t l_t', IsTuple (Arity l_t) t, IsTuple (Arity l_t') t') type FieldSurgery n t lt l = (t ~ Eval (FieldTypeAt n lt), l ~ Eval (RemoveField n lt)) type CFieldSurgery n t lt l = (lt ~ Eval (InsertField n 'Nothing t l), FieldSurgery n t lt l) type RFieldSurgery fd n t lt l = (n ~ Eval (FieldIndex fd lt), lt ~ Eval (InsertField n ( 'Just fd) t l), FieldSurgery n t lt l) type ConstrSurgery c n t lc l l_t = (Generic t, MatchFields (UnM1 (Rep t)) (Arborify l_t), Coercible (Arborify l_t) (Rep t), n ~ Eval (ConstrIndex c lc), c ~ MetaConsName (MetaOf l_t), l_t ~ Linearize (Arborify l_t), l_t ~ Eval (ConstrAt n lc), lc ~ Eval (InsertConstr n l_t l), l ~ Eval (RemoveConstr n lc)) type family Linearize (f :: k -> *) :: k -> * type family LinearizeSum (f :: k -> *) (tl :: k -> *) :: k -> * type family LinearizeProduct (f :: k -> *) (tl :: k -> *) :: k -> * class GLinearize f gLinearize :: GLinearize f => f x -> Linearize f x class GLinearizeSum f tl gLinearizeSum :: GLinearizeSum f tl => Either (f x) (tl x) -> LinearizeSum f tl x class GLinearizeProduct f tl gLinearizeProduct :: GLinearizeProduct f tl => f x -> tl x -> LinearizeProduct f tl x class GArborify f gArborify :: GArborify f => Linearize f x -> f x class GArborifySum f tl gArborifySum :: GArborifySum f tl => LinearizeSum f tl x -> Either (f x) (tl x) class GArborifyProduct f tl gArborifyProduct :: GArborifyProduct f tl => LinearizeProduct f tl x -> (f x, tl x) type family Arborify (f :: k -> *) :: k -> * data ArborifySum (n :: Nat) (f :: k -> *) :: (k -> *) -> * data ArborifyProduct (n :: Nat) (f :: k -> *) :: (k -> *) -> * type Arborify' arb op n nDiv2 f g = (Uncurry (Pure2 op) <=< Bimap (arb nDiv2) (arb (n - nDiv2)) <=< SplitAt nDiv2) (op f g) data SplitAt :: Nat -> (k -> *) -> (k -> *, k -> *) -> * data FieldTypeAt (n :: Nat) (f :: k -> *) :: * -> * type family FieldTypeOf (f :: k -> *) :: * data RemoveField (n :: Nat) (f :: k -> *) :: (k -> *) -> * type DefaultMetaSel field = 'MetaSel field 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy data InsertField (n :: Nat) (fd :: Maybe Symbol) (t :: *) (f :: k -> *) :: (k -> *) -> * data Succ :: Nat -> Nat -> * -- | Position of a record field data FieldIndex (field :: Symbol) (f :: k -> *) :: Nat -> * -- | Number of fields of a single constructor type family Arity (f :: k -> *) :: Nat -- | Number of constructors of a data type type family CoArity (f :: k -> *) :: Nat class GRemoveField (n :: Nat) f gRemoveField :: GRemoveField n f => f x -> (Eval (FieldTypeAt n f), Eval (RemoveField n f) x) class GInsertField (n :: Nat) f gInsertField :: GInsertField n f => Eval (FieldTypeAt n f) -> Eval (RemoveField n f) x -> f x data ConstrAt (n :: Nat) (f :: k -> *) :: (k -> *) -> * data RemoveConstr (n :: Nat) (f :: k -> *) :: (k -> *) -> * data InsertConstr (n :: Nat) (t :: k -> *) (f :: k -> *) :: (k -> *) -> * data ConstrIndex (con :: Symbol) (f :: k -> *) :: Nat -> * class GRemoveConstr (n :: Nat) f gRemoveConstr :: GRemoveConstr n f => f x -> Either (Eval (ConstrAt n f) x) (Eval (RemoveConstr n f) x) class GInsertConstr (n :: Nat) f gInsertConstr :: GInsertConstr n f => Either (Eval (ConstrAt n f) x) (Eval (RemoveConstr n f) x) -> f x -- | Generate equality constraints between fields of two matching generic -- representations. class MatchFields (f :: k -> *) (g :: k -> *) class IsTuple (n :: Nat) (t :: k) instance (t Data.Type.Equality.~ ()) => Generic.Data.Surgery.Internal.IsTuple 0 t instance (t Data.Type.Equality.~ Data.Functor.Identity.Identity a) => Generic.Data.Surgery.Internal.IsTuple 1 t instance (t Data.Type.Equality.~ (a, b)) => Generic.Data.Surgery.Internal.IsTuple 2 t instance (t Data.Type.Equality.~ (a, b, c)) => Generic.Data.Surgery.Internal.IsTuple 3 t instance (t Data.Type.Equality.~ (a, b, c, d)) => Generic.Data.Surgery.Internal.IsTuple 4 t instance (t Data.Type.Equality.~ (a, b, c, d, e)) => Generic.Data.Surgery.Internal.IsTuple 5 t instance (t Data.Type.Equality.~ (a, b, c, d, e, f)) => Generic.Data.Surgery.Internal.IsTuple 6 t instance (t Data.Type.Equality.~ (a, b, c, d, e, f, g)) => Generic.Data.Surgery.Internal.IsTuple 7 t instance forall k (g' :: k -> *) (d :: GHC.Generics.Meta) (g :: k -> *) (f :: k -> *) (c :: GHC.Generics.Meta). (g' Data.Type.Equality.~ GHC.Generics.M1 GHC.Generics.D d g, Generic.Data.Surgery.Internal.MatchFields f g) => Generic.Data.Surgery.Internal.MatchFields (GHC.Generics.M1 GHC.Generics.D c f) g' instance forall k (g' :: k -> *) (_cn :: GHC.Types.Symbol) (_s :: GHC.Generics.FixityI) (_t :: GHC.Types.Bool) (g :: k -> *) (f :: k -> *) (c :: GHC.Generics.Meta). (g' Data.Type.Equality.~ GHC.Generics.M1 GHC.Generics.C ('GHC.Generics.MetaCons _cn _s _t) g, Generic.Data.Surgery.Internal.MatchFields f g) => Generic.Data.Surgery.Internal.MatchFields (GHC.Generics.M1 GHC.Generics.C c f) g' instance forall k (g' :: k -> *) (d :: GHC.Generics.Meta) (g :: k -> *) (f :: k -> *) (c :: GHC.Generics.Meta). (g' Data.Type.Equality.~ GHC.Generics.M1 GHC.Generics.S d g, Generic.Data.Surgery.Internal.MatchFields f g) => Generic.Data.Surgery.Internal.MatchFields (GHC.Generics.M1 GHC.Generics.S c f) g' instance forall k (g' :: k -> *) (g1 :: k -> *) (g2 :: k -> *) (f1 :: k -> *) (f2 :: k -> *). (g' Data.Type.Equality.~ (g1 GHC.Generics.:+: g2), Generic.Data.Surgery.Internal.MatchFields f1 g1, Generic.Data.Surgery.Internal.MatchFields f2 g2) => Generic.Data.Surgery.Internal.MatchFields (f1 GHC.Generics.:+: f2) g' instance forall k (g' :: k -> *) (g1 :: k -> *) (g2 :: k -> *) (f1 :: k -> *) (f2 :: k -> *). (g' Data.Type.Equality.~ (g1 GHC.Generics.:*: g2), Generic.Data.Surgery.Internal.MatchFields f1 g1, Generic.Data.Surgery.Internal.MatchFields f2 g2) => Generic.Data.Surgery.Internal.MatchFields (f1 GHC.Generics.:*: f2) g' instance forall k (g' :: k -> *) j a i. (g' Data.Type.Equality.~ GHC.Generics.K1 j a) => Generic.Data.Surgery.Internal.MatchFields (GHC.Generics.K1 i a) g' instance forall k (g' :: k -> *). (g' Data.Type.Equality.~ GHC.Generics.U1) => Generic.Data.Surgery.Internal.MatchFields GHC.Generics.U1 g' instance forall k (g' :: k -> *). (g' Data.Type.Equality.~ GHC.Generics.V1) => Generic.Data.Surgery.Internal.MatchFields GHC.Generics.V1 g' instance forall k (n :: GHC.Types.Nat) (f :: k -> *) i (c :: GHC.Generics.Meta). Generic.Data.Surgery.Internal.GInsertConstr n f => Generic.Data.Surgery.Internal.GInsertConstr n (GHC.Generics.M1 i c f) instance forall k (n :: GHC.Types.Nat) (g :: k -> *) (f :: k -> *). (Fcf.If (n Data.Type.Equality.== 0) (() :: Constraint) (Generic.Data.Surgery.Internal.GInsertConstr (n GHC.TypeNats.- 1) g), Fcf.IsBool (n Data.Type.Equality.== 0)) => Generic.Data.Surgery.Internal.GInsertConstr n (f GHC.Generics.:+: g) instance forall k (n :: GHC.Types.Nat) (f :: k -> *) i (c :: GHC.Generics.Meta). Generic.Data.Surgery.Internal.GRemoveConstr n f => Generic.Data.Surgery.Internal.GRemoveConstr n (GHC.Generics.M1 i c f) instance forall k (n :: GHC.Types.Nat) (g :: k -> *) (f :: k -> *). (Fcf.If (n Data.Type.Equality.== 0) (() :: Constraint) (Generic.Data.Surgery.Internal.GRemoveConstr (n GHC.TypeNats.- 1) g), Fcf.IsBool (n Data.Type.Equality.== 0)) => Generic.Data.Surgery.Internal.GRemoveConstr n (f GHC.Generics.:+: g) instance forall k (n :: GHC.Types.Nat) (f :: k -> *) i (c :: GHC.Generics.Meta). Generic.Data.Surgery.Internal.GInsertField n f => Generic.Data.Surgery.Internal.GInsertField n (GHC.Generics.M1 i c f) instance forall k (n :: GHC.Types.Nat) (f :: k -> *). Generic.Data.Surgery.Internal.GInsertField n f => Generic.Data.Surgery.Internal.GInsertField n (f GHC.Generics.:+: GHC.Generics.V1) instance forall k (n :: GHC.Types.Nat) (g :: k -> *) s (m :: GHC.Generics.Meta) i t. (Fcf.If (n Data.Type.Equality.== 0) (() :: Constraint) (Generic.Data.Surgery.Internal.GInsertField (n GHC.TypeNats.- 1) g), Fcf.IsBool (n Data.Type.Equality.== 0)) => Generic.Data.Surgery.Internal.GInsertField n (GHC.Generics.M1 s m (GHC.Generics.K1 i t) GHC.Generics.:*: g) instance forall k (n :: GHC.Types.Nat) (f :: k -> *) i (c :: GHC.Generics.Meta). Generic.Data.Surgery.Internal.GRemoveField n f => Generic.Data.Surgery.Internal.GRemoveField n (GHC.Generics.M1 i c f) instance forall k (n :: GHC.Types.Nat) (f :: k -> *). Generic.Data.Surgery.Internal.GRemoveField n f => Generic.Data.Surgery.Internal.GRemoveField n (f GHC.Generics.:+: GHC.Generics.V1) instance forall k (n :: GHC.Types.Nat) (g :: k -> *) s (m :: GHC.Generics.Meta) i t. (Fcf.If (n Data.Type.Equality.== 0) (() :: Constraint) (Generic.Data.Surgery.Internal.GRemoveField (n GHC.TypeNats.- 1) g), Fcf.IsBool (n Data.Type.Equality.== 0)) => Generic.Data.Surgery.Internal.GRemoveField n (GHC.Generics.M1 s m (GHC.Generics.K1 i t) GHC.Generics.:*: g) instance forall k (f :: k -> *) (m :: GHC.Generics.Meta). Generic.Data.Surgery.Internal.GArborifyProduct f GHC.Generics.U1 => Generic.Data.Surgery.Internal.GArborify (GHC.Generics.M1 GHC.Generics.C m f) instance forall k (f :: k -> *) c (m :: GHC.Generics.Meta) (tl :: k -> *). Generic.Data.Surgery.Internal.GArborifyProduct f GHC.Generics.U1 => Generic.Data.Surgery.Internal.GArborifySum (GHC.Generics.M1 c m f) tl instance forall k (tl :: k -> *). Generic.Data.Surgery.Internal.GArborifyProduct GHC.Generics.U1 tl instance forall k (g :: k -> *) (tl :: k -> *) (f :: k -> *). (Generic.Data.Surgery.Internal.GArborifyProduct g tl, Generic.Data.Surgery.Internal.GArborifyProduct f (Generic.Data.Surgery.Internal.LinearizeProduct g tl)) => Generic.Data.Surgery.Internal.GArborifyProduct (f GHC.Generics.:*: g) tl instance forall k s (m :: GHC.Generics.Meta) (f :: k -> *) (tl :: k -> *). Generic.Data.Surgery.Internal.GArborifyProduct (GHC.Generics.M1 s m f) tl instance forall k (f :: k -> *) (m :: GHC.Generics.Meta). Generic.Data.Surgery.Internal.GArborifySum f GHC.Generics.V1 => Generic.Data.Surgery.Internal.GArborify (GHC.Generics.M1 GHC.Generics.D m f) instance forall k (tl :: k -> *). Generic.Data.Surgery.Internal.GArborifySum GHC.Generics.V1 tl instance forall k (g :: k -> *) (tl :: k -> *) (f :: k -> *). (Generic.Data.Surgery.Internal.GArborifySum g tl, Generic.Data.Surgery.Internal.GArborifySum f (Generic.Data.Surgery.Internal.LinearizeSum g tl)) => Generic.Data.Surgery.Internal.GArborifySum (f GHC.Generics.:+: g) tl instance forall k (f :: k -> *) (m :: GHC.Generics.Meta). Generic.Data.Surgery.Internal.GLinearizeProduct f GHC.Generics.U1 => Generic.Data.Surgery.Internal.GLinearize (GHC.Generics.M1 GHC.Generics.C m f) instance forall k (f :: k -> *) c (m :: GHC.Generics.Meta) (tl :: k -> *). Generic.Data.Surgery.Internal.GLinearizeProduct f GHC.Generics.U1 => Generic.Data.Surgery.Internal.GLinearizeSum (GHC.Generics.M1 c m f) tl instance forall k (tl :: k -> *). Generic.Data.Surgery.Internal.GLinearizeProduct GHC.Generics.U1 tl instance forall k (g :: k -> *) (tl :: k -> *) (f :: k -> *). (Generic.Data.Surgery.Internal.GLinearizeProduct g tl, Generic.Data.Surgery.Internal.GLinearizeProduct f (Generic.Data.Surgery.Internal.LinearizeProduct g tl)) => Generic.Data.Surgery.Internal.GLinearizeProduct (f GHC.Generics.:*: g) tl instance forall k s (m :: GHC.Generics.Meta) (f :: k -> *) (tl :: k -> *). Generic.Data.Surgery.Internal.GLinearizeProduct (GHC.Generics.M1 s m f) tl instance forall k (f :: k -> *) (m :: GHC.Generics.Meta). Generic.Data.Surgery.Internal.GLinearizeSum f GHC.Generics.V1 => Generic.Data.Surgery.Internal.GLinearize (GHC.Generics.M1 GHC.Generics.D m f) instance forall k (tl :: k -> *). Generic.Data.Surgery.Internal.GLinearizeSum GHC.Generics.V1 tl instance forall k (g :: k -> *) (tl :: k -> *) (f :: k -> *). (Generic.Data.Surgery.Internal.GLinearizeSum g tl, Generic.Data.Surgery.Internal.GLinearizeSum f (Generic.Data.Surgery.Internal.LinearizeSum g tl)) => Generic.Data.Surgery.Internal.GLinearizeSum (f GHC.Generics.:+: g) tl -- | Surgery for generic data types: remove and insert constructors and -- fields. -- -- Functions in this module are expected to be used with visible type -- applications. Surgeries have a lot of type parameters, but usually -- only the first one to three type arguments need to be passed via -- TypeApplications. Functions are annotated with "functional -- dependencies", with a meaning similar to the homonymous GHC extension -- for type classes (click on "Details" under each function to see -- those). -- -- Remember that not all parameters to the left of a functional -- dependency arrow need to be annotated explicitly to determine those on -- the right. Some can also be inferred from the context. -- -- Note that constructors and fields are indexed from zero. module Generic.Data.Surgery -- | Synthetic data type. -- -- A wrapper to view a generic Rep as the datatype it's supposed -- to represent, without needing a declaration. data Data (r :: Type -> Type) p -- | Conversion between a generic type and the synthetic type made using -- its representation. toData :: Generic a => a -> Data (Rep a) p -- | Inverse of fromData. fromData :: Generic a => Data (Rep a) p -> a -- | A sterile Operating Room, where generic data comes to be -- altered. -- -- Generic representation in a simplified shape l at the type -- level (reusing the constructors from GHC.Generics for -- convenience). This representation makes it easy to modify fields and -- constructors. -- -- We may also refer to the representation l as a "row" of -- constructors, if it represents a sum type, otherwise it is a "row" of -- unnamed fields or record fields for single-constructor types. -- -- x corresponds to the last parameter of Rep, and is -- currently ignored by this module (no support for Generic1). data OR (l :: k -> Type) (x :: k) -- | Move fresh data to the Operating Room, where surgeries can be -- applied. -- -- Convert a generic type to a generic representation. -- --

Details

-- --

Type parameters

-- --
--   a :: Type       -- Generic type
--   l :: k -> Type  -- Generic representation (simplified)
--   x :: k          -- Ignored
--   
-- --

Functional dependencies

-- --
--   a -> l
--   
toOR :: forall a l x. (Generic a, ToORRep a l) => a -> OR l x -- | Move altered data out of the Operating Room, to be consumed by -- some generic function. -- -- Convert a generic representation to a "synthetic" type that behaves -- like a generic type. -- --

Details

-- --

Type parameters

-- --
--   f :: k -> Type  -- Generic representation (proper)
--   l :: k -> Type  -- Generic representation (simplified)
--   x :: k          -- Ignored
--   
-- --

Functional dependencies

-- --
--   f -> l
--   l -> f
--   
-- --

Implementation details

-- -- The synthesized representation is made of balanced binary trees, -- corresponding closely to what GHC would generate for an actual data -- type. -- -- That structure assumed by at least one piece of code out there -- (aeson). fromOR' :: forall f l x. FromOR f l => OR l x -> Data f x -- | Move altered data, produced by some generic function, to the -- operating room. -- -- The inverse of fromOR'. -- --

Details

-- --

Type parameters

-- --
--   f :: k -> Type  -- Generic representation (proper)
--   l :: k -> Type  -- Generic representation (simplified)
--   x :: k          -- Ignored
--   
-- --

Functional dependencies

-- --
--   f -> l
--   l -> f
--   
toOR' :: forall f l x. ToOR f l => Data f x -> OR l x -- | Move restored data out of the Operating Room and back to the -- real world. -- -- The inverse of toOR. -- -- It may be useful to annotate the output type of fromOR, since -- the rest of the type depends on it and the only way to infer it -- otherwise is from the context. The following annotations are possible: -- --
--   fromOR :: OROf a -> a
--   fromOR @a  -- with TypeApplications
--   
-- --

Details

-- --

Type parameters

-- --
--   a :: Type       -- Generic type
--   l :: k -> Type  -- Generic representation (simplified)
--   x :: k          -- Ignored
--   
-- --

Functional dependencies

-- --
--   a -> l
--   
fromOR :: forall a l x. (Generic a, FromORRep a l) => OR l x -> a -- | The simplified generic representation type of type a, that -- toOR and fromOR convert to and from. type OROf a = OR (Linearize (Rep a)) () -- | removeCField @n @t: remove the n-th field, of -- type t, in a non-record single-constructor type. -- -- Inverse of insertCField. -- --

Details

-- --

Type parameters

-- --
--   n  :: Nat        -- Field position
--   t  :: Type       -- Field type
--   lt :: k -> Type  -- Row with    field
--   l  :: k -> Type  -- Row without field
--   x  :: k          -- Ignored
--   
-- --

Signature

-- --
--   OR lt x      -- Data with field
--   ->
--   (t, OR l x)  -- Field value × Data without field
--   
-- --

Functional dependencies

-- --
--   n lt  -> t l
--   n t l -> lt
--   
removeCField :: forall n t lt l x. RmvCField n t lt l => OR lt x -> (t, OR l x) -- | insertCField @n @t: insert a field of type t -- at position n in a non-record single-constructor type. -- -- Inverse of removeCField. -- --

Details

-- --

Type parameters

-- --
--   n  :: Nat        -- Field position
--   t  :: Type       -- Field type
--   lt :: k -> Type  -- Row with    field
--   l  :: k -> Type  -- Row without field
--   x  :: k          -- Ignored
--   
-- --

Signature

-- --
--   (t, OR l x)  -- Field value × Data without field
--   ->
--   OR lt x      -- Data with field
--   
-- --

Functional dependencies

-- --
--   n lt  -> t l
--   n t l -> lt
--   
insertCField :: forall n t lt l x. InsCField n t lt l => (t, OR l x) -> OR lt x -- | Curried insertCField. insertCField' :: forall n t lt l x. InsCField n t lt l => t -> OR l x -> OR lt x -- | modifyCField @n @t @t': modify the field at position -- n in a non-record via a function f :: t -> t' -- (changing the type of the field). -- --

Details

-- --

Type parameters

-- --
--   n   :: Nat        -- Field position
--   t   :: Type       -- Initial field type
--   t'  :: Type       -- Final   field type
--   lt  :: k -> Type  -- Row with initial field
--   lt' :: k -> Type  -- Row with final   field
--   l   :: k -> Type  -- Row without field
--   x   :: k          -- Ignored
--   
-- --

Signature

-- --
--   (t -> t')  -- Field modification
--   ->
--   OR lt  x   -- Data with field t
--   ->
--   OR lt' x   -- Data with field t'
--   
-- --

Functional dependencies

-- --
--   n lt   -> t  l
--   n lt'  -> t' l
--   n t  l -> lt
--   n t' l -> lt'
--   
modifyCField :: forall n t t' lt lt' l x. ModCField n t t' lt lt' l => (t -> t') -> OR lt x -> OR lt' x -- | removeRField @"fdName" @n @t: remove the field -- fdName at position n of type t in a record -- type. -- -- Inverse of insertRField. -- --

Details

-- --

Type parameters

-- --
--   fd :: Symbol     -- Field name
--   n  :: Nat        -- Field position
--   t  :: Type       -- Field type
--   lt :: k -> Type  -- Row with    field
--   l  :: k -> Type  -- Row without field
--   x  :: k          -- Ignored
--   
-- --

Signature

-- --
--   OR lt x      -- Data with field
--   ->
--   (t, OR l x)  -- Field value × Data without field
--   
-- --

Functional dependencies

-- --
--   fd lt    -> n  t l
--   n  lt    -> fd t l
--   fd n t l -> lt
--   
removeRField :: forall fd n t lt l x. RmvRField fd n t lt l => OR lt x -> (t, OR l x) -- | insertRField @"fdName" @n @t: insert a field named -- fdName of type t at position n in a record -- type. -- -- Inverse of removeRField. -- --

Details

-- --

Type parameters

-- --
--   fd :: Symbol     -- Field name
--   n  :: Nat        -- Field position
--   t  :: Type       -- Field type
--   lt :: k -> Type  -- Row with    field
--   l  :: k -> Type  -- Row without field
--   x  :: k          -- Ignored
--   
-- --

Signature

-- --
--   (t, OR l x)  -- Field value × Data without field
--   ->
--   OR lt x      -- Data with field
--   
-- --

Functional dependencies

-- --
--   fd lt    -> n  t l
--   n  lt    -> fd t l
--   fd n t l -> lt
--   
insertRField :: forall fd n t lt l x. InsRField fd n t lt l => (t, OR l x) -> OR lt x -- | Curried insertRField. insertRField' :: forall fd n t lt l x. InsRField fd n t lt l => t -> OR l x -> OR lt x -- | modifyRField @"fdName" @n @t @t': modify the field -- fdName at position n in a record via a function -- f :: t -> t' (changing the type of the field). -- --

Details

-- --

Type parameters

-- --
--   fd  :: Symbol     -- Field name
--   n   :: Nat        -- Field position
--   t   :: Type       -- Initial field type
--   t'  :: Type       -- Final   field type
--   lt  :: k -> Type  -- Row with initial field
--   lt' :: k -> Type  -- Row with final   field
--   l   :: k -> Type  -- Row without field
--   x   :: k          -- Ignored
--   
-- --

Signature

-- --
--   (t -> t')  -- Field modification
--   ->
--   OR lt  x   -- Data with field t
--   ->
--   OR lt' x   -- Data with field t'
--   
-- --

Functional dependencies

-- --
--   fd lt     -> n  t  l
--   fd lt'    -> n  t' l
--   n  lt     -> fd t  l
--   n  lt'    -> fd t' l
--   fd n t  l -> lt
--   fd n t' l -> lt'
--   
modifyRField :: forall fd n t t' lt lt' l x. ModRField fd n t t' lt lt' l => (t -> t') -> OR lt x -> OR lt' x -- | removeConstr @"C" @n @t: remove the n-th -- constructor, named C, with contents isomorphic to the tuple -- t. -- -- Inverse of insertConstr. -- --

Details

-- --

Type parameters

-- --
--   c   :: Symbol     -- Constructor name
--   t   :: Type       -- Tuple type to hold c's contents
--   n   :: Nat        -- Constructor position
--   lc  :: k -> Type  -- Row with    constructor
--   l   :: k -> Type  -- Row without constructor
--   l_t :: k -> Type  -- Field row of constructor c
--   x   :: k          -- Ignored
--   
-- --

Signature

-- --
--   OR lc x            -- Data with constructor
--   ->
--   Either t (OR l x)  -- Constructor (as a tuple) | Data without constructor
--   
-- --

Functional dependencies

-- --
--   c lc      -> n l l_t
--   n lc      -> c l l_t
--   c n l l_t -> lc
--   
-- -- Note that there is no dependency to determine t. removeConstr :: forall c n t lc l l_t x. RmvConstr c n t lc l l_t => OR lc x -> Either t (OR l x) -- | insertConstr @"C" @n @t: insert a constructor -- C at position n with contents isomorphic to the -- tuple t. -- -- Inverse of removeConstr. -- --

Details

-- --

Type parameters

-- --
--   c   :: Symbol     -- Constructor name
--   t   :: Type       -- Tuple type to hold c's contents
--   n   :: Nat        -- Constructor position
--   lc  :: k -> Type  -- Row with    constructor
--   l   :: k -> Type  -- Row without constructor
--   l_t :: k -> Type  -- Field row of constructor c
--   x   :: k          -- Ignored
--   
-- --

Signature

-- --
--   Either t (OR l x)  -- Constructor (as a tuple) | Data without constructor
--   ->
--   OR lc x            -- Data with constructor
--   
-- --

Functional dependencies

-- --
--   c lc      -> n l l_t
--   n lc      -> c l l_t
--   c n l l_t -> lc
--   
-- -- Note that there is no dependency to determine t. insertConstr :: forall c n t lc l l_t x. InsConstr c n t lc l l_t => Either t (OR l x) -> OR lc x -- | modifyConstr @"C" @n @t @t': modify the n-th -- constructor, named C, with contents isomorphic to the tuple -- t, to another tuple t'. -- --

Details

-- --

Type parameters

-- --
--   c    :: Symbol     -- Constructor name
--   t    :: Type       -- Tuple type to hold c's initial contents
--   t'   :: Type       -- Tuple type to hold c's final   contents
--   n    :: Nat        -- Constructor position
--   lc   :: k -> Type  -- Row with initial constructor
--   lc'  :: k -> Type  -- Row with final   constructor
--   l    :: k -> Type  -- Row without constructor
--   l_t  :: k -> Type  -- Initial field row of constructor c
--   l_t' :: k -> Type  -- Final   field row of constructor c
--   x    :: k          -- Ignored
--   
-- --

Signature

-- --
--   (t -> t')  -- Constructor modification
--   ->
--   OR lc  x   -- Data with initial constructor
--   ->
--   OR lc' x   -- Data with final   constructor
--   
-- --

Functional dependencies

-- --
--   c lc       -> n l l_t
--   c lc'      -> n l l_t'
--   n lc       -> c l l_t
--   n lc'      -> c l l_t'
--   c n l l_t  -> lc
--   c n l l_t' -> lc'
--   
-- -- Note that there is no dependency to determine t and -- t'. modifyConstr :: forall c n t t' lc lc' l l_t l_t' x. ModConstr c n t t' lc lc' l l_t l_t' => (t -> t') -> OR lc x -> OR lc' x -- | A variant of removeConstr that can infer the tuple type -- t to hold the contents of the removed constructor. -- -- See removeConstr. -- --

Details

-- --

Extra functional dependency

-- --
--   l_t -> t
--   
removeConstrT :: forall c n t lc l l_t x. RmvConstrT c n t lc l l_t => OR lc x -> Either t (OR l x) -- | A variant of insertConstr that can infer the tuple type -- t to hold the contents of the inserted constructor. -- -- See insertConstr. -- --

Details

-- --

Extra functional dependency

-- --
--   l_t -> t
--   
insertConstrT :: forall c n t lc l l_t x. InsConstrT c n t lc l l_t => Either t (OR l x) -> OR lc x -- | A variant of modifyConstr that can infer the tuple types -- t and t' to hold the contents of the inserted -- constructor. -- -- See modifyConstr. -- --

Details

-- --

Extra functional dependencies

-- --
--   l_t  -> t
--   l_t' -> t'
--   
modifyConstrT :: forall c n t t' lc lc' l l_t l_t' x. ModConstrT c n t t' lc lc' l l_t l_t' => (t -> t') -> OR lc x -> OR lc' x -- | This constraint means that a is convertible to its -- simplified generic representation. Implies OROf a ~ -- OR l (). type ToORRep a l = ToOR (Rep a) l -- | Similar to ToORRep, but as a constraint on the standard generic -- representation of a directly, f ~ Rep a. type ToOR f l = (GLinearize f, Linearize f ~ l, f ~ Arborify l) -- | This constraint means that a is convertible from its -- simplified generic representation. Implies OROf a ~ -- OR l (). type FromORRep a l = FromOR (Rep a) l -- | Similar to FromORRep, but as a constraint on the standard -- generic representation of a directly, f ~ Rep -- a. type FromOR f l = (GArborify f, Linearize f ~ l, f ~ Arborify l) -- | This constraint means that the (unnamed) field row lt -- contains a field of type t at position n, and -- removing it yields row l. type RmvCField n t lt l = (GRemoveField n lt, CFieldSurgery n t lt l) -- | This constraint means that inserting a field t at position -- n in the (unnamed) field row l yields row -- lt. type InsCField n t lt l = (GInsertField n lt, CFieldSurgery n t lt l) -- | This constraint means that modifying a field t to t' -- at position n in the (unnamed) field row lt yields -- row lt'. l is the row of fields common to -- lt and lt'. type ModCField n t t' lt lt' l = (RmvCField n t lt l, InsCField n t' lt' l) -- | This constraint means that the record field row lt contains a -- field of type t named fd at position n, and -- removing it yields row l. type RmvRField fd n t lt l = (GRemoveField n lt, RFieldSurgery fd n t lt l) -- | This constraint means that inserting a field t named -- fd at position n in the record field row l -- yields row lt. type InsRField fd n t lt l = (GInsertField n lt, RFieldSurgery fd n t lt l) -- | This constraint means that modifying a field t named -- fd at position n to t' in the record field -- row lt yields row lt'. l is the row of -- fields common to lt and lt'. type ModRField fd n t t' lt lt' l = (RmvRField fd n t lt l, InsRField fd n t' lt' l) -- | This constraint means that the constructor row lc contains a -- constructor named c at position n, and removing it -- from lc yields row l. Furthermore, constructor -- c contains a field row l_t compatible with the tuple -- type t. type RmvConstr c n t lc l l_t = (GRemoveConstr n lc, GArborify (Arborify l_t), ConstrSurgery c n t lc l l_t) -- | This constraint means that inserting a constructor c at -- position n in the constructor row l yields row -- lc. Furthermore, constructor c contains a field row -- l_t compatible with the tuple type t. type InsConstr c n t lc l l_t = (GInsertConstr n lc, GLinearize (Arborify l_t), ConstrSurgery c n t lc l l_t) -- | This constraint means that the constructor row lc contains a -- constructor named c at position n of type isomorphic -- to t, and modifying it to t' yields row -- lc'. type ModConstr c n t t' lc lc' l l_t l_t' = (RmvConstr c n t lc l l_t, InsConstr c n t' lc' l l_t') -- | A variant of RmvConstr allowing t to be inferred. type RmvConstrT c n t lc l l_t = (RmvConstr c n t lc l l_t, IsTuple (Arity l_t) t) -- | A variant of InsConstr allowing t to be inferred. type InsConstrT c n t lc l l_t = (InsConstr c n t lc l l_t, IsTuple (Arity l_t) t) -- | A variant of ModConstr allowing t and t' to -- be inferred. type ModConstrT c n t t' lc lc' l l_t l_t' = (ModConstr c n t t' lc lc' l l_t l_t', IsTuple (Arity l_t) t, IsTuple (Arity l_t') t')