extensible-0.2.1: Poly-kinded, extensible ADTs

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 :: Position xs x -> h x -> h :| xs 

Instances

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

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

Change the wrapper.

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

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