type-combinators-0.2.4.3: A collection of data types for type-level programming

Data.Type.Disjunction

Description

Two type combinators for working with disjunctions: A branch combinator '(:|:)', and a choice combinator '(:+:)'.

These are analogous to '(|||)' and '(+++)' from Arrow, respectively.

# Documentation

data f :|: g :: k -> * where infixr 4 Source #

Constructors

 L :: !(f a) -> (f :|: g) a R :: !(g a) -> (f :|: g) a

Instances

(>|<) :: (f a -> r) -> (g a -> r) -> (f :|: g) a -> r infixr 2 Source #

data f :+: g :: Either k l -> * where infixr 4 Source #

Constructors

 L' :: !(f a) -> (f :+: g) (Left a) R' :: !(g b) -> (f :+: g) (Right b)

Instances

 Witness p q (g b1) => Witness p q ((:+:) b k f g (Right k b b1)) Source # Associated Typestype WitnessC (p :: Constraint) (q :: Constraint) ((:+:) b k f g (Right k b b1)) :: Constraint Source # Methods(\\) :: p => (q -> r) -> (b :+: k) f g (Right k b b1) -> r Source # Witness p q (f a1) => Witness p q ((:+:) l a f g (Left a l a1)) Source # Associated Typestype WitnessC (p :: Constraint) (q :: Constraint) ((:+:) l a f g (Left a l a1)) :: Constraint Source # Methods(\\) :: p => (q -> r) -> (l :+: a) f g (Left a l a1) -> r Source # Bifunctor1 (Either k l) l k ((:+:) l k) Source # Methodsbimap1 :: (forall a. f a -> h a) -> (forall a. g a -> i a) -> t f g b -> t h i b Source # Traversable1 (Either k1 k) k ((:+:) k k1 f) Source # Methodstraverse1 :: Applicative h => (forall a. f a -> h (g a)) -> t f b -> h (t g b) Source # Foldable1 (Either k1 k) k ((:+:) k k1 f) Source # MethodsfoldMap1 :: Monoid m => (forall a. f a -> m) -> t f b -> m Source # Functor1 (Either k1 k) k ((:+:) k k1 f) Source # Methodsmap1 :: (forall a. f a -> g a) -> t f b -> t g b Source # (Read1 k f, Read1 l g) => Read1 (Either k l) ((:+:) l k f g) Source # MethodsreadsPrec1 :: Int -> ReadS (Some ((l :+: k) f g) f) Source # (Show1 k f, Show1 l g) => Show1 (Either k l) ((:+:) l k f g) Source # MethodsshowsPrec1 :: Int -> f a -> ShowS Source #show1 :: f a -> String Source # (Ord1 k f, Ord1 l g) => Ord1 (Either k l) ((:+:) l k f g) Source # Methodscompare1 :: f a -> f a -> Ordering Source #(<#) :: f a -> f a -> Bool Source #(>#) :: f a -> f a -> Bool Source #(<=#) :: f a -> f a -> Bool Source #(>=#) :: f a -> f a -> Bool Source # (Eq1 k f, Eq1 l g) => Eq1 (Either k l) ((:+:) l k f g) Source # Methodseq1 :: f a -> f a -> Bool Source #neq1 :: f a -> f a -> Bool Source # Known b g b1 => Known (Either k b) ((:+:) b k f g) (Right k b b1) Source # Associated Typestype KnownC ((:+:) b k f g) (Right k b b1 :: (:+:) b k f g -> *) (a :: (:+:) b k f g) :: Constraint Source # Methodsknown :: Right k b b1 a Source # Known a f a1 => Known (Either a l) ((:+:) l a f g) (Left a l a1) Source # Associated Typestype KnownC ((:+:) l a f g) (Left a l a1 :: (:+:) l a f g -> *) (a :: (:+:) l a f g) :: Constraint Source # Methodsknown :: Left a l a1 a Source # (Eq (f (FromLeft k l e)), Eq (g (FromRight k l e))) => Eq ((:+:) l k f g e) Source # Methods(==) :: (l :+: k) f g e -> (l :+: k) f g e -> Bool #(/=) :: (l :+: k) f g e -> (l :+: k) f g e -> Bool # (Ord (f (FromLeft k l e)), Ord (g (FromRight k l e))) => Ord ((:+:) l k f g e) Source # Methodscompare :: (l :+: k) f g e -> (l :+: k) f g e -> Ordering #(<) :: (l :+: k) f g e -> (l :+: k) f g e -> Bool #(<=) :: (l :+: k) f g e -> (l :+: k) f g e -> Bool #(>) :: (l :+: k) f g e -> (l :+: k) f g e -> Bool #(>=) :: (l :+: k) f g e -> (l :+: k) f g e -> Bool #max :: (l :+: k) f g e -> (l :+: k) f g e -> (l :+: k) f g e #min :: (l :+: k) f g e -> (l :+: k) f g e -> (l :+: k) f g e # (Show (f (FromLeft k l e)), Show (g (FromRight k l e))) => Show ((:+:) l k f g e) Source # MethodsshowsPrec :: Int -> (l :+: k) f g e -> ShowS #show :: (l :+: k) f g e -> String #showList :: [(l :+: k) f g e] -> ShowS # type WitnessC p q ((:+:) b k f g (Right k b b1)) Source # type WitnessC p q ((:+:) b k f g (Right k b b1)) = Witness p q (g b1) type WitnessC p q ((:+:) l a f g (Left a l a1)) Source # type WitnessC p q ((:+:) l a f g (Left a l a1)) = Witness p q (f a1) type KnownC (Either k b) ((:+:) b k f g) (Right k b b1) Source # type KnownC (Either k b) ((:+:) b k f g) (Right k b b1) = Known b g b1 type KnownC (Either a l) ((:+:) l a f g) (Left a l a1) Source # type KnownC (Either a l) ((:+:) l a f g) (Left a l a1) = Known a f a1

(>+<) :: (forall a. e ~ Left a => f a -> r) -> (forall b. e ~ Right b => g b -> r) -> (f :+: g) e -> r infixr 2 Source #