open-union-0.4.0.0: Extensible, type-safe unions.

Safe HaskellNone
LanguageHaskell98

Data.OpenUnion

Description

Flexible, type-safe open unions.

Synopsis

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.

Instances

(Typeable * a, Eq (Union (Delete * a as)), Eq a) => Eq (Union ((:) * a as)) Source # 

Methods

(==) :: Union ((* ': a) as) -> Union ((* ': a) as) -> Bool #

(/=) :: Union ((* ': a) as) -> Union ((* ': a) as) -> Bool #

Eq (Union ([] *)) Source # 

Methods

(==) :: Union [*] -> Union [*] -> Bool #

(/=) :: Union [*] -> Union [*] -> Bool #

(Ord a, Typeable * a, Ord (Union (Delete * a as))) => Ord (Union ((:) * a as)) Source # 

Methods

compare :: Union ((* ': a) as) -> Union ((* ': a) as) -> Ordering #

(<) :: Union ((* ': a) as) -> Union ((* ': a) as) -> Bool #

(<=) :: Union ((* ': a) as) -> Union ((* ': a) as) -> Bool #

(>) :: Union ((* ': a) as) -> Union ((* ': a) as) -> Bool #

(>=) :: Union ((* ': a) as) -> Union ((* ': a) as) -> Bool #

max :: Union ((* ': a) as) -> Union ((* ': a) as) -> Union ((* ': a) as) #

min :: Union ((* ': a) as) -> Union ((* ': a) as) -> Union ((* ': a) as) #

Ord (Union ([] *)) Source # 

Methods

compare :: Union [*] -> Union [*] -> Ordering #

(<) :: Union [*] -> Union [*] -> Bool #

(<=) :: Union [*] -> Union [*] -> Bool #

(>) :: Union [*] -> Union [*] -> Bool #

(>=) :: Union [*] -> Union [*] -> Bool #

max :: Union [*] -> Union [*] -> Union [*] #

min :: Union [*] -> Union [*] -> Union [*] #

(Show a, Show (Union (Delete * a as)), Typeable * a) => Show (Union ((:) * a as)) Source # 

Methods

showsPrec :: Int -> Union ((* ': a) as) -> ShowS #

show :: Union ((* ': a) as) -> String #

showList :: [Union ((* ': a) as)] -> ShowS #

Show (Union ([] *)) Source # 

Methods

showsPrec :: Int -> Union [*] -> ShowS #

show :: Union [*] -> String #

showList :: [Union [*]] -> ShowS #

(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 # 

Methods

toException :: Union ((* ': e) ((* ': e1) es)) -> SomeException #

fromException :: SomeException -> Maybe (Union ((* ': e) ((* ': e1) es))) #

displayException :: Union ((* ': e) ((* ': e1) es)) -> String #

Exception e => Exception (Union ((:) * e ([] *))) Source # 

Methods

toException :: Union ((* ': e) [*]) -> SomeException #

fromException :: SomeException -> Maybe (Union ((* ': e) [*])) #

displayException :: Union ((* ': e) [*]) -> String #

(@>) :: Typeable a => (a -> b) -> (Union (Delete a s) -> b) -> Union s -> b infixr 2 Source #

restrict in right-fixable style.

liftUnion :: (Typeable a, Elem a s) => a -> Union s Source #

reUnion :: SubList s s' => Union s -> Union s' Source #

Generalize a Union.

flattenUnion :: Union s -> Union (FlatElems s) Source #

Flatten a Union.

restrict :: Typeable a => Union s -> Either (Union (Delete a s)) a Source #

Narrow down a Union.

typesExhausted :: Union '[] -> a Source #

Use this in places where all the Unioned options have been exhausted.