extensible-0.3.2: 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.Sum

Description

 

Synopsis

Documentation

data h :| s where Source

The extensible sum type

Constructors

UnionAt :: !(Membership xs x) -> h x -> h :| xs 

Instances

Typeable ((k -> *) -> [k] -> *) ((:|) k) 
WrapForall k * Eq h xs => Eq ((:|) k h xs) 
(Eq ((:|) k h xs), WrapForall k * Ord h xs) => Ord ((:|) k h xs) 
WrapForall k * Show h xs => Show ((:|) k h xs) 

hoist :: (forall x. g x -> h x) -> (g :| xs) -> h :| xs Source

Change the wrapper.

embed :: x xs => h x -> h :| xs Source

O(1) lift a value.

strike :: forall h x xs. x xs => (h :| xs) -> Maybe (h x) Source

strikeAt :: forall h x xs. Membership xs x -> (h :| xs) -> Maybe (h x) Source

(<:|) :: (h x -> r) -> ((h :| xs) -> r) -> (h :| (x : xs)) -> r infixr 1 Source

O(1) Naive pattern match

exhaust :: (h :| []) -> r Source

There is no empty union.

picked :: forall f h x xs. (x xs, Applicative f) => (h x -> f (h x)) -> (h :| xs) -> f (h :| xs) Source

A traversal that tries to point a specific element.

embedAssoc :: Associate k a xs => h (k :> a) -> h :| xs Source