Copyright | (c) 2016 Allele Dev; 2017 Ixperta Solutions s.r.o. |
---|---|

License | BSD3 |

Maintainer | ixcom-core@ixperta.com |

Stability | experimental |

Portability | GHC specific language extensions. |

Safe Haskell | None |

Language | Haskell2010 |

This implementation relies on _closed_ type families added to GHC 7.8. It
has NO overlapping instances and NO `Typeable`

. Alas, the absence of
`Typeable`

means the projections and injections generally take linear time.
The code illustrate how to use closed type families to disambiguate
otherwise overlapping instances.

The data constructors of `Union`

are not exported. Essentially, the nested
`Either`

data type.

Using http://okmij.org/ftp/Haskell/extensible/OpenUnion41.hs as a starting point.

# Open Union

# Open Union Operations

# Open Union Membership Constraints

class FindElem t r => Member t r where Source #

This type class is used for two following purposes:

- As a
`Constraint`

it guarantees that`t :: * -> *`

is a member of a type-list`r :: [* -> *]`

. - Provides a way how to inject/project
`t :: * -> *`

into/from a`Union`

, respectively.

Following law has to hold:

`prj`

.`inj`

===`Just`