Safe Haskell | None |
---|---|
Language | Haskell2010 |
See here for the original term-level code by Stefan Kahrs. It is also copied at the end of this file. Some parts of the type-level code include the correspondign term-level parts in their comments.
Synopsis
- data Color
- data Map k v
- type EmptyMap = E
- type family KeysValuesAllF (c :: k -> v -> Constraint) (t :: Map k v) :: Constraint where ...
- class KeysValuesAllF c t => KeysValuesAll (c :: k -> v -> Constraint) (t :: Map k v) where
- cpara_Map :: proxy c -> r E -> (forall left k v right color. (c k v, KeysValuesAll c left, KeysValuesAll c right) => r left -> r right -> r (N color left k v right)) -> r t
- cpure_Record :: forall c t f. KeysValuesAll c t => Proxy c -> (forall k v. c k v => f v) -> Record f t
- demoteKeys :: forall t. KeysValuesAll KnownKey t => Record (K String) t
- class KnownSymbol k => KnownKey (k :: Symbol) (v :: z)
- demoteEntries :: forall t. KeysValuesAll KnownKeyTypeableValue t => Record (K (String, TypeRep)) t
- class (KnownSymbol k, Typeable v) => KnownKeyTypeableValue (k :: Symbol) (v :: Type)
- data Record (f :: Type -> Type) (t :: Map Symbol Type) where
- collapse_Record :: forall t result a. Productlike '[] t result => Record (K a) t -> [a]
- prettyShowRecord :: forall t flat f. (KeysValuesAll KnownKey t, Productlike '[] t flat, All Show flat, SListI flat) => (forall x. Show x => f x -> String) -> Record f t -> String
- prettyShowRecordI :: forall t flat. (KeysValuesAll KnownKey t, Productlike '[] t flat, All Show flat, SListI flat) => Record I t -> String
- unit :: Record f E
- data Variant (f :: Type -> Type) (t :: Map Symbol Type) where
- impossible :: Variant f E -> b
- prettyShowVariant :: forall t flat f. (KeysValuesAll KnownKey t, Productlike '[] t flat, Sumlike '[] t flat, All Show flat, SListI flat) => (forall x. Show x => f x -> String) -> Variant f t -> String
- prettyShowVariantI :: forall t flat. (KeysValuesAll KnownKey t, Productlike '[] t flat, Sumlike '[] t flat, All Show flat, SListI flat) => Variant I t -> String
- type family InsertAll (es :: [(Symbol, Type)]) (t :: Map Symbol Type) :: Map Symbol Type where ...
- type FromList (es :: [(Symbol, Type)]) = InsertAll es E
- addField :: forall k v t f. Insertable k v t => f v -> Record f t -> Record f (Insert k v t)
- insertI :: forall k v t. Insertable k v t => v -> Record I t -> Record I (Insert k v t)
- addFieldI :: forall k v t. Insertable k v t => v -> Record I t -> Record I (Insert k v t)
- class Insertable (k :: Symbol) (v :: Type) (t :: Map Symbol Type) where
- class CanMakeBlack (t :: Map Symbol Type) where
- class InsertableHelper1 (k :: Symbol) (v :: Type) (t :: Map Symbol Type) where
- class InsertableHelper2 (ordering :: Ordering) (k :: Symbol) (v :: Type) (color :: Color) (left :: Map Symbol Type) (k' :: Symbol) (v' :: Type) (right :: Map Symbol Type) where
- data BalanceAction
- type family ShouldBalance (left :: Map k' v') (right :: Map k' v') :: BalanceAction where ...
- class Balanceable (left :: Map Symbol Type) (k :: Symbol) (v :: Type) (right :: Map Symbol Type) where
- class BalanceableHelper (action :: BalanceAction) (left :: Map Symbol Type) (k :: Symbol) (v :: Type) (right :: Map Symbol Type) where
- type family Field (f :: Type -> Type) (t :: Map Symbol Type) (v :: Type) where ...
- type family Branch (f :: Type -> Type) (t :: Map Symbol Type) (v :: Type) where ...
- class Key (k :: Symbol) (t :: Map Symbol Type) where
- class KeyHelper (ordering :: Ordering) (k :: Symbol) (left :: Map Symbol Type) (v :: Type) (right :: Map Symbol Type) where
- project :: forall k t f. Key k t => Record f t -> f (Value k t)
- getField :: forall k t f. Key k t => Record f t -> f (Value k t)
- setField :: forall k t f. Key k t => f (Value k t) -> Record f t -> Record f t
- modifyField :: forall k t f. Key k t => (f (Value k t) -> f (Value k t)) -> Record f t -> Record f t
- inject :: forall k t f. Key k t => f (Value k t) -> Variant f t
- match :: forall k t f. Key k t => Variant f t -> Maybe (f (Value k t))
- projectI :: forall k t. Key k t => Record I t -> Value k t
- getFieldI :: forall k t. Key k t => Record I t -> Value k t
- setFieldI :: forall k t. Key k t => Value k t -> Record I t -> Record I t
- modifyFieldI :: forall k t. Key k t => (Value k t -> Value k t) -> Record I t -> Record I t
- injectI :: forall k t. Key k t => Value k t -> Variant I t
- matchI :: forall k t. Key k t => Variant I t -> Maybe (Value k t)
- eliminate :: (Productlike '[] t result, Sumlike '[] t result, SListI result) => Record (Case f r) t -> Variant f t -> r
- newtype Case f a b = Case (f b -> a)
- addCase :: forall k v t f a. Insertable k v t => (f v -> a) -> Record (Case f a) t -> Record (Case f a) (Insert k v t)
- addCaseI :: forall k v t a. Insertable k v t => (v -> a) -> Record (Case I a) t -> Record (Case I a) (Insert k v t)
- newtype SetField f a b = SetField {
- getSetField :: f b -> a -> a
- class (Key k t, Value k t ~ v) => PresentIn (t :: Map Symbol Type) (k :: Symbol) (v :: Type)
- type ProductlikeSubset (subset :: Map Symbol Type) (whole :: Map Symbol Type) (flat :: [Type]) = (KeysValuesAll (PresentIn whole) subset, Productlike '[] subset flat, SListI flat)
- fieldSubset :: forall subset whole flat f. ProductlikeSubset subset whole flat => Record f whole -> (Record f subset -> Record f whole, Record f subset)
- projectSubset :: forall subset whole flat f. ProductlikeSubset subset whole flat => Record f whole -> Record f subset
- getFieldSubset :: forall subset whole flat f. ProductlikeSubset subset whole flat => Record f whole -> Record f subset
- setFieldSubset :: forall subset whole flat f. ProductlikeSubset subset whole flat => Record f subset -> Record f whole -> Record f whole
- modifyFieldSubset :: forall subset whole flat f. ProductlikeSubset subset whole flat => (Record f subset -> Record f subset) -> Record f whole -> Record f whole
- type SumlikeSubset (subset :: Map Symbol Type) (whole :: Map Symbol Type) (subflat :: [Type]) (wholeflat :: [Type]) = (KeysValuesAll (PresentIn whole) subset, Productlike '[] whole wholeflat, Sumlike '[] whole wholeflat, SListI wholeflat, Productlike '[] subset subflat, Sumlike '[] subset subflat, SListI subflat)
- branchSubset :: forall subset whole subflat wholeflat f. SumlikeSubset subset whole subflat wholeflat => (Variant f whole -> Maybe (Variant f subset), Variant f subset -> Variant f whole)
- injectSubset :: forall subset whole subflat wholeflat f. SumlikeSubset subset whole subflat wholeflat => Variant f subset -> Variant f whole
- matchSubset :: forall subset whole subflat wholeflat f. SumlikeSubset subset whole subflat wholeflat => Variant f whole -> Maybe (Variant f subset)
- eliminateSubset :: forall subset whole subflat wholeflat f r. SumlikeSubset subset whole subflat wholeflat => Record (Case f r) whole -> Variant f subset -> r
- class Productlike (start :: [Type]) (t :: Map Symbol Type) (result :: [Type]) | start t -> result, result t -> start where
- toNP :: forall t result f. Productlike '[] t result => Record f t -> NP f result
- fromNP :: forall t result f. Productlike '[] t result => NP f result -> Record f t
- class Sumlike (start :: [Type]) (t :: Map Symbol Type) (result :: [Type]) | start t -> result, result t -> start where
- toNS :: forall t result f. Sumlike '[] t result => Variant f t -> NS f result
- fromNS :: forall t result f. Sumlike '[] t result => NS f result -> Variant f t
- class ToRecord (r :: Type) where
- type RecordCode r :: Map Symbol Type
- toRecord :: r -> Record I (RecordCode r)
- class ToRecordHelper (start :: Map Symbol Type) (g :: Type -> Type) where
- type RecordCode' start g :: Map Symbol Type
- toRecord' :: Record I start -> g x -> Record I (RecordCode' start g)
- class ToRecord r => FromRecord (r :: Type) where
- fromRecord :: Record I (RecordCode r) -> r
- class FromRecordHelper (t :: Map Symbol Type) (g :: Type -> Type) where
- fromRecord' :: Record I t -> g x
- type family VariantCode (s :: Type) :: Map Symbol Type where ...
- type family VariantCode' (acc :: Map Symbol Type) (g :: Type -> Type) :: Map Symbol Type where ...
- class FromVariant (s :: Type) where
- fromVariant :: Variant I (VariantCode s) -> s
- class FromVariantHelper (t :: Map Symbol Type) (g :: Type -> Type) where
- fromVariant' :: Variant I t -> Maybe (g x)
- class ToVariant (s :: Type) where
- toVariant :: s -> Variant I (VariantCode s)
- class ToVariantHelper (t :: Map Symbol Type) (g :: Type -> Type) where
- toVariant' :: g x -> Variant I t
- type family DiscriminateBalL (l :: Map k v) (r :: Map k v) :: Bool where ...
- class BalanceableL (l :: Map Symbol Type) (k :: Symbol) (v :: Type) (r :: Map Symbol Type) where
- class BalanceableHelperL (b :: Bool) (l :: Map Symbol Type) (k :: Symbol) (v :: Type) (r :: Map Symbol Type) where
- type family DiscriminateBalR (l :: Map k v) (r :: Map k v) :: Bool where ...
- class BalanceableR (l :: Map Symbol Type) (k :: Symbol) (v :: Type) (r :: Map Symbol Type) where
- class BalanceableHelperR (b :: Bool) (l :: Map Symbol Type) (k :: Symbol) (v :: Type) (r :: Map Symbol Type) where
- class Fuseable (l :: Map Symbol Type) (r :: Map Symbol Type) where
- class FuseableHelper1 (fused :: Map Symbol Type) (l :: Map Symbol Type) (r :: Map Symbol Type) where
- class FuseableHelper2 (fused :: Map Symbol Type) (l :: Map Symbol Type) (r :: Map Symbol Type) where
- class Delable (k :: Symbol) (v :: Type) (t :: Map Symbol Type) where
- class DelableL (k :: Symbol) (v :: Type) (l :: Map Symbol Type) (kx :: Symbol) (vx :: Type) (r :: Map Symbol Type) where
- class DelableR (k :: Symbol) (v :: Type) (l :: Map Symbol Type) (kx :: Symbol) (vx :: Type) (r :: Map Symbol Type) where
- class DelableHelper (ordering :: Ordering) (k :: Symbol) (v :: Type) (l :: Map Symbol Type) (kx :: Symbol) (vx :: Type) (r :: Map Symbol Type) where
- class Deletable (k :: Symbol) (v :: Type) (t :: Map Symbol Type) where
- winnowI :: forall k v t. Deletable k v t => Variant I t -> Either (Variant I (Delete k v t)) v
Documentation
The color of a node.
type family KeysValuesAllF (c :: k -> v -> Constraint) (t :: Map k v) :: Constraint where ... Source #
KeysValuesAllF _ E = () | |
KeysValuesAllF c (N color left k v right) = (c k v, KeysValuesAll c left, KeysValuesAll c right) |
class KeysValuesAllF c t => KeysValuesAll (c :: k -> v -> Constraint) (t :: Map k v) where Source #
Require a constraint for every key-value pair in a tree. This is a generalization of All
from Data.SOP.
cpara_Map
constructs a Record
by means of a constraint for producing
the nodes of the tree. The constraint is passed as a Proxy
.
cpara_Map :: proxy c -> r E -> (forall left k v right color. (c k v, KeysValuesAll c left, KeysValuesAll c right) => r left -> r right -> r (N color left k v right)) -> r t Source #
Instances
KeysValuesAll (c :: k -> v -> Constraint) (E :: Map k v) Source # | |
Defined in Data.RBR.Internal | |
(c k2 v2, KeysValuesAll c left, KeysValuesAll c right) => KeysValuesAll (c :: k1 -> v1 -> Constraint) (N color left k2 v2 right :: Map k1 v1) Source # | |
Defined in Data.RBR.Internal |
cpure_Record :: forall c t f. KeysValuesAll c t => Proxy c -> (forall k v. c k v => f v) -> Record f t Source #
demoteKeys :: forall t. KeysValuesAll KnownKey t => Record (K String) t Source #
class KnownSymbol k => KnownKey (k :: Symbol) (v :: z) Source #
Two-place constraint saying that the symbol can be demoted to String. Nothing is required from the value type.
Defined using the "class synonym" trick.
Instances
KnownSymbol k => KnownKey k (v :: z) Source # | |
Defined in Data.RBR.Internal |
demoteEntries :: forall t. KeysValuesAll KnownKeyTypeableValue t => Record (K (String, TypeRep)) t Source #
Create a record containing the names of each field along with a term-level representation of each type.
See also collapse_Record
for getting the entries as a list.
class (KnownSymbol k, Typeable v) => KnownKeyTypeableValue (k :: Symbol) (v :: Type) Source #
Two-place constraint saying that the symbol can be demoted to String, and that a term-level representation can be obtained for the value type.
Defined using the "class synonym" trick.
Instances
(KnownSymbol k, Typeable v) => KnownKeyTypeableValue k v Source # | |
Defined in Data.RBR.Internal |
data Record (f :: Type -> Type) (t :: Map Symbol Type) where Source #
An extensible product-like type with named fields.
The values in the Record
come wrapped in a type constructor f
, which
por pure records will be the identity functor I
.
collapse_Record :: forall t result a. Productlike '[] t result => Record (K a) t -> [a] Source #
Collapse a Record
composed of K
annotations.
The naming scheme follows that of collapse_NP
.
prettyShowRecord :: forall t flat f. (KeysValuesAll KnownKey t, Productlike '[] t flat, All Show flat, SListI flat) => (forall x. Show x => f x -> String) -> Record f t -> String Source #
prettyShowRecordI :: forall t flat. (KeysValuesAll KnownKey t, Productlike '[] t flat, All Show flat, SListI flat) => Record I t -> String Source #
Like prettyShowRecord
but specialized to pure records.
A Record without components is a boring, uninformative type whose single value can be conjured out of thin air.
data Variant (f :: Type -> Type) (t :: Map Symbol Type) where Source #
An extensible sum-like type with named branches.
The values in the Variant
come wrapped in a type constructor f
, which
por pure variants will be the identity functor I
.
impossible :: Variant f E -> b Source #
A Variant without branches doesn't have any values. From an impossible thing, anything can come out.
prettyShowVariant :: forall t flat f. (KeysValuesAll KnownKey t, Productlike '[] t flat, Sumlike '[] t flat, All Show flat, SListI flat) => (forall x. Show x => f x -> String) -> Variant f t -> String Source #
prettyShowVariantI :: forall t flat. (KeysValuesAll KnownKey t, Productlike '[] t flat, Sumlike '[] t flat, All Show flat, SListI flat) => Variant I t -> String Source #
Like prettyShowVariant
but specialized to pure variants.
type family InsertAll (es :: [(Symbol, Type)]) (t :: Map Symbol Type) :: Map Symbol Type where ... Source #
Insert a list of type level key / value pairs into a type-level tree.
type FromList (es :: [(Symbol, Type)]) = InsertAll es E Source #
Build a type-level tree out of a list of type level key / value pairs.
addField :: forall k v t f. Insertable k v t => f v -> Record f t -> Record f (Insert k v t) Source #
Alias for insert
.
class Insertable (k :: Symbol) (v :: Type) (t :: Map Symbol Type) where Source #
Class that determines if the pair of a Symbol
key and a Type
can
be inserted into a type-level tree.
The associated type family Insert
produces the resulting tree.
At the term level, this manifests in insert
, which adds a new field to a
record, and in widen
, which lets you use a Variant
in a bigger context
than the one in which is was defined. insert
tends to be more useful in
practice.
If the tree already has the key but with a different type, the insertion fails to compile.
class CanMakeBlack (t :: Map Symbol Type) where Source #
makeBlackR :: Record f t -> Record f (MakeBlack t) Source #
makeBlackV :: Variant f t -> Variant f (MakeBlack t) Source #
Instances
CanMakeBlack (E :: Map Symbol Type) Source # | |
CanMakeBlack (N color left k v right) Source # | |
Defined in Data.RBR.Internal |
class InsertableHelper1 (k :: Symbol) (v :: Type) (t :: Map Symbol Type) where Source #
Instances
InsertableHelper1 k v (E :: Map Symbol Type) Source # | |
(CmpSymbol k k' ~ ordering, InsertableHelper2 ordering k v color left k' v' right) => InsertableHelper1 k v (N color left k' v' right) Source # | |
Defined in Data.RBR.Internal |
class InsertableHelper2 (ordering :: Ordering) (k :: Symbol) (v :: Type) (color :: Color) (left :: Map Symbol Type) (k' :: Symbol) (v' :: Type) (right :: Map Symbol Type) where Source #
insert2 :: f v -> Record f (N color left k' v' right) -> Record f (Insert2 ordering k v color left k' v' right) Source #
widen2 :: Variant f (N color left k' v' right) -> Variant f (Insert2 ordering k v color left k' v' right) Source #
Instances
(InsertableHelper1 k v left, Balanceable (Insert1 k v left) k' v' right) => InsertableHelper2 LT k v R left k' v' right Source # | |
Defined in Data.RBR.Internal | |
(InsertableHelper1 k v left, Balanceable (Insert1 k v left) k' v' right) => InsertableHelper2 LT k v B left k' v' right Source # | |
Defined in Data.RBR.Internal | |
InsertableHelper2 EQ k v color left k v right Source # | |
Defined in Data.RBR.Internal | |
(InsertableHelper1 k v right, Balanceable left k' v' (Insert1 k v right)) => InsertableHelper2 GT k v R left k' v' right Source # | |
Defined in Data.RBR.Internal | |
(InsertableHelper1 k v right, Balanceable left k' v' (Insert1 k v right)) => InsertableHelper2 GT k v B left k' v' right Source # | |
Defined in Data.RBR.Internal |
data BalanceAction Source #
Instances
Show BalanceAction Source # | |
Defined in Data.RBR.Internal showsPrec :: Int -> BalanceAction -> ShowS # show :: BalanceAction -> String # showList :: [BalanceAction] -> ShowS # |
type family ShouldBalance (left :: Map k' v') (right :: Map k' v') :: BalanceAction where ... Source #
ShouldBalance (N R _ _ _ _) (N R _ _ _ _) = BalanceSpecial | |
ShouldBalance (N R (N R _ _ _ _) _ _ _) _ = BalanceLL | |
ShouldBalance (N R _ _ _ (N R _ _ _ _)) _ = BalanceLR | |
ShouldBalance _ (N R (N R _ _ _ _) _ _ _) = BalanceRL | |
ShouldBalance _ (N R _ _ _ (N R _ _ _ _)) = BalanceRR | |
ShouldBalance _ _ = DoNotBalance |
class Balanceable (left :: Map Symbol Type) (k :: Symbol) (v :: Type) (right :: Map Symbol Type) where Source #
balanceR :: Record f (N color left k v right) -> Record f (Balance left k v right) Source #
balanceV :: Variant f (N color left k v right) -> Variant f (Balance left k v right) Source #
Instances
(ShouldBalance left right ~ action, BalanceableHelper action left k v right) => Balanceable left k v right Source # | |
class BalanceableHelper (action :: BalanceAction) (left :: Map Symbol Type) (k :: Symbol) (v :: Type) (right :: Map Symbol Type) where Source #
balanceR' :: Record f (N color left k v right) -> Record f (Balance' action left k v right) Source #
balanceV' :: Variant f (N color left k v right) -> Variant f (Balance' action left k v right) Source #
Instances
BalanceableHelper DoNotBalance a k v b Source # | |
BalanceableHelper BalanceRL a k1 v1 (N R (N R b k2 v2 c) k3 v3 d) Source # | |
Defined in Data.RBR.Internal balanceR' :: Record f (N color a k1 v1 (N R (N R b k2 v2 c) k3 v3 d)) -> Record f (Balance' BalanceRL a k1 v1 (N R (N R b k2 v2 c) k3 v3 d)) Source # balanceV' :: Variant f (N color a k1 v1 (N R (N R b k2 v2 c) k3 v3 d)) -> Variant f (Balance' BalanceRL a k1 v1 (N R (N R b k2 v2 c) k3 v3 d)) Source # | |
BalanceableHelper BalanceRR a k1 v1 (N R b k2 v2 (N R c k3 v3 d)) Source # | |
Defined in Data.RBR.Internal balanceR' :: Record f (N color a k1 v1 (N R b k2 v2 (N R c k3 v3 d))) -> Record f (Balance' BalanceRR a k1 v1 (N R b k2 v2 (N R c k3 v3 d))) Source # balanceV' :: Variant f (N color a k1 v1 (N R b k2 v2 (N R c k3 v3 d))) -> Variant f (Balance' BalanceRR a k1 v1 (N R b k2 v2 (N R c k3 v3 d))) Source # | |
BalanceableHelper BalanceLL (N R (N R a k1 v1 b) k2 v2 c) k3 v3 d Source # | |
Defined in Data.RBR.Internal balanceR' :: Record f (N color (N R (N R a k1 v1 b) k2 v2 c) k3 v3 d) -> Record f (Balance' BalanceLL (N R (N R a k1 v1 b) k2 v2 c) k3 v3 d) Source # balanceV' :: Variant f (N color (N R (N R a k1 v1 b) k2 v2 c) k3 v3 d) -> Variant f (Balance' BalanceLL (N R (N R a k1 v1 b) k2 v2 c) k3 v3 d) Source # | |
BalanceableHelper BalanceLR (N R a k1 v1 (N R b k2 v2 c)) k3 v3 d Source # | |
Defined in Data.RBR.Internal balanceR' :: Record f (N color (N R a k1 v1 (N R b k2 v2 c)) k3 v3 d) -> Record f (Balance' BalanceLR (N R a k1 v1 (N R b k2 v2 c)) k3 v3 d) Source # balanceV' :: Variant f (N color (N R a k1 v1 (N R b k2 v2 c)) k3 v3 d) -> Variant f (Balance' BalanceLR (N R a k1 v1 (N R b k2 v2 c)) k3 v3 d) Source # | |
BalanceableHelper BalanceSpecial (N R left1 k1 v1 right1) kx vx (N R left2 k2 v2 right2) Source # | |
Defined in Data.RBR.Internal type Balance' BalanceSpecial (N R left1 k1 v1 right1) kx vx (N R left2 k2 v2 right2) :: Map Symbol Type Source # balanceR' :: Record f (N color (N R left1 k1 v1 right1) kx vx (N R left2 k2 v2 right2)) -> Record f (Balance' BalanceSpecial (N R left1 k1 v1 right1) kx vx (N R left2 k2 v2 right2)) Source # balanceV' :: Variant f (N color (N R left1 k1 v1 right1) kx vx (N R left2 k2 v2 right2)) -> Variant f (Balance' BalanceSpecial (N R left1 k1 v1 right1) kx vx (N R left2 k2 v2 right2)) Source # |
type family Field (f :: Type -> Type) (t :: Map Symbol Type) (v :: Type) where ... Source #
Auxiliary type family to avoid repetition and help improve compilation times.
type family Branch (f :: Type -> Type) (t :: Map Symbol Type) (v :: Type) where ... Source #
Auxiliary type family to avoid repetition and help improve compilation times.
class Key (k :: Symbol) (t :: Map Symbol Type) where Source #
Class that determines if a given Symbol
key is present in a type-level
tree.
The Value
type family gives the Type
corresponding to the key.
field
takes a field name (given through TypeApplications
) and a
Record
, and returns a pair of a setter for the field and the original
value of the field.
branch
takes a branch name (given through TypeApplications
) and
returns a pair of a match function and a constructor.
class KeyHelper (ordering :: Ordering) (k :: Symbol) (left :: Map Symbol Type) (v :: Type) (right :: Map Symbol Type) where Source #
field' :: Field f (N colorx left kx v right) (Value' ordering k left v right) Source #
branch' :: Branch f (N colorx left kx v right) (Value' ordering k left v right) Source #
Instances
KeyHelper EQ k left v right Source # | |
(CmpSymbol k2 k ~ ordering, KeyHelper ordering k left2 v2 right2) => KeyHelper LT k left v (N color2 left2 k2 v2 right2) Source # | |
Defined in Data.RBR.Internal | |
(CmpSymbol k2 k ~ ordering, KeyHelper ordering k left2 v2 right2) => KeyHelper GT k (N color2 left2 k2 v2 right2) v' right Source # | |
Defined in Data.RBR.Internal |
project :: forall k t f. Key k t => Record f t -> f (Value k t) Source #
Get the value of a field for a Record
.
setField :: forall k t f. Key k t => f (Value k t) -> Record f t -> Record f t Source #
Set the value of a field for a Record
.
modifyField :: forall k t f. Key k t => (f (Value k t) -> f (Value k t)) -> Record f t -> Record f t Source #
Modify the value of a field for a Record
.
inject :: forall k t f. Key k t => f (Value k t) -> Variant f t Source #
Put a value into the branch of a Variant
.
match :: forall k t f. Key k t => Variant f t -> Maybe (f (Value k t)) Source #
Check if a Variant
value is the given branch.
modifyFieldI :: forall k t. Key k t => (Value k t -> Value k t) -> Record I t -> Record I t Source #
Like modifyField
but specialized to pure Record
s.
matchI :: forall k t. Key k t => Variant I t -> Maybe (Value k t) Source #
Like match
but specialized to pure Variants
s.
eliminate :: (Productlike '[] t result, Sumlike '[] t result, SListI result) => Record (Case f r) t -> Variant f t -> r Source #
addCase :: forall k v t f a. Insertable k v t => (f v -> a) -> Record (Case f a) t -> Record (Case f a) (Insert k v t) Source #
addCaseI :: forall k v t a. Insertable k v t => (v -> a) -> Record (Case I a) t -> Record (Case I a) (Insert k v t) Source #
A pure version of addCase
.
newtype SetField f a b Source #
SetField | |
|
class (Key k t, Value k t ~ v) => PresentIn (t :: Map Symbol Type) (k :: Symbol) (v :: Type) Source #
type ProductlikeSubset (subset :: Map Symbol Type) (whole :: Map Symbol Type) (flat :: [Type]) = (KeysValuesAll (PresentIn whole) subset, Productlike '[] subset flat, SListI flat) Source #
Constraint for trees that represent subsets of fields of Record
-like types.
fieldSubset :: forall subset whole flat f. ProductlikeSubset subset whole flat => Record f whole -> (Record f subset -> Record f whole, Record f subset) Source #
Like field
, but targets multiple fields at the same time
projectSubset :: forall subset whole flat f. ProductlikeSubset subset whole flat => Record f whole -> Record f subset Source #
Like project
, but extracts multiple fields at the same time.
Can also be used to convert between structurally dissimilar trees that nevertheless have the same entries.
getFieldSubset :: forall subset whole flat f. ProductlikeSubset subset whole flat => Record f whole -> Record f subset Source #
Alias for projectSubset
.
setFieldSubset :: forall subset whole flat f. ProductlikeSubset subset whole flat => Record f subset -> Record f whole -> Record f whole Source #
Like setField
, but sets multiple fields at the same time.
modifyFieldSubset :: forall subset whole flat f. ProductlikeSubset subset whole flat => (Record f subset -> Record f subset) -> Record f whole -> Record f whole Source #
Like modifyField
, but modifies multiple fields at the same time.
type SumlikeSubset (subset :: Map Symbol Type) (whole :: Map Symbol Type) (subflat :: [Type]) (wholeflat :: [Type]) = (KeysValuesAll (PresentIn whole) subset, Productlike '[] whole wholeflat, Sumlike '[] whole wholeflat, SListI wholeflat, Productlike '[] subset subflat, Sumlike '[] subset subflat, SListI subflat) Source #
Constraint for trees that represent subsets of branches of Variant
-like types.
branchSubset :: forall subset whole subflat wholeflat f. SumlikeSubset subset whole subflat wholeflat => (Variant f whole -> Maybe (Variant f subset), Variant f subset -> Variant f whole) Source #
Like branch
, but targets multiple branches at the same time.
injectSubset :: forall subset whole subflat wholeflat f. SumlikeSubset subset whole subflat wholeflat => Variant f subset -> Variant f whole Source #
Like inject
, but injects one of several possible branches.
matchSubset :: forall subset whole subflat wholeflat f. SumlikeSubset subset whole subflat wholeflat => Variant f whole -> Maybe (Variant f subset) Source #
Like match
, but matches more than one branch.
eliminateSubset :: forall subset whole subflat wholeflat f r. SumlikeSubset subset whole subflat wholeflat => Record (Case f r) whole -> Variant f subset -> r Source #
class Productlike (start :: [Type]) (t :: Map Symbol Type) (result :: [Type]) | start t -> result, result t -> start where Source #
Class from converting Record
s to and from the n-ary product type NP
from Data.SOP.
prefixNP
flattens a Record
and adds it to the initial part of the product.
breakNP
reconstructs a Record
from the initial part of the product and returns the unconsumed part.
Instances
Productlike start (E :: Map Symbol Type) start Source # | |
(Productlike start right middle, Productlike (v ': middle) left result) => Productlike start (N color left k v right) result Source # | |
toNP :: forall t result f. Productlike '[] t result => Record f t -> NP f result Source #
Convert a Record
into a n-ary product.
fromNP :: forall t result f. Productlike '[] t result => NP f result -> Record f t Source #
Convert a n-ary product into a compatible Record
.
class Sumlike (start :: [Type]) (t :: Map Symbol Type) (result :: [Type]) | start t -> result, result t -> start where Source #
Class from converting Variant
s to and from the n-ary sum type NS
from Data.SOP.
prefixNS
flattens a Variant
and adds it to the initial part of the sum.
breakNS
reconstructs a Variant
from the initial part of the sum and returns the unconsumed part.
prefixNS :: Either (NS f start) (Variant f t) -> NS f result Source #
breakNS :: NS f result -> Either (NS f start) (Variant f t) Source #
Instances
Sumlike (v ': start) (N colorL leftL kL vL rightL) result => Sumlike start (N color (N colorL leftL kL vL rightL) k v (E :: Map Symbol Type)) result Source # | |
(Sumlike start (N colorR leftR kR vR rightR) middle, Sumlike (v ': middle) (N colorL leftL kL vL rightL) result) => Sumlike start (N color (N colorL leftL kL vL rightL) k v (N colorR leftR kR vR rightR)) result Source # | |
Defined in Data.RBR.Internal | |
Sumlike start (N colorR leftR kR vR rightR) middle => Sumlike start (N color (E :: Map Symbol Type) k v (N colorR leftR kR vR rightR)) (v ': middle) Source # | |
Sumlike start (N color (E :: Map Symbol Type) k v (E :: Map Symbol Type)) (v ': start) Source # | |
toNS :: forall t result f. Sumlike '[] t result => Variant f t -> NS f result Source #
Convert a Variant
into a n-ary sum.
fromNS :: forall t result f. Sumlike '[] t result => NS f result -> Variant f t Source #
Convert a n-ary sum into a compatible Variant
.
class ToRecord (r :: Type) where Source #
Nothing
toRecord :: r -> Record I (RecordCode r) Source #
toRecord :: (Generic r, ToRecordHelper E (Rep r), RecordCode r ~ RecordCode' E (Rep r)) => r -> Record I (RecordCode r) Source #
class ToRecordHelper (start :: Map Symbol Type) (g :: Type -> Type) where Source #
Instances
(ToRecordHelper start t2, RecordCode' start t2 ~ middle, ToRecordHelper middle t1) => ToRecordHelper start (t1 :*: t2) Source # | |
Insertable k v start => ToRecordHelper start (S1 (MetaSel (Just k) unpackedness strictness laziness) (Rec0 v)) Source # | |
ToRecordHelper (E :: Map Symbol Type) fields => ToRecordHelper (E :: Map Symbol Type) (D1 meta (C1 metacons fields)) Source # | |
class ToRecord r => FromRecord (r :: Type) where Source #
Nothing
fromRecord :: Record I (RecordCode r) -> r Source #
fromRecord :: (Generic r, FromRecordHelper (RecordCode r) (Rep r)) => Record I (RecordCode r) -> r Source #
class FromRecordHelper (t :: Map Symbol Type) (g :: Type -> Type) where Source #
fromRecord' :: Record I t -> g x Source #
Instances
(FromRecordHelper t t1, FromRecordHelper t t2) => FromRecordHelper t (t1 :*: t2) Source # | |
Defined in Data.RBR.Internal | |
(Key k t, Value k t ~ v) => FromRecordHelper t (S1 (MetaSel (Just k) unpackedness strictness laziness) (Rec0 v)) Source # | |
Defined in Data.RBR.Internal | |
FromRecordHelper t fields => FromRecordHelper t (D1 meta (C1 metacons fields)) Source # | |
Defined in Data.RBR.Internal |
type family VariantCode (s :: Type) :: Map Symbol Type where ... Source #
VariantCode s = VariantCode' E (Rep s) |
type family VariantCode' (acc :: Map Symbol Type) (g :: Type -> Type) :: Map Symbol Type where ... Source #
VariantCode' acc (D1 meta fields) = VariantCode' acc fields | |
VariantCode' acc (t1 :+: t2) = VariantCode' (VariantCode' acc t2) t1 | |
VariantCode' acc (C1 (MetaCons k _ _) (S1 (MetaSel Nothing unpackedness strictness laziness) (Rec0 v))) = Insert k v acc |
class FromVariant (s :: Type) where Source #
Nothing
fromVariant :: Variant I (VariantCode s) -> s Source #
fromVariant :: (Generic s, FromVariantHelper (VariantCode s) (Rep s)) => Variant I (VariantCode s) -> s Source #
class FromVariantHelper (t :: Map Symbol Type) (g :: Type -> Type) where Source #
Instances
(FromVariantHelper t t1, FromVariantHelper t t2) => FromVariantHelper t (t1 :+: t2) Source # | |
Defined in Data.RBR.Internal | |
(Key k t, Value k t ~ v) => FromVariantHelper t (C1 (MetaCons k x y) (S1 (MetaSel (Nothing :: Maybe Symbol) unpackedness strictness laziness) (Rec0 v))) Source # | |
FromVariantHelper t fields => FromVariantHelper t (D1 meta fields) Source # | |
Defined in Data.RBR.Internal |
class ToVariant (s :: Type) where Source #
Nothing
toVariant :: s -> Variant I (VariantCode s) Source #
toVariant :: (Generic s, ToVariantHelper (VariantCode s) (Rep s)) => s -> Variant I (VariantCode s) Source #
class ToVariantHelper (t :: Map Symbol Type) (g :: Type -> Type) where Source #
toVariant' :: g x -> Variant I t Source #
Instances
(ToVariantHelper t t1, ToVariantHelper t t2) => ToVariantHelper t (t1 :+: t2) Source # | |
Defined in Data.RBR.Internal | |
(Key k t, Value k t ~ v) => ToVariantHelper t (C1 (MetaCons k x y) (S1 (MetaSel (Nothing :: Maybe Symbol) unpackedness strictness laziness) (Rec0 v))) Source # | |
ToVariantHelper t fields => ToVariantHelper t (D1 meta fields) Source # | |
Defined in Data.RBR.Internal |
type family DiscriminateBalL (l :: Map k v) (r :: Map k v) :: Bool where ... Source #
DiscriminateBalL (N R _ _ _ _) _ = False | |
DiscriminateBalL _ _ = True |
class BalanceableL (l :: Map Symbol Type) (k :: Symbol) (v :: Type) (r :: Map Symbol Type) where Source #
balLR :: Record f (N color l k v r) -> Record f (BalL l k v r) Source #
balLV :: Variant f (N color l k v r) -> Variant f (BalL l k v r) Source #
Instances
(DiscriminateBalL l r ~ b, BalanceableHelperL b l k v r) => BalanceableL l k v r Source # | |
class BalanceableHelperL (b :: Bool) (l :: Map Symbol Type) (k :: Symbol) (v :: Type) (r :: Map Symbol Type) where Source #
balLR' :: Record f (N color l k v r) -> Record f (BalL' b l k v r) Source #
balLV' :: Variant f (N color l k v r) -> Variant f (BalL' b l k v r) Source #
Instances
BalanceableHelper (ShouldBalance t3 (N R l k kv r)) t3 z zv (N R l k kv r) => BalanceableHelperL True t1 y yv (N R (N B t2 u uv t3) z zv (N B l k kv r)) Source # | |
Defined in Data.RBR.Internal balLR' :: Record f (N color t1 y yv (N R (N B t2 u uv t3) z zv (N B l k kv r))) -> Record f (BalL' True t1 y yv (N R (N B t2 u uv t3) z zv (N B l k kv r))) Source # balLV' :: Variant f (N color t1 y yv (N R (N B t2 u uv t3) z zv (N B l k kv r))) -> Variant f (BalL' True t1 y yv (N R (N B t2 u uv t3) z zv (N B l k kv r))) Source # | |
BalanceableHelper (ShouldBalance t1 (N R t2 z zv t3)) t1 y yv (N R t2 z zv t3) => BalanceableHelperL True t1 y yv (N B t2 z zv t3) Source # | |
Defined in Data.RBR.Internal | |
BalanceableHelperL False (N R left1 k1 v1 right1) k2 v2 right2 Source # | |
Defined in Data.RBR.Internal |
type family DiscriminateBalR (l :: Map k v) (r :: Map k v) :: Bool where ... Source #
DiscriminateBalR _ (N R _ _ _ _) = False | |
DiscriminateBalR _ _ = True |
class BalanceableR (l :: Map Symbol Type) (k :: Symbol) (v :: Type) (r :: Map Symbol Type) where Source #
balRR :: Record f (N color l k v r) -> Record f (BalR l k v r) Source #
balRV :: Variant f (N color l k v r) -> Variant f (BalR l k v r) Source #
Instances
(DiscriminateBalR l r ~ b, BalanceableHelperR b l k v r) => BalanceableR l k v r Source # | |
class BalanceableHelperR (b :: Bool) (l :: Map Symbol Type) (k :: Symbol) (v :: Type) (r :: Map Symbol Type) where Source #
balRR' :: Record f (N color l k v r) -> Record f (BalR' b l k v r) Source #
balRV' :: Variant f (N color l k v r) -> Variant f (BalR' b l k v r) Source #
Instances
BalanceableHelperR False right2 k2 v2 (N R left1 k1 v1 right1) Source # | |
Defined in Data.RBR.Internal | |
BalanceableHelper (ShouldBalance (N R t2 u uv t3) l) (N R t2 u uv t3) z zv l => BalanceableHelperR True (N R (N B t2 u uv t3) z zv (N B l k kv r)) y yv t1 Source # | |
Defined in Data.RBR.Internal balRR' :: Record f (N color (N R (N B t2 u uv t3) z zv (N B l k kv r)) y yv t1) -> Record f (BalR' True (N R (N B t2 u uv t3) z zv (N B l k kv r)) y yv t1) Source # balRV' :: Variant f (N color (N R (N B t2 u uv t3) z zv (N B l k kv r)) y yv t1) -> Variant f (BalR' True (N R (N B t2 u uv t3) z zv (N B l k kv r)) y yv t1) Source # | |
BalanceableHelper (ShouldBalance (N R t2 z zv t3) t1) (N R t2 z zv t3) y yv t1 => BalanceableHelperR True (N B t2 z zv t3) y yv t1 Source # | |
Defined in Data.RBR.Internal |
class Fuseable (l :: Map Symbol Type) (r :: Map Symbol Type) where Source #
fuseRecord :: Record f l -> Record f r -> Record f (Fuse l r) Source #
fuseVariant :: Either (Variant f l) (Variant f r) -> Variant f (Fuse l r) Source #
Instances
Fuseable (E :: Map Symbol Type) (E :: Map Symbol Type) Source # | |
Fuseable (E :: Map Symbol Type) (N color left k v right) Source # | |
Defined in Data.RBR.Internal | |
Fuseable (N color left k v right) (E :: Map Symbol Type) Source # | |
Defined in Data.RBR.Internal | |
(Fuseable right1 left2, Fuse right1 left2 ~ fused, FuseableHelper1 fused (N R left1 k1 v1 right1) (N R left2 k2 v2 right2)) => Fuseable (N R left1 k1 v1 right1) (N R left2 k2 v2 right2) Source # | |
Defined in Data.RBR.Internal fuseRecord :: Record f (N R left1 k1 v1 right1) -> Record f (N R left2 k2 v2 right2) -> Record f (Fuse (N R left1 k1 v1 right1) (N R left2 k2 v2 right2)) Source # fuseVariant :: Either (Variant f (N R left1 k1 v1 right1)) (Variant f (N R left2 k2 v2 right2)) -> Variant f (Fuse (N R left1 k1 v1 right1) (N R left2 k2 v2 right2)) Source # | |
Fuseable right1 (N B left2 k2 v2 right2) => Fuseable (N R left1 k1 v1 right1) (N B left2 k2 v2 right2) Source # | |
Defined in Data.RBR.Internal fuseRecord :: Record f (N R left1 k1 v1 right1) -> Record f (N B left2 k2 v2 right2) -> Record f (Fuse (N R left1 k1 v1 right1) (N B left2 k2 v2 right2)) Source # fuseVariant :: Either (Variant f (N R left1 k1 v1 right1)) (Variant f (N B left2 k2 v2 right2)) -> Variant f (Fuse (N R left1 k1 v1 right1) (N B left2 k2 v2 right2)) Source # | |
(Fuseable right1 left2, Fuse right1 left2 ~ fused, FuseableHelper2 fused (N B left1 k1 v1 right1) (N B left2 k2 v2 right2)) => Fuseable (N B left1 k1 v1 right1) (N B left2 k2 v2 right2) Source # | |
Defined in Data.RBR.Internal fuseRecord :: Record f (N B left1 k1 v1 right1) -> Record f (N B left2 k2 v2 right2) -> Record f (Fuse (N B left1 k1 v1 right1) (N B left2 k2 v2 right2)) Source # fuseVariant :: Either (Variant f (N B left1 k1 v1 right1)) (Variant f (N B left2 k2 v2 right2)) -> Variant f (Fuse (N B left1 k1 v1 right1) (N B left2 k2 v2 right2)) Source # | |
Fuseable (N B left1 k1 v1 right1) left2 => Fuseable (N B left1 k1 v1 right1) (N R left2 k2 v2 right2) Source # | |
Defined in Data.RBR.Internal fuseRecord :: Record f (N B left1 k1 v1 right1) -> Record f (N R left2 k2 v2 right2) -> Record f (Fuse (N B left1 k1 v1 right1) (N R left2 k2 v2 right2)) Source # fuseVariant :: Either (Variant f (N B left1 k1 v1 right1)) (Variant f (N R left2 k2 v2 right2)) -> Variant f (Fuse (N B left1 k1 v1 right1) (N R left2 k2 v2 right2)) Source # |
class FuseableHelper1 (fused :: Map Symbol Type) (l :: Map Symbol Type) (r :: Map Symbol Type) where Source #
fuseRecord1 :: Record f l -> Record f r -> Record f (Fuse l r) Source #
fuseVariant1 :: Either (Variant f l) (Variant f r) -> Variant f (Fuse l r) Source #
Instances
FuseableHelper1 (E :: Map Symbol Type) (N R left1 k1 v1 (E :: Map Symbol Type)) (N R (E :: Map Symbol Type) k2 v2 right2) Source # | |
Defined in Data.RBR.Internal fuseRecord1 :: Record f (N R left1 k1 v1 E) -> Record f (N R E k2 v2 right2) -> Record f (Fuse (N R left1 k1 v1 E) (N R E k2 v2 right2)) Source # fuseVariant1 :: Either (Variant f (N R left1 k1 v1 E)) (Variant f (N R E k2 v2 right2)) -> Variant f (Fuse (N R left1 k1 v1 E) (N R E k2 v2 right2)) Source # | |
(Fuseable right1 left2, Fuse right1 left2 ~ N R s1 z zv s2) => FuseableHelper1 (N R s1 z zv s2) (N R left1 k1 v1 right1) (N R left2 k2 v2 right2) Source # | |
Defined in Data.RBR.Internal type Fuse1 (N R s1 z zv s2) (N R left1 k1 v1 right1) (N R left2 k2 v2 right2) :: Map Symbol Type Source # fuseRecord1 :: Record f (N R left1 k1 v1 right1) -> Record f (N R left2 k2 v2 right2) -> Record f (Fuse (N R left1 k1 v1 right1) (N R left2 k2 v2 right2)) Source # fuseVariant1 :: Either (Variant f (N R left1 k1 v1 right1)) (Variant f (N R left2 k2 v2 right2)) -> Variant f (Fuse (N R left1 k1 v1 right1) (N R left2 k2 v2 right2)) Source # | |
(Fuseable right1 left2, Fuse right1 left2 ~ N B s1 z zv s2) => FuseableHelper1 (N B s1 z zv s2) (N R left1 k1 v1 right1) (N R left2 k2 v2 right2) Source # | |
Defined in Data.RBR.Internal type Fuse1 (N B s1 z zv s2) (N R left1 k1 v1 right1) (N R left2 k2 v2 right2) :: Map Symbol Type Source # fuseRecord1 :: Record f (N R left1 k1 v1 right1) -> Record f (N R left2 k2 v2 right2) -> Record f (Fuse (N R left1 k1 v1 right1) (N R left2 k2 v2 right2)) Source # fuseVariant1 :: Either (Variant f (N R left1 k1 v1 right1)) (Variant f (N R left2 k2 v2 right2)) -> Variant f (Fuse (N R left1 k1 v1 right1) (N R left2 k2 v2 right2)) Source # |
class FuseableHelper2 (fused :: Map Symbol Type) (l :: Map Symbol Type) (r :: Map Symbol Type) where Source #
fuseRecord2 :: Record f l -> Record f r -> Record f (Fuse l r) Source #
fuseVariant2 :: Either (Variant f l) (Variant f r) -> Variant f (Fuse l r) Source #
Instances
BalanceableL left1 k1 v1 (N B (E :: Map Symbol Type) k2 v2 right2) => FuseableHelper2 (E :: Map Symbol Type) (N B left1 k1 v1 (E :: Map Symbol Type)) (N B (E :: Map Symbol Type) k2 v2 right2) Source # | |
Defined in Data.RBR.Internal fuseRecord2 :: Record f (N B left1 k1 v1 E) -> Record f (N B E k2 v2 right2) -> Record f (Fuse (N B left1 k1 v1 E) (N B E k2 v2 right2)) Source # fuseVariant2 :: Either (Variant f (N B left1 k1 v1 E)) (Variant f (N B E k2 v2 right2)) -> Variant f (Fuse (N B left1 k1 v1 E) (N B E k2 v2 right2)) Source # | |
(Fuseable right1 left2, Fuse right1 left2 ~ N R s1 z zv s2) => FuseableHelper2 (N R s1 z zv s2) (N B left1 k1 v1 right1) (N B left2 k2 v2 right2) Source # | |
Defined in Data.RBR.Internal type Fuse2 (N R s1 z zv s2) (N B left1 k1 v1 right1) (N B left2 k2 v2 right2) :: Map Symbol Type Source # fuseRecord2 :: Record f (N B left1 k1 v1 right1) -> Record f (N B left2 k2 v2 right2) -> Record f (Fuse (N B left1 k1 v1 right1) (N B left2 k2 v2 right2)) Source # fuseVariant2 :: Either (Variant f (N B left1 k1 v1 right1)) (Variant f (N B left2 k2 v2 right2)) -> Variant f (Fuse (N B left1 k1 v1 right1) (N B left2 k2 v2 right2)) Source # | |
(Fuseable right1 left2, Fuse right1 left2 ~ N B s1 z zv s2, BalanceableL left1 k1 v1 (N B (N B s1 z zv s2) k2 v2 right2)) => FuseableHelper2 (N B s1 z zv s2) (N B left1 k1 v1 right1) (N B left2 k2 v2 right2) Source # | |
Defined in Data.RBR.Internal type Fuse2 (N B s1 z zv s2) (N B left1 k1 v1 right1) (N B left2 k2 v2 right2) :: Map Symbol Type Source # fuseRecord2 :: Record f (N B left1 k1 v1 right1) -> Record f (N B left2 k2 v2 right2) -> Record f (Fuse (N B left1 k1 v1 right1) (N B left2 k2 v2 right2)) Source # fuseVariant2 :: Either (Variant f (N B left1 k1 v1 right1)) (Variant f (N B left2 k2 v2 right2)) -> Variant f (Fuse (N B left1 k1 v1 right1) (N B left2 k2 v2 right2)) Source # |
class Delable (k :: Symbol) (v :: Type) (t :: Map Symbol Type) where Source #
del :: Record f t -> Record f (Del k v t) Source #
win :: Variant f t -> Either (Variant f (Del k v t)) (f v) Source #
class DelableL (k :: Symbol) (v :: Type) (l :: Map Symbol Type) (kx :: Symbol) (vx :: Type) (r :: Map Symbol Type) where Source #
delL :: Record f (N color l kx vx r) -> Record f (DelL k v l kx vx r) Source #
winL :: Variant f (N color l kx vx r) -> Either (Variant f (DelL k v l kx vx r)) (f v) Source #
Instances
DelableL k v (E :: Map Symbol Type) kx vx right Source # | |
Delable k v (N R leftz kz vz rightz) => DelableL k v (N R leftz kz vz rightz) kx vx right Source # | |
Defined in Data.RBR.Internal | |
(Delable k v (N B leftz kz vz rightz), BalanceableL (Del k v (N B leftz kz vz rightz)) kx vx right) => DelableL k v (N B leftz kz vz rightz) kx vx right Source # | |
Defined in Data.RBR.Internal |
class DelableR (k :: Symbol) (v :: Type) (l :: Map Symbol Type) (kx :: Symbol) (vx :: Type) (r :: Map Symbol Type) where Source #
delR :: Record f (N color l kx vx r) -> Record f (DelR k v l kx vx r) Source #
winR :: Variant f (N color l kx vx r) -> Either (Variant f (DelR k v l kx vx r)) (f v) Source #
Instances
DelableR k v left kx vx (E :: Map Symbol Type) Source # | |
Delable k v (N R leftz kz vz rightz) => DelableR k v left kx vx (N R leftz kz vz rightz) Source # | |
Defined in Data.RBR.Internal | |
(Delable k v (N B leftz kz vz rightz), BalanceableR left kx vx (Del k v (N B leftz kz vz rightz))) => DelableR k v left kx vx (N B leftz kz vz rightz) Source # | |
Defined in Data.RBR.Internal |
class DelableHelper (ordering :: Ordering) (k :: Symbol) (v :: Type) (l :: Map Symbol Type) (kx :: Symbol) (vx :: Type) (r :: Map Symbol Type) where Source #
del' :: Record f (N color l kx vx r) -> Record f (Del' ordering k v l kx vx r) Source #
win' :: Variant f (N color l kx vx r) -> Either (Variant f (Del' ordering k v l kx vx r)) (f v) Source #
Instances
DelableR k v left kx vx right => DelableHelper LT k v left kx vx right Source # | |
Fuseable left right => DelableHelper EQ k v left k v right Source # | |
DelableL k v left kx vx right => DelableHelper GT k v left kx vx right Source # | |
class Deletable (k :: Symbol) (v :: Type) (t :: Map Symbol Type) where Source #
delete :: Record f t -> Record f (Delete k v t) Source #
winnow :: Variant f t -> Either (Variant f (Delete k v t)) (f v) Source #
Instances
(Delable k v t, CanMakeBlack (Del k v t)) => Deletable k v t Source # | Class that determines if the pair of a The associated type family At the term level, this manifests in
If the tree already has the key but with a different type, the deletion fails to compile. |