The kind of rows. This type is only used as a datakind. A row is a typelevel entity telling us which symbols are associated with which types.
Modulerow-types-1.0.1.2Haskell2010
Data.Row.Internal
This module implements the internals of open records and variants.
- 10 types
- 10 classes
- 4 values
- Packagerow-types-1.0.1.2
- Exports41
- LanguageHaskell2010
- LicenceMIT
- SourceInternal.hs
Rows
6 declarationsA label
This class gives the string associated with a type-level symbol. There are instances of the class for every concrete literal: "hello", etc.
The kind of elements of rows. Each element is a label and its associated type.
Instances16BiForall, Forall, GenericRec, GenericVar, RepRec, RepVar, …
BiForall ('R '[]) ('R '[]) c1Defined in row-types-1.0.1.2 · Data.Row.Internal(KnownSymbol ℓ, c τ1 τ2, BiForall ('R ρ1) ('R ρ2) c, FrontExtends ℓ τ1 ('R ρ1), FrontExtends ℓ τ2 ('R ρ2), AllUniqueLabels (Extend ℓ τ1 ('R ρ1)), AllUniqueLabels (Extend ℓ τ2 ('R ρ2))) => BiForall ('R ((ℓ ':-> τ1) ': ρ1)) ('R ((ℓ ':-> τ2) ': ρ2)) cDefined in row-types-1.0.1.2 · Data.Row.InternalForall ('R '[]) cDefined in row-types-1.0.1.2 · Data.Row.Internal(KnownSymbol ℓ, c τ, Forall ('R ρ) c, FrontExtends ℓ τ ('R ρ), AllUniqueLabels (Extend ℓ τ ('R ρ))) => Forall ('R ((ℓ ':-> τ) ': ρ)) cDefined in row-types-1.0.1.2 · Data.Row.InternalGenericRec EmptyDefined in row-types-1.0.1.2 · Data.Row.RecordsGenericVar EmptyDefined in row-types-1.0.1.2 · Data.Row.VariantsKnownSymbol name => GenericRec ('R '[name ':-> t])Defined in row-types-1.0.1.2 · Data.Row.Records(r ~ ((name' ':-> t') ': r'), GenericRec ('R r), KnownSymbol name, Extend name t ('R r) ≈ 'R ((name ':-> t) ': r)) => GenericRec ('R ((name ':-> t) ': (name' ':-> t') ': r'))Defined in row-types-1.0.1.2 · Data.Row.RecordsKnownSymbol name => GenericVar ('R '[name ':-> t])Defined in row-types-1.0.1.2 · Data.Row.Variants(GenericVar ('R ((name' ':-> t') ': r')), KnownSymbol name, Extend name t ('R ((name' ':-> t') ': r')) ≈ 'R ((name ':-> t) ': (name' ':-> t') ': r'), AllUniqueLabels ('R ((name ':-> t) ': (name' ':-> t') ': r'))) => GenericVar ('R ((name ':-> t) ': (name' ':-> t') ': r'))Defined in row-types-1.0.1.2 · Data.Row.Variantstype RepRec ('R '[name ':-> t]) = S1 ('MetaSel ('Just name) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 t)Defined in row-types-1.0.1.2 · Data.Row.Recordstype RepRec ('R '[]) = U1Defined in row-types-1.0.1.2 · Data.Row.Recordstype RepRec ('R ((name ':-> t) ': (name' ':-> t') ': r')) = S1 ('MetaSel ('Just name) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 t) :*: RepRec ('R ((name' ':-> t') ': r'))Defined in row-types-1.0.1.2 · Data.Row.Recordstype RepVar Empty = V1Defined in row-types-1.0.1.2 · Data.Row.Variantstype RepVar ('R '[name ':-> t]) = C1 ('MetaCons name 'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 t))Defined in row-types-1.0.1.2 · Data.Row.Variantstype RepVar ('R ((name ':-> t) ': (name' ':-> t') ': r')) = C1 ('MetaCons name 'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 t)) :+: RepVar ('R ((name' ':-> t') ': r'))Defined in row-types-1.0.1.2 · Data.Row.Variants
Type level version of empty
Row Operations
10 declarationsA type level way to create a singleton Row.
Various row-type merges
The difference between .+ (read "append"), .\/ (read "min-join"), and .\\ (read "const-union") comes down to how duplicates are handled. In .+, the two given row-types must be entirely unique. Even the same entry in both row-types is forbidden. In .\/, this final restriction is relaxed, allowing two row-types that have no conflicts to be merged in the logical way. The .\\ operator is the most liberal, allowing any two row-types to be merged together, and whenever there is a conflict, favoring the left argument.
As examples of use:
.+ is used when appending two records, assuring that those two records are entirely disjoint.
.\/ is used when diversifying a variant, allowing some extension to the row-type so long as no original types have changed.
.// is used when doing record overwrite, allowing data in a record to totally overwrite what was previously there.
Row Constraints
19 declarationsAlias for .\. It is a class rather than an alias, so that it can be partially applied.
Does the row lack (i.e. it does not have) the specified label?
Equations
(.\) ('R '[]) l = Unconstrained(.\) ('R r) l = LacksR l r r
Alias for (r .! l) ≈ a. It is a class rather than an alias, so that
it can be partially applied.
Any structure over a row in which every element is similarly constrained can be metamorphized into another structure over the same row.
Methods
metamorph :: Bifunctor p => Proxy (Proxy h, Proxy p) -> (f Empty -> g Empty) -> (forall (ℓ :: Symbol) (τ :: k) (ρ :: Row k). (KnownSymbol ℓ, c τ, HasType ℓ τ ρ) => Label ℓ -> f ρ -> p (f (ρ .- ℓ)) (h τ)) -> (forall (ℓ :: Symbol) (τ :: k) (ρ :: Row k). (KnownSymbol ℓ, c τ, FrontExtends ℓ τ ρ, AllUniqueLabels (Extend ℓ τ ρ)) => Label ℓ -> p (g ρ) (h τ) -> g (Extend ℓ τ ρ)) -> f r -> g rA metamorphism is an anamorphism (an unfold) followed by a catamorphism (a fold). The parameter
pdescribes the output of the unfold and the input of the fold. For records,p = (,), because every entry in the row will unfold to a value paired with the rest of the record. For variants,p = Either, because there will either be a value or future types to explore. Const can be useful when the types in the row are unnecessary.
Instances2Forall
Forall ('R '[]) cDefined in row-types-1.0.1.2 · Data.Row.Internal(KnownSymbol ℓ, c τ, Forall ('R ρ) c, FrontExtends ℓ τ ('R ρ), AllUniqueLabels (Extend ℓ τ ('R ρ))) => Forall ('R ((ℓ ':-> τ) ': ρ)) cDefined in row-types-1.0.1.2 · Data.Row.Internal
Any structure over two rows in which the elements of each row satisfy some constraints can be metamorphized into another structure over both of the rows.
Methods
biMetamorph :: Bifunctor p => Proxy (Proxy h, Proxy p) -> (f Empty Empty -> g Empty Empty) -> (forall (ℓ :: Symbol) (τ1 :: k1) (τ2 :: k2) (ρ1 :: Row k1) (ρ2 :: Row k2). (KnownSymbol ℓ, c τ1 τ2, HasType ℓ τ1 ρ1, HasType ℓ τ2 ρ2) => Label ℓ -> f ρ1 ρ2 -> p (f (ρ1 .- ℓ) (ρ2 .- ℓ)) (h τ1 τ2)) -> (forall (ℓ :: Symbol) (τ1 :: k1) (τ2 :: k2) (ρ1 :: Row k1) (ρ2 :: Row k2). (KnownSymbol ℓ, c τ1 τ2, FrontExtends ℓ τ1 ρ1, FrontExtends ℓ τ2 ρ2, AllUniqueLabels (Extend ℓ τ1 ρ1), AllUniqueLabels (Extend ℓ τ2 ρ2)) => Label ℓ -> p (g ρ1 ρ2) (h τ1 τ2) -> g (Extend ℓ τ1 ρ1) (Extend ℓ τ2 ρ2)) -> f r1 r2 -> g r1 r2A metamorphism is an anamorphism (an unfold) followed by a catamorphism (a fold).
Instances2BiForall
BiForall ('R '[]) ('R '[]) c1Defined in row-types-1.0.1.2 · Data.Row.Internal(KnownSymbol ℓ, c τ1 τ2, BiForall ('R ρ1) ('R ρ2) c, FrontExtends ℓ τ1 ('R ρ1), FrontExtends ℓ τ2 ('R ρ2), AllUniqueLabels (Extend ℓ τ1 ('R ρ1)), AllUniqueLabels (Extend ℓ τ2 ('R ρ2))) => BiForall ('R ((ℓ ':-> τ1) ': ρ1)) ('R ((ℓ ':-> τ2) ': ρ2)) cDefined in row-types-1.0.1.2 · Data.Row.Internal
class (c1 x, c2 y) => BiConstraint (c1 :: k -> Constraint) (c2 :: k1 -> Constraint) (x :: k) (y :: k1)A pair of constraints
Instances1BiConstraint
(c1 x, c2 y) => BiConstraint c1 c2 x yDefined in row-types-1.0.1.2 · Data.Row.Internal
A null constraint
Instances1Unconstrained
UnconstrainedDefined in row-types-1.0.1.2 · Data.Row.Internal
A null constraint of one argument
Instances1Unconstrained1
Unconstrained1 aDefined in row-types-1.0.1.2 · Data.Row.Internal
A null constraint of two arguments
Instances1Unconstrained2
Unconstrained2 a bDefined in row-types-1.0.1.2 · Data.Row.Internal
A class wrapper for FrontExtendsDict.
Methods
frontExtendsDict :: FrontExtendsDict l t r
A dictionary of information that proves that extending a row-type r with
a label l will necessarily put it to the front of the underlying row-type
list. This is quite internal and should not generally be necessary.
A convenient way to provide common, easy constraints
Are all of the labels in this Row unique?
Equations
AllUniqueLabels ('R r) = AllUniqueLabelsR r
type Disjoint (l :: Row k) (r :: Row k) = (WellBehaved l, WellBehaved r, Subset l (l .+ r), Subset r (l .+ r), ((l .+ r) .\\ l) ≈ r, ((l .+ r) .\\ r) ≈ l)A type synonym for disjointness.
Helper functions
6 declarationsReturn a list of the labels in a row type.
Return a list of the labels in a row type and is specialized to the Unconstrained1 constraint.
A helper function for showing labels
A helper function to turn a Label directly into Text.
A lower fixity operator for type equality