Safe Haskell | None |
---|---|
Language | Haskell98 |
Flexible, type-safe open unions.
- data Union (s :: [*])
- (@>) :: Typeable a => (a -> b) -> (Union (Delete a s) -> b) -> Union s -> b
- liftUnion :: (Typeable a, Elem a s) => a -> Union s
- reUnion :: SubList s s' => Union s -> Union s'
- flattenUnion :: Union s -> Union (FlatElems s)
- restrict :: Typeable a => Union s -> Either (Union (Delete a s)) a
- typesExhausted :: Union '[] -> a
Documentation
data Union (s :: [*]) Source #
The Union
type - the phantom parameter s
is a list of types
denoting what this Union
might contain.
The value contained is one of those types.
(Typeable * a, Eq (Union (Delete * a as)), Eq a) => Eq (Union ((:) * a as)) Source # | |
Eq (Union ([] *)) Source # | |
(Ord a, Typeable * a, Ord (Union (Delete * a as))) => Ord (Union ((:) * a as)) Source # | |
Ord (Union ([] *)) Source # | |
(Show a, Show (Union (Delete * a as)), Typeable * a) => Show (Union ((:) * a as)) Source # | |
Show (Union ([] *)) Source # | |
(Exception e, Typeable * e, Typeable [*] es, Typeable * e1, Exception (Union (Delete * e ((:) * e1 es))), SubList * (Delete * e ((:) * e1 es)) ((:) * e ((:) * e1 es))) => Exception (Union ((:) * e ((:) * e1 es))) Source # | |
Exception e => Exception (Union ((:) * e ([] *))) Source # | |
(@>) :: Typeable a => (a -> b) -> (Union (Delete a s) -> b) -> Union s -> b infixr 2 Source #
restrict
in right-fixable style.
flattenUnion :: Union s -> Union (FlatElems s) Source #
Flatten a Union
.
typesExhausted :: Union '[] -> a Source #
Use this in places where all the Union
ed options have been exhausted.