extensible-0.3.3: Extensible, efficient, lens-friendly data types

Copyright(c) Fumiaki Kinoshita 2015
LicenseBSD3
MaintainerFumiaki Kinoshita <fumiexcel@gmail.com>
Stabilityexperimental
Portabilitynon-portable
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 => Membership ys :* xs Source

Reify the inclusion of type level sets.

shrink :: xs ys => (h :* ys) -> h :* xs Source

O(m log n) Select some elements.

spread :: xs ys => (h :| xs) -> h :| ys Source

O(log n) 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 Source

Minimal complete definition

getAssociation

Instances

Associate k k1 k2 v xs => Associated (Assoc k k) xs ((:>) k k k v) 

inclusionAssoc :: forall xs ys. IncludeAssoc ys xs => Membership ys :* xs Source

Reify the inclusion of type level sets.

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

O(m log n) Select some elements.

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

O(log n) Embed to a larger union.

Inverse

coinclusion :: (Include ys xs, Generate ys) => Nullable (Membership xs) :* ys Source

The inverse of inclusion.

wrench :: (Generate ys, xs ys) => (h :* xs) -> Nullable h :* ys Source

Extend a product and fill missing fields by Null.

retrench :: (Generate ys, xs ys) => (h :| ys) -> Nullable ((:|) h) xs Source

Narrow the range of the sum, if possible.

data Nullable h x Source

Poly-kinded Maybe

Constructors

Null 
Eine (h x) 

Instances

Typeable ((k -> *) -> k -> *) (Nullable k) 
Eq (h x) => Eq (Nullable k h x) 
Ord (h x) => Ord (Nullable k h x) 
Show (h x) => Show (Nullable k h x) 

nullable :: r -> (h x -> r) -> Nullable h x -> r Source

Destruct Nullable.

mapNullable :: (g x -> h y) -> Nullable g x -> Nullable h y Source

Apply a function to its content.