freer-0.2.2.5: Implementation of the Freer Monad

CopyrightAlej Cabrera 2015
LicenseBSD-3
Maintainercpp.cabrera@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Data.Open.Union

Description

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.

Documentation

data Union r v Source

decomp :: Union (t : r) v -> Either (Union r v) (t v) Source

weaken :: Union r w -> Union (any : r) w Source

class Member' t r (FindElem t r) => Member t r where Source

Methods

inj :: t v -> Union r v Source

prj :: Union r v -> Maybe (t v) Source

Instances

Member' t r (FindElem t r) => Member t r Source 

type family Members m r :: Constraint Source

Equations

Members (t : c) r = (Member t r, Members c r) 
Members `[]` r = ()