extensible-0.8: Extensible, efficient, optics-friendly data types and effects

Copyright(c) Fumiaki Kinoshita 2018
LicenseBSD3
MaintainerFumiaki Kinoshita <fumiexcel@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Data.Extensible.Inclusion

Contents

Description

 
Synopsis

Inclusion

type (⊆) xs ys = Include ys xs Source #

Unicode alias for Include

type Include ys = Forall (Member ys) Source #

ys contains xs

inclusion :: forall xs ys. Include ys xs => xs :& Membership ys Source #

Reify the inclusion of type level sets.

shrink :: xs ys => (ys :& h) -> xs :& h Source #

O(n) Select some elements.

spread :: xs ys => (xs :/ h) -> ys :/ h Source #

O(1) Embed to a larger union.

Key-value

type IncludeAssoc ys = Forall (Associated ys) Source #

Similar to Include, but this focuses on keys.

class Associated' xs t => Associated xs t Source #

Associated xs (k ':> v) is equivalent to Associate k v xs

Minimal complete definition

getAssociation

Instances
(Associated' xs t, t ~ (k2 :> v2)) => Associated (xs :: [Assoc k1 v1]) (t :: Assoc k1 v1) Source # 
Instance details

Defined in Data.Extensible.Inclusion

Methods

getAssociation :: Membership xs t

type family Associated' (xs :: [Assoc k v]) (t :: Assoc k v) :: Constraint where ... Source #

Equations

Associated' xs (k :> v) = Lookup xs k v 

inclusionAssoc :: forall xs ys. IncludeAssoc ys xs => xs :& Membership ys Source #

Reify the inclusion of type level sets.

shrinkAssoc :: IncludeAssoc ys xs => (ys :& h) -> xs :& h Source #

O(n) Select some elements.

spreadAssoc :: IncludeAssoc ys xs => (xs :/ h) -> ys :/ h Source #

O(1) Embed to a larger union.