Copyright | (c) Fumiaki Kinoshita 2015 |
---|---|

License | BSD3 |

Maintainer | Fumiaki Kinoshita <fumiexcel@gmail.com> |

Stability | experimental |

Portability | non-portable |

Safe Haskell | Safe |

Language | Haskell2010 |

- data h :| s where
- EmbedAt :: !(Membership xs x) -> h x -> h :| xs

- hoist :: (forall x. g x -> h x) -> (g :| xs) -> h :| xs
- embed :: x ∈ xs => h x -> h :| xs
- strike :: forall h x xs. x ∈ xs => (h :| xs) -> Maybe (h x)
- strikeAt :: forall h x xs. Membership xs x -> (h :| xs) -> Maybe (h x)
- (<:|) :: (h x -> r) -> ((h :| xs) -> r) -> (h :| (x : xs)) -> r
- exhaust :: (h :| `[]`) -> r
- picked :: forall f h x xs. (x ∈ xs, Applicative f) => (h x -> f (h x)) -> (h :| xs) -> f (h :| xs)
- embedAssoc :: Associate k a xs => h (k :> a) -> h :| xs

# Documentation

The extensible sum type

(:|) :: (k -> *) -> [k] -> *

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

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

Try to extract something you want.

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

Try to extract something you want.

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

*O(1)* Naive pattern match

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

Deprecated: Use piece instead

A traversal that tries to point a specific element.

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

Embed a value, but focuses on its key.