extensible-0.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.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.

(<:|) :: (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.