{-# LANGUAGE DeriveGeneric, DeriveTraversable, FlexibleInstances, KindSignatures, MultiParamTypeClasses, TypeOperators #-}
module Control.Effect.Sum
( (:+:)(..)
, Member(..)
) where

import GHC.Generics (Generic1)

data (f :+: g) (m :: * -> *) k
  = L (f m k)
  | R (g m k)
  deriving ((:+:) f g m k -> (:+:) f g m k -> Bool
((:+:) f g m k -> (:+:) f g m k -> Bool)
-> ((:+:) f g m k -> (:+:) f g m k -> Bool) -> Eq ((:+:) f g m k)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Eq (f m k), Eq (g m k)) =>
(:+:) f g m k -> (:+:) f g m k -> Bool
/= :: (:+:) f g m k -> (:+:) f g m k -> Bool
$c/= :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Eq (f m k), Eq (g m k)) =>
(:+:) f g m k -> (:+:) f g m k -> Bool
== :: (:+:) f g m k -> (:+:) f g m k -> Bool
$c== :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Eq (f m k), Eq (g m k)) =>
(:+:) f g m k -> (:+:) f g m k -> Bool
Eq, (:+:) f g m a -> Bool
(a -> m) -> (:+:) f g m a -> m
(a -> b -> b) -> b -> (:+:) f g m a -> b
(forall m. Monoid m => (:+:) f g m m -> m)
-> (forall m a. Monoid m => (a -> m) -> (:+:) f g m a -> m)
-> (forall m a. Monoid m => (a -> m) -> (:+:) f g m a -> m)
-> (forall a b. (a -> b -> b) -> b -> (:+:) f g m a -> b)
-> (forall a b. (a -> b -> b) -> b -> (:+:) f g m a -> b)
-> (forall b a. (b -> a -> b) -> b -> (:+:) f g m a -> b)
-> (forall b a. (b -> a -> b) -> b -> (:+:) f g m a -> b)
-> (forall a. (a -> a -> a) -> (:+:) f g m a -> a)
-> (forall a. (a -> a -> a) -> (:+:) f g m a -> a)
-> (forall a. (:+:) f g m a -> [a])
-> (forall a. (:+:) f g m a -> Bool)
-> (forall a. (:+:) f g m a -> Int)
-> (forall a. Eq a => a -> (:+:) f g m a -> Bool)
-> (forall a. Ord a => (:+:) f g m a -> a)
-> (forall a. Ord a => (:+:) f g m a -> a)
-> (forall a. Num a => (:+:) f g m a -> a)
-> (forall a. Num a => (:+:) f g m a -> a)
-> Foldable ((:+:) f g m)
forall a. Eq a => a -> (:+:) f g m a -> Bool
forall a. Num a => (:+:) f g m a -> a
forall a. Ord a => (:+:) f g m a -> a
forall m. Monoid m => (:+:) f g m m -> m
forall a. (:+:) f g m a -> Bool
forall a. (:+:) f g m a -> Int
forall a. (:+:) f g m a -> [a]
forall a. (a -> a -> a) -> (:+:) f g m a -> a
forall m a. Monoid m => (a -> m) -> (:+:) f g m a -> m
forall b a. (b -> a -> b) -> b -> (:+:) f g m a -> b
forall a b. (a -> b -> b) -> b -> (:+:) f g m a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
(Foldable (f m), Foldable (g m), Eq a) =>
a -> (:+:) f g m a -> Bool
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
(Foldable (f m), Foldable (g m), Num a) =>
(:+:) f g m a -> a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
(Foldable (f m), Foldable (g m), Ord a) =>
(:+:) f g m a -> a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) m.
(Foldable (f m), Foldable (g m), Monoid m) =>
(:+:) f g m m -> m
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
(Foldable (f m), Foldable (g m)) =>
(:+:) f g m a -> Bool
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
(Foldable (f m), Foldable (g m)) =>
(:+:) f g m a -> Int
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
(Foldable (f m), Foldable (g m)) =>
(:+:) f g m a -> [a]
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
(Foldable (f m), Foldable (g m)) =>
(a -> a -> a) -> (:+:) f g m a -> a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) m a.
(Foldable (f m), Foldable (g m), Monoid m) =>
(a -> m) -> (:+:) f g m a -> m
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) b a.
(Foldable (f m), Foldable (g m)) =>
(b -> a -> b) -> b -> (:+:) f g m a -> b
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
(Foldable (f m), Foldable (g m)) =>
(a -> b -> b) -> b -> (:+:) f g m a -> b
product :: (:+:) f g m a -> a
$cproduct :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
(Foldable (f m), Foldable (g m), Num a) =>
(:+:) f g m a -> a
sum :: (:+:) f g m a -> a
$csum :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
(Foldable (f m), Foldable (g m), Num a) =>
(:+:) f g m a -> a
minimum :: (:+:) f g m a -> a
$cminimum :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
(Foldable (f m), Foldable (g m), Ord a) =>
(:+:) f g m a -> a
maximum :: (:+:) f g m a -> a
$cmaximum :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
(Foldable (f m), Foldable (g m), Ord a) =>
(:+:) f g m a -> a
elem :: a -> (:+:) f g m a -> Bool
$celem :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
(Foldable (f m), Foldable (g m), Eq a) =>
a -> (:+:) f g m a -> Bool
length :: (:+:) f g m a -> Int
$clength :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
(Foldable (f m), Foldable (g m)) =>
(:+:) f g m a -> Int
null :: (:+:) f g m a -> Bool
$cnull :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
(Foldable (f m), Foldable (g m)) =>
(:+:) f g m a -> Bool
toList :: (:+:) f g m a -> [a]
$ctoList :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
(Foldable (f m), Foldable (g m)) =>
(:+:) f g m a -> [a]
foldl1 :: (a -> a -> a) -> (:+:) f g m a -> a
$cfoldl1 :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
(Foldable (f m), Foldable (g m)) =>
(a -> a -> a) -> (:+:) f g m a -> a
foldr1 :: (a -> a -> a) -> (:+:) f g m a -> a
$cfoldr1 :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
(Foldable (f m), Foldable (g m)) =>
(a -> a -> a) -> (:+:) f g m a -> a
foldl' :: (b -> a -> b) -> b -> (:+:) f g m a -> b
$cfoldl' :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) b a.
(Foldable (f m), Foldable (g m)) =>
(b -> a -> b) -> b -> (:+:) f g m a -> b
foldl :: (b -> a -> b) -> b -> (:+:) f g m a -> b
$cfoldl :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) b a.
(Foldable (f m), Foldable (g m)) =>
(b -> a -> b) -> b -> (:+:) f g m a -> b
foldr' :: (a -> b -> b) -> b -> (:+:) f g m a -> b
$cfoldr' :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
(Foldable (f m), Foldable (g m)) =>
(a -> b -> b) -> b -> (:+:) f g m a -> b
foldr :: (a -> b -> b) -> b -> (:+:) f g m a -> b
$cfoldr :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
(Foldable (f m), Foldable (g m)) =>
(a -> b -> b) -> b -> (:+:) f g m a -> b
foldMap' :: (a -> m) -> (:+:) f g m a -> m
$cfoldMap' :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) m a.
(Foldable (f m), Foldable (g m), Monoid m) =>
(a -> m) -> (:+:) f g m a -> m
foldMap :: (a -> m) -> (:+:) f g m a -> m
$cfoldMap :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) m a.
(Foldable (f m), Foldable (g m), Monoid m) =>
(a -> m) -> (:+:) f g m a -> m
fold :: (:+:) f g m m -> m
$cfold :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) m.
(Foldable (f m), Foldable (g m), Monoid m) =>
(:+:) f g m m -> m
Foldable, a -> (:+:) f g m b -> (:+:) f g m a
(a -> b) -> (:+:) f g m a -> (:+:) f g m b
(forall a b. (a -> b) -> (:+:) f g m a -> (:+:) f g m b)
-> (forall a b. a -> (:+:) f g m b -> (:+:) f g m a)
-> Functor ((:+:) f g m)
forall a b. a -> (:+:) f g m b -> (:+:) f g m a
forall a b. (a -> b) -> (:+:) f g m a -> (:+:) f g m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
(Functor (f m), Functor (g m)) =>
a -> (:+:) f g m b -> (:+:) f g m a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
(Functor (f m), Functor (g m)) =>
(a -> b) -> (:+:) f g m a -> (:+:) f g m b
<$ :: a -> (:+:) f g m b -> (:+:) f g m a
$c<$ :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
(Functor (f m), Functor (g m)) =>
a -> (:+:) f g m b -> (:+:) f g m a
fmap :: (a -> b) -> (:+:) f g m a -> (:+:) f g m b
$cfmap :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
(Functor (f m), Functor (g m)) =>
(a -> b) -> (:+:) f g m a -> (:+:) f g m b
Functor, (forall a. (:+:) f g m a -> Rep1 ((:+:) f g m) a)
-> (forall a. Rep1 ((:+:) f g m) a -> (:+:) f g m a)
-> Generic1 ((:+:) f g m)
forall a. Rep1 ((:+:) f g m) a -> (:+:) f g m a
forall a. (:+:) f g m a -> Rep1 ((:+:) f g m) a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
Rep1 ((:+:) f g m) a -> (:+:) f g m a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
(:+:) f g m a -> Rep1 ((:+:) f g m) a
$cto1 :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
Rep1 ((:+:) f g m) a -> (:+:) f g m a
$cfrom1 :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
(:+:) f g m a -> Rep1 ((:+:) f g m) a
Generic1, Eq ((:+:) f g m k)
Eq ((:+:) f g m k) =>
((:+:) f g m k -> (:+:) f g m k -> Ordering)
-> ((:+:) f g m k -> (:+:) f g m k -> Bool)
-> ((:+:) f g m k -> (:+:) f g m k -> Bool)
-> ((:+:) f g m k -> (:+:) f g m k -> Bool)
-> ((:+:) f g m k -> (:+:) f g m k -> Bool)
-> ((:+:) f g m k -> (:+:) f g m k -> (:+:) f g m k)
-> ((:+:) f g m k -> (:+:) f g m k -> (:+:) f g m k)
-> Ord ((:+:) f g m k)
(:+:) f g m k -> (:+:) f g m k -> Bool
(:+:) f g m k -> (:+:) f g m k -> Ordering
(:+:) f g m k -> (:+:) f g m k -> (:+:) f g m k
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Ord (f m k), Ord (g m k)) =>
Eq ((:+:) f g m k)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Ord (f m k), Ord (g m k)) =>
(:+:) f g m k -> (:+:) f g m k -> Bool
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Ord (f m k), Ord (g m k)) =>
(:+:) f g m k -> (:+:) f g m k -> Ordering
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Ord (f m k), Ord (g m k)) =>
(:+:) f g m k -> (:+:) f g m k -> (:+:) f g m k
min :: (:+:) f g m k -> (:+:) f g m k -> (:+:) f g m k
$cmin :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Ord (f m k), Ord (g m k)) =>
(:+:) f g m k -> (:+:) f g m k -> (:+:) f g m k
max :: (:+:) f g m k -> (:+:) f g m k -> (:+:) f g m k
$cmax :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Ord (f m k), Ord (g m k)) =>
(:+:) f g m k -> (:+:) f g m k -> (:+:) f g m k
>= :: (:+:) f g m k -> (:+:) f g m k -> Bool
$c>= :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Ord (f m k), Ord (g m k)) =>
(:+:) f g m k -> (:+:) f g m k -> Bool
> :: (:+:) f g m k -> (:+:) f g m k -> Bool
$c> :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Ord (f m k), Ord (g m k)) =>
(:+:) f g m k -> (:+:) f g m k -> Bool
<= :: (:+:) f g m k -> (:+:) f g m k -> Bool
$c<= :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Ord (f m k), Ord (g m k)) =>
(:+:) f g m k -> (:+:) f g m k -> Bool
< :: (:+:) f g m k -> (:+:) f g m k -> Bool
$c< :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Ord (f m k), Ord (g m k)) =>
(:+:) f g m k -> (:+:) f g m k -> Bool
compare :: (:+:) f g m k -> (:+:) f g m k -> Ordering
$ccompare :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Ord (f m k), Ord (g m k)) =>
(:+:) f g m k -> (:+:) f g m k -> Ordering
$cp1Ord :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Ord (f m k), Ord (g m k)) =>
Eq ((:+:) f g m k)
Ord, Int -> (:+:) f g m k -> ShowS
[(:+:) f g m k] -> ShowS
(:+:) f g m k -> String
(Int -> (:+:) f g m k -> ShowS)
-> ((:+:) f g m k -> String)
-> ([(:+:) f g m k] -> ShowS)
-> Show ((:+:) f g m k)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Show (f m k), Show (g m k)) =>
Int -> (:+:) f g m k -> ShowS
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Show (f m k), Show (g m k)) =>
[(:+:) f g m k] -> ShowS
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Show (f m k), Show (g m k)) =>
(:+:) f g m k -> String
showList :: [(:+:) f g m k] -> ShowS
$cshowList :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Show (f m k), Show (g m k)) =>
[(:+:) f g m k] -> ShowS
show :: (:+:) f g m k -> String
$cshow :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Show (f m k), Show (g m k)) =>
(:+:) f g m k -> String
showsPrec :: Int -> (:+:) f g m k -> ShowS
$cshowsPrec :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
(Show (f m k), Show (g m k)) =>
Int -> (:+:) f g m k -> ShowS
Show, Functor ((:+:) f g m)
Foldable ((:+:) f g m)
(Functor ((:+:) f g m), Foldable ((:+:) f g m)) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> (:+:) f g m a -> f ((:+:) f g m b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    (:+:) f g m (f a) -> f ((:+:) f g m a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> (:+:) f g m a -> m ((:+:) f g m b))
-> (forall (m :: * -> *) a.
    Monad m =>
    (:+:) f g m (m a) -> m ((:+:) f g m a))
-> Traversable ((:+:) f g m)
(a -> f b) -> (:+:) f g m a -> f ((:+:) f g m b)
forall (t :: * -> *).
(Functor t, Foldable t) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
(:+:) f g m (m a) -> m ((:+:) f g m a)
forall (f :: * -> *) a.
Applicative f =>
(:+:) f g m (f a) -> f ((:+:) f g m a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> (:+:) f g m a -> m ((:+:) f g m b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> (:+:) f g m a -> f ((:+:) f g m b)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *).
(Traversable (f m), Traversable (g m)) =>
Functor ((:+:) f g m)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *).
(Traversable (f m), Traversable (g m)) =>
Foldable ((:+:) f g m)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) (m :: * -> *) a.
(Traversable (f m), Traversable (g m), Monad m) =>
(:+:) f g m (m a) -> m ((:+:) f g m a)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) (f :: * -> *) a.
(Traversable (f m), Traversable (g m), Applicative f) =>
(:+:) f g m (f a) -> f ((:+:) f g m a)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) (m :: * -> *) a b.
(Traversable (f m), Traversable (g m), Monad m) =>
(a -> m b) -> (:+:) f g m a -> m ((:+:) f g m b)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) (f :: * -> *) a b.
(Traversable (f m), Traversable (g m), Applicative f) =>
(a -> f b) -> (:+:) f g m a -> f ((:+:) f g m b)
sequence :: (:+:) f g m (m a) -> m ((:+:) f g m a)
$csequence :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) (m :: * -> *) a.
(Traversable (f m), Traversable (g m), Monad m) =>
(:+:) f g m (m a) -> m ((:+:) f g m a)
mapM :: (a -> m b) -> (:+:) f g m a -> m ((:+:) f g m b)
$cmapM :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) (m :: * -> *) a b.
(Traversable (f m), Traversable (g m), Monad m) =>
(a -> m b) -> (:+:) f g m a -> m ((:+:) f g m b)
sequenceA :: (:+:) f g m (f a) -> f ((:+:) f g m a)
$csequenceA :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) (f :: * -> *) a.
(Traversable (f m), Traversable (g m), Applicative f) =>
(:+:) f g m (f a) -> f ((:+:) f g m a)
traverse :: (a -> f b) -> (:+:) f g m a -> f ((:+:) f g m b)
$ctraverse :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) (f :: * -> *) a b.
(Traversable (f m), Traversable (g m), Applicative f) =>
(a -> f b) -> (:+:) f g m a -> f ((:+:) f g m b)
$cp2Traversable :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *).
(Traversable (f m), Traversable (g m)) =>
Foldable ((:+:) f g m)
$cp1Traversable :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *).
(Traversable (f m), Traversable (g m)) =>
Functor ((:+:) f g m)
Traversable)

infixr 4 :+:

class Member (sub :: (* -> *) -> (* -> *)) sup where
  inj :: sub m a -> sup m a
  prj :: sup m a -> Maybe (sub m a)

instance Member sub sub where
  inj :: sub m a -> sub m a
inj = sub m a -> sub m a
forall a. a -> a
id
  prj :: sub m a -> Maybe (sub m a)
prj = sub m a -> Maybe (sub m a)
forall a. a -> Maybe a
Just

instance {-# OVERLAPPABLE #-} Member sub (sub :+: sup) where
  inj :: sub m a -> (:+:) sub sup m a
inj = sub m a -> (:+:) sub sup m a
forall (sub :: (* -> *) -> * -> *) (sup :: (* -> *) -> * -> *)
       (m :: * -> *) a.
sub m a -> (:+:) sub sup m a
L (sub m a -> (:+:) sub sup m a)
-> (sub m a -> sub m a) -> sub m a -> (:+:) sub sup m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. sub m a -> sub m a
forall (sub :: (* -> *) -> * -> *) (sup :: (* -> *) -> * -> *)
       (m :: * -> *) a.
Member sub sup =>
sub m a -> sup m a
inj
  prj :: (:+:) sub sup m a -> Maybe (sub m a)
prj (L f :: sub m a
f) = sub m a -> Maybe (sub m a)
forall a. a -> Maybe a
Just sub m a
f
  prj _     = Maybe (sub m a)
forall a. Maybe a
Nothing

instance {-# OVERLAPPABLE #-} Member sub sup => Member sub (sub' :+: sup) where
  inj :: sub m a -> (:+:) sub' sup m a
inj = sup m a -> (:+:) sub' sup m a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) k.
g m k -> (:+:) f g m k
R (sup m a -> (:+:) sub' sup m a)
-> (sub m a -> sup m a) -> sub m a -> (:+:) sub' sup m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. sub m a -> sup m a
forall (sub :: (* -> *) -> * -> *) (sup :: (* -> *) -> * -> *)
       (m :: * -> *) a.
Member sub sup =>
sub m a -> sup m a
inj
  prj :: (:+:) sub' sup m a -> Maybe (sub m a)
prj (R g :: sup m a
g) = sup m a -> Maybe (sub m a)
forall (sub :: (* -> *) -> * -> *) (sup :: (* -> *) -> * -> *)
       (m :: * -> *) a.
Member sub sup =>
sup m a -> Maybe (sub m a)
prj sup m a
g
  prj _     = Maybe (sub m a)
forall a. Maybe a
Nothing