module Data.HFunctor (
HFunctor(..)
, overHFunctor
, Inject(..)
, HBind(..)
, ProxyF(..)
, ConstF(..)
, HLift(..), retractHLift
, HFree(..), foldHFree, retractHFree
, injectMap
, injectContramap
) where
import Control.Applicative.Backwards
import Control.Applicative.Free
import Control.Applicative.Lift
import Control.Applicative.ListF
import Control.Applicative.Step
import Control.Comonad.Trans.Env
import Control.Monad.Freer.Church
import Control.Monad.Reader
import Control.Monad.Trans.Compose
import Control.Monad.Trans.Identity
import Control.Natural
import Control.Natural.IsoF
import Data.Coerce
import Data.Data
import Data.Deriving
import Data.Functor.Bind
import Data.Functor.Classes
import Data.Functor.Contravariant
import Data.Functor.Contravariant.Conclude
import Data.Functor.Contravariant.Decide
import Data.Functor.Contravariant.Divise
import Data.Functor.Contravariant.Divisible
import Data.Functor.Coyoneda
import Data.Functor.Invariant
import Data.Functor.Plus
import Data.Functor.Product
import Data.Functor.Reverse
import Data.Functor.Sum
import Data.Functor.These
import Data.HFunctor.Internal
import Data.Kind
import Data.List.NonEmpty (NonEmpty(..))
import Data.Pointed
import Data.Semigroup.Foldable
import GHC.Generics
import qualified Control.Alternative.Free as Alt
import qualified Control.Applicative.Free.Fast as FAF
import qualified Control.Applicative.Free.Final as FA
import qualified Data.Functor.Contravariant.Coyoneda as CCY
import qualified Data.Map as M
import qualified Data.Map.NonEmpty as NEM
overHFunctor
:: HFunctor t
=> f <~> g
-> t f <~> t g
overHFunctor :: forall {k} {k} (t :: (k -> *) -> k -> *) (f :: k -> *)
(g :: k -> *).
HFunctor t =>
(f <~> g) -> t f <~> t g
overHFunctor f <~> g
f = (t f ~> t g) -> (t g ~> t f) -> t f <~> t g
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF ((f ~> g) -> t f ~> t g
forall {k} {k1} (t :: (k -> *) -> k1 -> *) (f :: k -> *)
(g :: k -> *).
HFunctor t =>
(f ~> g) -> t f ~> t g
forall (f :: k -> *) (g :: k -> *). (f ~> g) -> t f ~> t g
hmap ((f <~> g) -> f ~> g
forall {k} (f :: k -> *) (g :: k -> *). (f <~> g) -> f ~> g
viewF p (g a) (g a) -> p (f a) (f a)
f <~> g
f)) ((g ~> f) -> t g ~> t f
forall {k} {k1} (t :: (k -> *) -> k1 -> *) (f :: k -> *)
(g :: k -> *).
HFunctor t =>
(f ~> g) -> t f ~> t g
forall (f :: k -> *) (g :: k -> *). (f ~> g) -> t f ~> t g
hmap ((f <~> g) -> g ~> f
forall {k} (f :: k -> *) (g :: k -> *). (f <~> g) -> g ~> f
reviewF p (g a) (g a) -> p (f a) (f a)
f <~> g
f))
data ProxyF f a = ProxyF
deriving (Int -> ProxyF f a -> ShowS
[ProxyF f a] -> ShowS
ProxyF f a -> String
(Int -> ProxyF f a -> ShowS)
-> (ProxyF f a -> String)
-> ([ProxyF f a] -> ShowS)
-> Show (ProxyF f a)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (f :: k) k (a :: k). Int -> ProxyF f a -> ShowS
forall k (f :: k) k (a :: k). [ProxyF f a] -> ShowS
forall k (f :: k) k (a :: k). ProxyF f a -> String
$cshowsPrec :: forall k (f :: k) k (a :: k). Int -> ProxyF f a -> ShowS
showsPrec :: Int -> ProxyF f a -> ShowS
$cshow :: forall k (f :: k) k (a :: k). ProxyF f a -> String
show :: ProxyF f a -> String
$cshowList :: forall k (f :: k) k (a :: k). [ProxyF f a] -> ShowS
showList :: [ProxyF f a] -> ShowS
Show, ReadPrec [ProxyF f a]
ReadPrec (ProxyF f a)
Int -> ReadS (ProxyF f a)
ReadS [ProxyF f a]
(Int -> ReadS (ProxyF f a))
-> ReadS [ProxyF f a]
-> ReadPrec (ProxyF f a)
-> ReadPrec [ProxyF f a]
-> Read (ProxyF f a)
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall k (f :: k) k (a :: k). ReadPrec [ProxyF f a]
forall k (f :: k) k (a :: k). ReadPrec (ProxyF f a)
forall k (f :: k) k (a :: k). Int -> ReadS (ProxyF f a)
forall k (f :: k) k (a :: k). ReadS [ProxyF f a]
$creadsPrec :: forall k (f :: k) k (a :: k). Int -> ReadS (ProxyF f a)
readsPrec :: Int -> ReadS (ProxyF f a)
$creadList :: forall k (f :: k) k (a :: k). ReadS [ProxyF f a]
readList :: ReadS [ProxyF f a]
$creadPrec :: forall k (f :: k) k (a :: k). ReadPrec (ProxyF f a)
readPrec :: ReadPrec (ProxyF f a)
$creadListPrec :: forall k (f :: k) k (a :: k). ReadPrec [ProxyF f a]
readListPrec :: ReadPrec [ProxyF f a]
Read, ProxyF f a -> ProxyF f a -> Bool
(ProxyF f a -> ProxyF f a -> Bool)
-> (ProxyF f a -> ProxyF f a -> Bool) -> Eq (ProxyF f a)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (f :: k) k (a :: k). ProxyF f a -> ProxyF f a -> Bool
$c== :: forall k (f :: k) k (a :: k). ProxyF f a -> ProxyF f a -> Bool
== :: ProxyF f a -> ProxyF f a -> Bool
$c/= :: forall k (f :: k) k (a :: k). ProxyF f a -> ProxyF f a -> Bool
/= :: ProxyF f a -> ProxyF f a -> Bool
Eq, Eq (ProxyF f a)
Eq (ProxyF f a) =>
(ProxyF f a -> ProxyF f a -> Ordering)
-> (ProxyF f a -> ProxyF f a -> Bool)
-> (ProxyF f a -> ProxyF f a -> Bool)
-> (ProxyF f a -> ProxyF f a -> Bool)
-> (ProxyF f a -> ProxyF f a -> Bool)
-> (ProxyF f a -> ProxyF f a -> ProxyF f a)
-> (ProxyF f a -> ProxyF f a -> ProxyF f a)
-> Ord (ProxyF f a)
ProxyF f a -> ProxyF f a -> Bool
ProxyF f a -> ProxyF f a -> Ordering
ProxyF f a -> ProxyF f a -> ProxyF f a
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 k (f :: k) k (a :: k). Eq (ProxyF f a)
forall k (f :: k) k (a :: k). ProxyF f a -> ProxyF f a -> Bool
forall k (f :: k) k (a :: k). ProxyF f a -> ProxyF f a -> Ordering
forall k (f :: k) k (a :: k).
ProxyF f a -> ProxyF f a -> ProxyF f a
$ccompare :: forall k (f :: k) k (a :: k). ProxyF f a -> ProxyF f a -> Ordering
compare :: ProxyF f a -> ProxyF f a -> Ordering
$c< :: forall k (f :: k) k (a :: k). ProxyF f a -> ProxyF f a -> Bool
< :: ProxyF f a -> ProxyF f a -> Bool
$c<= :: forall k (f :: k) k (a :: k). ProxyF f a -> ProxyF f a -> Bool
<= :: ProxyF f a -> ProxyF f a -> Bool
$c> :: forall k (f :: k) k (a :: k). ProxyF f a -> ProxyF f a -> Bool
> :: ProxyF f a -> ProxyF f a -> Bool
$c>= :: forall k (f :: k) k (a :: k). ProxyF f a -> ProxyF f a -> Bool
>= :: ProxyF f a -> ProxyF f a -> Bool
$cmax :: forall k (f :: k) k (a :: k).
ProxyF f a -> ProxyF f a -> ProxyF f a
max :: ProxyF f a -> ProxyF f a -> ProxyF f a
$cmin :: forall k (f :: k) k (a :: k).
ProxyF f a -> ProxyF f a -> ProxyF f a
min :: ProxyF f a -> ProxyF f a -> ProxyF f a
Ord, (forall a b. (a -> b) -> ProxyF f a -> ProxyF f b)
-> (forall a b. a -> ProxyF f b -> ProxyF f a)
-> Functor (ProxyF f)
forall k (f :: k) a b. a -> ProxyF f b -> ProxyF f a
forall k (f :: k) a b. (a -> b) -> ProxyF f a -> ProxyF f b
forall a b. a -> ProxyF f b -> ProxyF f a
forall a b. (a -> b) -> ProxyF f a -> ProxyF f b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall k (f :: k) a b. (a -> b) -> ProxyF f a -> ProxyF f b
fmap :: forall a b. (a -> b) -> ProxyF f a -> ProxyF f b
$c<$ :: forall k (f :: k) a b. a -> ProxyF f b -> ProxyF f a
<$ :: forall a b. a -> ProxyF f b -> ProxyF f a
Functor, (forall m. Monoid m => ProxyF f m -> m)
-> (forall m a. Monoid m => (a -> m) -> ProxyF f a -> m)
-> (forall m a. Monoid m => (a -> m) -> ProxyF f a -> m)
-> (forall a b. (a -> b -> b) -> b -> ProxyF f a -> b)
-> (forall a b. (a -> b -> b) -> b -> ProxyF f a -> b)
-> (forall b a. (b -> a -> b) -> b -> ProxyF f a -> b)
-> (forall b a. (b -> a -> b) -> b -> ProxyF f a -> b)
-> (forall a. (a -> a -> a) -> ProxyF f a -> a)
-> (forall a. (a -> a -> a) -> ProxyF f a -> a)
-> (forall a. ProxyF f a -> [a])
-> (forall a. ProxyF f a -> Bool)
-> (forall a. ProxyF f a -> Int)
-> (forall a. Eq a => a -> ProxyF f a -> Bool)
-> (forall a. Ord a => ProxyF f a -> a)
-> (forall a. Ord a => ProxyF f a -> a)
-> (forall a. Num a => ProxyF f a -> a)
-> (forall a. Num a => ProxyF f a -> a)
-> Foldable (ProxyF f)
forall a. Eq a => a -> ProxyF f a -> Bool
forall a. Num a => ProxyF f a -> a
forall a. Ord a => ProxyF f a -> a
forall m. Monoid m => ProxyF f m -> m
forall a. ProxyF f a -> Bool
forall a. ProxyF f a -> Int
forall a. ProxyF f a -> [a]
forall a. (a -> a -> a) -> ProxyF f a -> a
forall k (f :: k) a. Eq a => a -> ProxyF f a -> Bool
forall k (f :: k) a. Num a => ProxyF f a -> a
forall k (f :: k) a. Ord a => ProxyF f a -> a
forall k (f :: k) m. Monoid m => ProxyF f m -> m
forall k (f :: k) a. ProxyF f a -> Bool
forall k (f :: k) a. ProxyF f a -> Int
forall k (f :: k) a. ProxyF f a -> [a]
forall k (f :: k) a. (a -> a -> a) -> ProxyF f a -> a
forall k (f :: k) m a. Monoid m => (a -> m) -> ProxyF f a -> m
forall k (f :: k) b a. (b -> a -> b) -> b -> ProxyF f a -> b
forall k (f :: k) a b. (a -> b -> b) -> b -> ProxyF f a -> b
forall m a. Monoid m => (a -> m) -> ProxyF f a -> m
forall b a. (b -> a -> b) -> b -> ProxyF f a -> b
forall a b. (a -> b -> b) -> b -> ProxyF f 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
$cfold :: forall k (f :: k) m. Monoid m => ProxyF f m -> m
fold :: forall m. Monoid m => ProxyF f m -> m
$cfoldMap :: forall k (f :: k) m a. Monoid m => (a -> m) -> ProxyF f a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> ProxyF f a -> m
$cfoldMap' :: forall k (f :: k) m a. Monoid m => (a -> m) -> ProxyF f a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> ProxyF f a -> m
$cfoldr :: forall k (f :: k) a b. (a -> b -> b) -> b -> ProxyF f a -> b
foldr :: forall a b. (a -> b -> b) -> b -> ProxyF f a -> b
$cfoldr' :: forall k (f :: k) a b. (a -> b -> b) -> b -> ProxyF f a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> ProxyF f a -> b
$cfoldl :: forall k (f :: k) b a. (b -> a -> b) -> b -> ProxyF f a -> b
foldl :: forall b a. (b -> a -> b) -> b -> ProxyF f a -> b
$cfoldl' :: forall k (f :: k) b a. (b -> a -> b) -> b -> ProxyF f a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> ProxyF f a -> b
$cfoldr1 :: forall k (f :: k) a. (a -> a -> a) -> ProxyF f a -> a
foldr1 :: forall a. (a -> a -> a) -> ProxyF f a -> a
$cfoldl1 :: forall k (f :: k) a. (a -> a -> a) -> ProxyF f a -> a
foldl1 :: forall a. (a -> a -> a) -> ProxyF f a -> a
$ctoList :: forall k (f :: k) a. ProxyF f a -> [a]
toList :: forall a. ProxyF f a -> [a]
$cnull :: forall k (f :: k) a. ProxyF f a -> Bool
null :: forall a. ProxyF f a -> Bool
$clength :: forall k (f :: k) a. ProxyF f a -> Int
length :: forall a. ProxyF f a -> Int
$celem :: forall k (f :: k) a. Eq a => a -> ProxyF f a -> Bool
elem :: forall a. Eq a => a -> ProxyF f a -> Bool
$cmaximum :: forall k (f :: k) a. Ord a => ProxyF f a -> a
maximum :: forall a. Ord a => ProxyF f a -> a
$cminimum :: forall k (f :: k) a. Ord a => ProxyF f a -> a
minimum :: forall a. Ord a => ProxyF f a -> a
$csum :: forall k (f :: k) a. Num a => ProxyF f a -> a
sum :: forall a. Num a => ProxyF f a -> a
$cproduct :: forall k (f :: k) a. Num a => ProxyF f a -> a
product :: forall a. Num a => ProxyF f a -> a
Foldable, Functor (ProxyF f)
Foldable (ProxyF f)
(Functor (ProxyF f), Foldable (ProxyF f)) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ProxyF f a -> f (ProxyF f b))
-> (forall (f :: * -> *) a.
Applicative f =>
ProxyF f (f a) -> f (ProxyF f a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ProxyF f a -> m (ProxyF f b))
-> (forall (m :: * -> *) a.
Monad m =>
ProxyF f (m a) -> m (ProxyF f a))
-> Traversable (ProxyF f)
forall k (f :: k). Functor (ProxyF f)
forall k (f :: k). Foldable (ProxyF f)
forall k (f :: k) (m :: * -> *) a.
Monad m =>
ProxyF f (m a) -> m (ProxyF f a)
forall k (f :: k) (f :: * -> *) a.
Applicative f =>
ProxyF f (f a) -> f (ProxyF f a)
forall k (f :: k) (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ProxyF f a -> m (ProxyF f b)
forall k (f :: k) (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ProxyF f a -> f (ProxyF f 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 => ProxyF f (m a) -> m (ProxyF f a)
forall (f :: * -> *) a.
Applicative f =>
ProxyF f (f a) -> f (ProxyF f a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ProxyF f a -> m (ProxyF f b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ProxyF f a -> f (ProxyF f b)
$ctraverse :: forall k (f :: k) (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ProxyF f a -> f (ProxyF f b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ProxyF f a -> f (ProxyF f b)
$csequenceA :: forall k (f :: k) (f :: * -> *) a.
Applicative f =>
ProxyF f (f a) -> f (ProxyF f a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
ProxyF f (f a) -> f (ProxyF f a)
$cmapM :: forall k (f :: k) (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ProxyF f a -> m (ProxyF f b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ProxyF f a -> m (ProxyF f b)
$csequence :: forall k (f :: k) (m :: * -> *) a.
Monad m =>
ProxyF f (m a) -> m (ProxyF f a)
sequence :: forall (m :: * -> *) a. Monad m => ProxyF f (m a) -> m (ProxyF f a)
Traversable, Typeable, (forall x. ProxyF f a -> Rep (ProxyF f a) x)
-> (forall x. Rep (ProxyF f a) x -> ProxyF f a)
-> Generic (ProxyF f a)
forall x. Rep (ProxyF f a) x -> ProxyF f a
forall x. ProxyF f a -> Rep (ProxyF f a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k (f :: k) k (a :: k) x. Rep (ProxyF f a) x -> ProxyF f a
forall k (f :: k) k (a :: k) x. ProxyF f a -> Rep (ProxyF f a) x
$cfrom :: forall k (f :: k) k (a :: k) x. ProxyF f a -> Rep (ProxyF f a) x
from :: forall x. ProxyF f a -> Rep (ProxyF f a) x
$cto :: forall k (f :: k) k (a :: k) x. Rep (ProxyF f a) x -> ProxyF f a
to :: forall x. Rep (ProxyF f a) x -> ProxyF f a
Generic, Typeable (ProxyF f a)
Typeable (ProxyF f a) =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProxyF f a -> c (ProxyF f a))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ProxyF f a))
-> (ProxyF f a -> Constr)
-> (ProxyF f a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (ProxyF f a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ProxyF f a)))
-> ((forall b. Data b => b -> b) -> ProxyF f a -> ProxyF f a)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ProxyF f a -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ProxyF f a -> r)
-> (forall u. (forall d. Data d => d -> u) -> ProxyF f a -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> ProxyF f a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ProxyF f a -> m (ProxyF f a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ProxyF f a -> m (ProxyF f a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ProxyF f a -> m (ProxyF f a))
-> Data (ProxyF f a)
ProxyF f a -> Constr
ProxyF f a -> DataType
(forall b. Data b => b -> b) -> ProxyF f a -> ProxyF f a
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> ProxyF f a -> u
forall u. (forall d. Data d => d -> u) -> ProxyF f a -> [u]
forall k (f :: k) k (a :: k).
(Typeable f, Typeable a, Typeable k, Typeable k) =>
Typeable (ProxyF f a)
forall k (f :: k) k (a :: k).
(Typeable f, Typeable a, Typeable k, Typeable k) =>
ProxyF f a -> Constr
forall k (f :: k) k (a :: k).
(Typeable f, Typeable a, Typeable k, Typeable k) =>
ProxyF f a -> DataType
forall k (f :: k) k (a :: k).
(Typeable f, Typeable a, Typeable k, Typeable k) =>
(forall b. Data b => b -> b) -> ProxyF f a -> ProxyF f a
forall k (f :: k) k (a :: k) u.
(Typeable f, Typeable a, Typeable k, Typeable k) =>
Int -> (forall d. Data d => d -> u) -> ProxyF f a -> u
forall k (f :: k) k (a :: k) u.
(Typeable f, Typeable a, Typeable k, Typeable k) =>
(forall d. Data d => d -> u) -> ProxyF f a -> [u]
forall k (f :: k) k (a :: k) r r'.
(Typeable f, Typeable a, Typeable k, Typeable k) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ProxyF f a -> r
forall k (f :: k) k (a :: k) r r'.
(Typeable f, Typeable a, Typeable k, Typeable k) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ProxyF f a -> r
forall k (f :: k) k (a :: k) (m :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, Monad m) =>
(forall d. Data d => d -> m d) -> ProxyF f a -> m (ProxyF f a)
forall k (f :: k) k (a :: k) (m :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, MonadPlus m) =>
(forall d. Data d => d -> m d) -> ProxyF f a -> m (ProxyF f a)
forall k (f :: k) k (a :: k) (c :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ProxyF f a)
forall k (f :: k) k (a :: k) (c :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProxyF f a -> c (ProxyF f a)
forall k (f :: k) k (a :: k) (t :: * -> *) (c :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (ProxyF f a))
forall k (f :: k) k (a :: k) (t :: * -> * -> *) (c :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ProxyF f a))
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ProxyF f a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ProxyF f a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ProxyF f a -> m (ProxyF f a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ProxyF f a -> m (ProxyF f a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ProxyF f a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProxyF f a -> c (ProxyF f a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (ProxyF f a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ProxyF f a))
$cgfoldl :: forall k (f :: k) k (a :: k) (c :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProxyF f a -> c (ProxyF f a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProxyF f a -> c (ProxyF f a)
$cgunfold :: forall k (f :: k) k (a :: k) (c :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ProxyF f a)
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ProxyF f a)
$ctoConstr :: forall k (f :: k) k (a :: k).
(Typeable f, Typeable a, Typeable k, Typeable k) =>
ProxyF f a -> Constr
toConstr :: ProxyF f a -> Constr
$cdataTypeOf :: forall k (f :: k) k (a :: k).
(Typeable f, Typeable a, Typeable k, Typeable k) =>
ProxyF f a -> DataType
dataTypeOf :: ProxyF f a -> DataType
$cdataCast1 :: forall k (f :: k) k (a :: k) (t :: * -> *) (c :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (ProxyF f a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (ProxyF f a))
$cdataCast2 :: forall k (f :: k) k (a :: k) (t :: * -> * -> *) (c :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ProxyF f a))
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ProxyF f a))
$cgmapT :: forall k (f :: k) k (a :: k).
(Typeable f, Typeable a, Typeable k, Typeable k) =>
(forall b. Data b => b -> b) -> ProxyF f a -> ProxyF f a
gmapT :: (forall b. Data b => b -> b) -> ProxyF f a -> ProxyF f a
$cgmapQl :: forall k (f :: k) k (a :: k) r r'.
(Typeable f, Typeable a, Typeable k, Typeable k) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ProxyF f a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ProxyF f a -> r
$cgmapQr :: forall k (f :: k) k (a :: k) r r'.
(Typeable f, Typeable a, Typeable k, Typeable k) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ProxyF f a -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ProxyF f a -> r
$cgmapQ :: forall k (f :: k) k (a :: k) u.
(Typeable f, Typeable a, Typeable k, Typeable k) =>
(forall d. Data d => d -> u) -> ProxyF f a -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> ProxyF f a -> [u]
$cgmapQi :: forall k (f :: k) k (a :: k) u.
(Typeable f, Typeable a, Typeable k, Typeable k) =>
Int -> (forall d. Data d => d -> u) -> ProxyF f a -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ProxyF f a -> u
$cgmapM :: forall k (f :: k) k (a :: k) (m :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, Monad m) =>
(forall d. Data d => d -> m d) -> ProxyF f a -> m (ProxyF f a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ProxyF f a -> m (ProxyF f a)
$cgmapMp :: forall k (f :: k) k (a :: k) (m :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, MonadPlus m) =>
(forall d. Data d => d -> m d) -> ProxyF f a -> m (ProxyF f a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ProxyF f a -> m (ProxyF f a)
$cgmapMo :: forall k (f :: k) k (a :: k) (m :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, MonadPlus m) =>
(forall d. Data d => d -> m d) -> ProxyF f a -> m (ProxyF f a)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ProxyF f a -> m (ProxyF f a)
Data)
deriveShow1 ''ProxyF
deriveRead1 ''ProxyF
deriveEq1 ''ProxyF
deriveOrd1 ''ProxyF
instance Contravariant (ProxyF f) where
contramap :: forall a' a. (a' -> a) -> ProxyF f a -> ProxyF f a'
contramap a' -> a
_ = ProxyF f a -> ProxyF f a'
forall a b. Coercible a b => a -> b
coerce
instance Divisible (ProxyF f) where
divide :: forall a b c.
(a -> (b, c)) -> ProxyF f b -> ProxyF f c -> ProxyF f a
divide a -> (b, c)
_ ProxyF f b
_ ProxyF f c
_ = ProxyF f a
forall {k} {k} (f :: k) (a :: k). ProxyF f a
ProxyF
conquer :: forall a. ProxyF f a
conquer = ProxyF f a
forall {k} {k} (f :: k) (a :: k). ProxyF f a
ProxyF
instance Divise (ProxyF f) where
divise :: forall a b c.
(a -> (b, c)) -> ProxyF f b -> ProxyF f c -> ProxyF f a
divise a -> (b, c)
_ ProxyF f b
_ ProxyF f c
_ = ProxyF f a
forall {k} {k} (f :: k) (a :: k). ProxyF f a
ProxyF
instance Decide (ProxyF f) where
decide :: forall a b c.
(a -> Either b c) -> ProxyF f b -> ProxyF f c -> ProxyF f a
decide a -> Either b c
_ ProxyF f b
_ ProxyF f c
_ = ProxyF f a
forall {k} {k} (f :: k) (a :: k). ProxyF f a
ProxyF
instance Conclude (ProxyF f) where
conclude :: forall a. (a -> Void) -> ProxyF f a
conclude a -> Void
_ = ProxyF f a
forall {k} {k} (f :: k) (a :: k). ProxyF f a
ProxyF
instance Decidable (ProxyF f) where
choose :: forall a b c.
(a -> Either b c) -> ProxyF f b -> ProxyF f c -> ProxyF f a
choose a -> Either b c
_ ProxyF f b
_ ProxyF f c
_ = ProxyF f a
forall {k} {k} (f :: k) (a :: k). ProxyF f a
ProxyF
lose :: forall a. (a -> Void) -> ProxyF f a
lose a -> Void
_ = ProxyF f a
forall {k} {k} (f :: k) (a :: k). ProxyF f a
ProxyF
instance Invariant (ProxyF f) where
invmap :: forall a b. (a -> b) -> (b -> a) -> ProxyF f a -> ProxyF f b
invmap a -> b
_ b -> a
_ = ProxyF f a -> ProxyF f b
forall a b. Coercible a b => a -> b
coerce
instance HFunctor ProxyF where
hmap :: forall (f :: k -> *) (g :: k -> *).
(f ~> g) -> ProxyF f ~> ProxyF g
hmap f ~> g
_ = ProxyF f x -> ProxyF g x
forall a b. Coercible a b => a -> b
coerce
data ConstF e f a = ConstF { forall {k} {k} e (f :: k) (a :: k). ConstF e f a -> e
getConstF :: e }
deriving (Int -> ConstF e f a -> ShowS
[ConstF e f a] -> ShowS
ConstF e f a -> String
(Int -> ConstF e f a -> ShowS)
-> (ConstF e f a -> String)
-> ([ConstF e f a] -> ShowS)
-> Show (ConstF e f a)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall e k (f :: k) k (a :: k).
Show e =>
Int -> ConstF e f a -> ShowS
forall e k (f :: k) k (a :: k). Show e => [ConstF e f a] -> ShowS
forall e k (f :: k) k (a :: k). Show e => ConstF e f a -> String
$cshowsPrec :: forall e k (f :: k) k (a :: k).
Show e =>
Int -> ConstF e f a -> ShowS
showsPrec :: Int -> ConstF e f a -> ShowS
$cshow :: forall e k (f :: k) k (a :: k). Show e => ConstF e f a -> String
show :: ConstF e f a -> String
$cshowList :: forall e k (f :: k) k (a :: k). Show e => [ConstF e f a] -> ShowS
showList :: [ConstF e f a] -> ShowS
Show, ReadPrec [ConstF e f a]
ReadPrec (ConstF e f a)
Int -> ReadS (ConstF e f a)
ReadS [ConstF e f a]
(Int -> ReadS (ConstF e f a))
-> ReadS [ConstF e f a]
-> ReadPrec (ConstF e f a)
-> ReadPrec [ConstF e f a]
-> Read (ConstF e f a)
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall e k (f :: k) k (a :: k). Read e => ReadPrec [ConstF e f a]
forall e k (f :: k) k (a :: k). Read e => ReadPrec (ConstF e f a)
forall e k (f :: k) k (a :: k).
Read e =>
Int -> ReadS (ConstF e f a)
forall e k (f :: k) k (a :: k). Read e => ReadS [ConstF e f a]
$creadsPrec :: forall e k (f :: k) k (a :: k).
Read e =>
Int -> ReadS (ConstF e f a)
readsPrec :: Int -> ReadS (ConstF e f a)
$creadList :: forall e k (f :: k) k (a :: k). Read e => ReadS [ConstF e f a]
readList :: ReadS [ConstF e f a]
$creadPrec :: forall e k (f :: k) k (a :: k). Read e => ReadPrec (ConstF e f a)
readPrec :: ReadPrec (ConstF e f a)
$creadListPrec :: forall e k (f :: k) k (a :: k). Read e => ReadPrec [ConstF e f a]
readListPrec :: ReadPrec [ConstF e f a]
Read, ConstF e f a -> ConstF e f a -> Bool
(ConstF e f a -> ConstF e f a -> Bool)
-> (ConstF e f a -> ConstF e f a -> Bool) -> Eq (ConstF e f a)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall e k (f :: k) k (a :: k).
Eq e =>
ConstF e f a -> ConstF e f a -> Bool
$c== :: forall e k (f :: k) k (a :: k).
Eq e =>
ConstF e f a -> ConstF e f a -> Bool
== :: ConstF e f a -> ConstF e f a -> Bool
$c/= :: forall e k (f :: k) k (a :: k).
Eq e =>
ConstF e f a -> ConstF e f a -> Bool
/= :: ConstF e f a -> ConstF e f a -> Bool
Eq, Eq (ConstF e f a)
Eq (ConstF e f a) =>
(ConstF e f a -> ConstF e f a -> Ordering)
-> (ConstF e f a -> ConstF e f a -> Bool)
-> (ConstF e f a -> ConstF e f a -> Bool)
-> (ConstF e f a -> ConstF e f a -> Bool)
-> (ConstF e f a -> ConstF e f a -> Bool)
-> (ConstF e f a -> ConstF e f a -> ConstF e f a)
-> (ConstF e f a -> ConstF e f a -> ConstF e f a)
-> Ord (ConstF e f a)
ConstF e f a -> ConstF e f a -> Bool
ConstF e f a -> ConstF e f a -> Ordering
ConstF e f a -> ConstF e f a -> ConstF e f a
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 e k (f :: k) k (a :: k). Ord e => Eq (ConstF e f a)
forall e k (f :: k) k (a :: k).
Ord e =>
ConstF e f a -> ConstF e f a -> Bool
forall e k (f :: k) k (a :: k).
Ord e =>
ConstF e f a -> ConstF e f a -> Ordering
forall e k (f :: k) k (a :: k).
Ord e =>
ConstF e f a -> ConstF e f a -> ConstF e f a
$ccompare :: forall e k (f :: k) k (a :: k).
Ord e =>
ConstF e f a -> ConstF e f a -> Ordering
compare :: ConstF e f a -> ConstF e f a -> Ordering
$c< :: forall e k (f :: k) k (a :: k).
Ord e =>
ConstF e f a -> ConstF e f a -> Bool
< :: ConstF e f a -> ConstF e f a -> Bool
$c<= :: forall e k (f :: k) k (a :: k).
Ord e =>
ConstF e f a -> ConstF e f a -> Bool
<= :: ConstF e f a -> ConstF e f a -> Bool
$c> :: forall e k (f :: k) k (a :: k).
Ord e =>
ConstF e f a -> ConstF e f a -> Bool
> :: ConstF e f a -> ConstF e f a -> Bool
$c>= :: forall e k (f :: k) k (a :: k).
Ord e =>
ConstF e f a -> ConstF e f a -> Bool
>= :: ConstF e f a -> ConstF e f a -> Bool
$cmax :: forall e k (f :: k) k (a :: k).
Ord e =>
ConstF e f a -> ConstF e f a -> ConstF e f a
max :: ConstF e f a -> ConstF e f a -> ConstF e f a
$cmin :: forall e k (f :: k) k (a :: k).
Ord e =>
ConstF e f a -> ConstF e f a -> ConstF e f a
min :: ConstF e f a -> ConstF e f a -> ConstF e f a
Ord, (forall a b. (a -> b) -> ConstF e f a -> ConstF e f b)
-> (forall a b. a -> ConstF e f b -> ConstF e f a)
-> Functor (ConstF e f)
forall a b. a -> ConstF e f b -> ConstF e f a
forall a b. (a -> b) -> ConstF e f a -> ConstF e f b
forall e k (f :: k) a b. a -> ConstF e f b -> ConstF e f a
forall e k (f :: k) a b. (a -> b) -> ConstF e f a -> ConstF e f b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall e k (f :: k) a b. (a -> b) -> ConstF e f a -> ConstF e f b
fmap :: forall a b. (a -> b) -> ConstF e f a -> ConstF e f b
$c<$ :: forall e k (f :: k) a b. a -> ConstF e f b -> ConstF e f a
<$ :: forall a b. a -> ConstF e f b -> ConstF e f a
Functor, (forall m. Monoid m => ConstF e f m -> m)
-> (forall m a. Monoid m => (a -> m) -> ConstF e f a -> m)
-> (forall m a. Monoid m => (a -> m) -> ConstF e f a -> m)
-> (forall a b. (a -> b -> b) -> b -> ConstF e f a -> b)
-> (forall a b. (a -> b -> b) -> b -> ConstF e f a -> b)
-> (forall b a. (b -> a -> b) -> b -> ConstF e f a -> b)
-> (forall b a. (b -> a -> b) -> b -> ConstF e f a -> b)
-> (forall a. (a -> a -> a) -> ConstF e f a -> a)
-> (forall a. (a -> a -> a) -> ConstF e f a -> a)
-> (forall a. ConstF e f a -> [a])
-> (forall a. ConstF e f a -> Bool)
-> (forall a. ConstF e f a -> Int)
-> (forall a. Eq a => a -> ConstF e f a -> Bool)
-> (forall a. Ord a => ConstF e f a -> a)
-> (forall a. Ord a => ConstF e f a -> a)
-> (forall a. Num a => ConstF e f a -> a)
-> (forall a. Num a => ConstF e f a -> a)
-> Foldable (ConstF e f)
forall a. Eq a => a -> ConstF e f a -> Bool
forall a. Num a => ConstF e f a -> a
forall a. Ord a => ConstF e f a -> a
forall m. Monoid m => ConstF e f m -> m
forall a. ConstF e f a -> Bool
forall a. ConstF e f a -> Int
forall a. ConstF e f a -> [a]
forall a. (a -> a -> a) -> ConstF e f a -> a
forall m a. Monoid m => (a -> m) -> ConstF e f a -> m
forall b a. (b -> a -> b) -> b -> ConstF e f a -> b
forall a b. (a -> b -> b) -> b -> ConstF e f a -> b
forall e k (f :: k) a. Eq a => a -> ConstF e f a -> Bool
forall e k (f :: k) a. Num a => ConstF e f a -> a
forall e k (f :: k) a. Ord a => ConstF e f a -> a
forall e k (f :: k) m. Monoid m => ConstF e f m -> m
forall e k (f :: k) a. ConstF e f a -> Bool
forall e k (f :: k) a. ConstF e f a -> Int
forall e k (f :: k) a. ConstF e f a -> [a]
forall e k (f :: k) a. (a -> a -> a) -> ConstF e f a -> a
forall e k (f :: k) m a. Monoid m => (a -> m) -> ConstF e f a -> m
forall e k (f :: k) b a. (b -> a -> b) -> b -> ConstF e f a -> b
forall e k (f :: k) a b. (a -> b -> b) -> b -> ConstF e f 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
$cfold :: forall e k (f :: k) m. Monoid m => ConstF e f m -> m
fold :: forall m. Monoid m => ConstF e f m -> m
$cfoldMap :: forall e k (f :: k) m a. Monoid m => (a -> m) -> ConstF e f a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> ConstF e f a -> m
$cfoldMap' :: forall e k (f :: k) m a. Monoid m => (a -> m) -> ConstF e f a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> ConstF e f a -> m
$cfoldr :: forall e k (f :: k) a b. (a -> b -> b) -> b -> ConstF e f a -> b
foldr :: forall a b. (a -> b -> b) -> b -> ConstF e f a -> b
$cfoldr' :: forall e k (f :: k) a b. (a -> b -> b) -> b -> ConstF e f a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> ConstF e f a -> b
$cfoldl :: forall e k (f :: k) b a. (b -> a -> b) -> b -> ConstF e f a -> b
foldl :: forall b a. (b -> a -> b) -> b -> ConstF e f a -> b
$cfoldl' :: forall e k (f :: k) b a. (b -> a -> b) -> b -> ConstF e f a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> ConstF e f a -> b
$cfoldr1 :: forall e k (f :: k) a. (a -> a -> a) -> ConstF e f a -> a
foldr1 :: forall a. (a -> a -> a) -> ConstF e f a -> a
$cfoldl1 :: forall e k (f :: k) a. (a -> a -> a) -> ConstF e f a -> a
foldl1 :: forall a. (a -> a -> a) -> ConstF e f a -> a
$ctoList :: forall e k (f :: k) a. ConstF e f a -> [a]
toList :: forall a. ConstF e f a -> [a]
$cnull :: forall e k (f :: k) a. ConstF e f a -> Bool
null :: forall a. ConstF e f a -> Bool
$clength :: forall e k (f :: k) a. ConstF e f a -> Int
length :: forall a. ConstF e f a -> Int
$celem :: forall e k (f :: k) a. Eq a => a -> ConstF e f a -> Bool
elem :: forall a. Eq a => a -> ConstF e f a -> Bool
$cmaximum :: forall e k (f :: k) a. Ord a => ConstF e f a -> a
maximum :: forall a. Ord a => ConstF e f a -> a
$cminimum :: forall e k (f :: k) a. Ord a => ConstF e f a -> a
minimum :: forall a. Ord a => ConstF e f a -> a
$csum :: forall e k (f :: k) a. Num a => ConstF e f a -> a
sum :: forall a. Num a => ConstF e f a -> a
$cproduct :: forall e k (f :: k) a. Num a => ConstF e f a -> a
product :: forall a. Num a => ConstF e f a -> a
Foldable, Functor (ConstF e f)
Foldable (ConstF e f)
(Functor (ConstF e f), Foldable (ConstF e f)) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ConstF e f a -> f (ConstF e f b))
-> (forall (f :: * -> *) a.
Applicative f =>
ConstF e f (f a) -> f (ConstF e f a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ConstF e f a -> m (ConstF e f b))
-> (forall (m :: * -> *) a.
Monad m =>
ConstF e f (m a) -> m (ConstF e f a))
-> Traversable (ConstF e f)
forall e k (f :: k). Functor (ConstF e f)
forall e k (f :: k). Foldable (ConstF e f)
forall e k (f :: k) (m :: * -> *) a.
Monad m =>
ConstF e f (m a) -> m (ConstF e f a)
forall e k (f :: k) (f :: * -> *) a.
Applicative f =>
ConstF e f (f a) -> f (ConstF e f a)
forall e k (f :: k) (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ConstF e f a -> m (ConstF e f b)
forall e k (f :: k) (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ConstF e f a -> f (ConstF e f 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 =>
ConstF e f (m a) -> m (ConstF e f a)
forall (f :: * -> *) a.
Applicative f =>
ConstF e f (f a) -> f (ConstF e f a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ConstF e f a -> m (ConstF e f b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ConstF e f a -> f (ConstF e f b)
$ctraverse :: forall e k (f :: k) (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ConstF e f a -> f (ConstF e f b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ConstF e f a -> f (ConstF e f b)
$csequenceA :: forall e k (f :: k) (f :: * -> *) a.
Applicative f =>
ConstF e f (f a) -> f (ConstF e f a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
ConstF e f (f a) -> f (ConstF e f a)
$cmapM :: forall e k (f :: k) (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ConstF e f a -> m (ConstF e f b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ConstF e f a -> m (ConstF e f b)
$csequence :: forall e k (f :: k) (m :: * -> *) a.
Monad m =>
ConstF e f (m a) -> m (ConstF e f a)
sequence :: forall (m :: * -> *) a.
Monad m =>
ConstF e f (m a) -> m (ConstF e f a)
Traversable, Typeable, (forall x. ConstF e f a -> Rep (ConstF e f a) x)
-> (forall x. Rep (ConstF e f a) x -> ConstF e f a)
-> Generic (ConstF e f a)
forall x. Rep (ConstF e f a) x -> ConstF e f a
forall x. ConstF e f a -> Rep (ConstF e f a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall e k (f :: k) k (a :: k) x.
Rep (ConstF e f a) x -> ConstF e f a
forall e k (f :: k) k (a :: k) x.
ConstF e f a -> Rep (ConstF e f a) x
$cfrom :: forall e k (f :: k) k (a :: k) x.
ConstF e f a -> Rep (ConstF e f a) x
from :: forall x. ConstF e f a -> Rep (ConstF e f a) x
$cto :: forall e k (f :: k) k (a :: k) x.
Rep (ConstF e f a) x -> ConstF e f a
to :: forall x. Rep (ConstF e f a) x -> ConstF e f a
Generic, Typeable (ConstF e f a)
Typeable (ConstF e f a) =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConstF e f a -> c (ConstF e f a))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ConstF e f a))
-> (ConstF e f a -> Constr)
-> (ConstF e f a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (ConstF e f a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ConstF e f a)))
-> ((forall b. Data b => b -> b) -> ConstF e f a -> ConstF e f a)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ConstF e f a -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ConstF e f a -> r)
-> (forall u. (forall d. Data d => d -> u) -> ConstF e f a -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> ConstF e f a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ConstF e f a -> m (ConstF e f a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ConstF e f a -> m (ConstF e f a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ConstF e f a -> m (ConstF e f a))
-> Data (ConstF e f a)
ConstF e f a -> Constr
ConstF e f a -> DataType
(forall b. Data b => b -> b) -> ConstF e f a -> ConstF e f a
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> ConstF e f a -> u
forall u. (forall d. Data d => d -> u) -> ConstF e f a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ConstF e f a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ConstF e f a -> r
forall e k (f :: k) k (a :: k).
(Typeable f, Typeable a, Typeable k, Typeable k, Data e) =>
Typeable (ConstF e f a)
forall e k (f :: k) k (a :: k).
(Typeable f, Typeable a, Typeable k, Typeable k, Data e) =>
ConstF e f a -> Constr
forall e k (f :: k) k (a :: k).
(Typeable f, Typeable a, Typeable k, Typeable k, Data e) =>
ConstF e f a -> DataType
forall e k (f :: k) k (a :: k).
(Typeable f, Typeable a, Typeable k, Typeable k, Data e) =>
(forall b. Data b => b -> b) -> ConstF e f a -> ConstF e f a
forall e k (f :: k) k (a :: k) u.
(Typeable f, Typeable a, Typeable k, Typeable k, Data e) =>
Int -> (forall d. Data d => d -> u) -> ConstF e f a -> u
forall e k (f :: k) k (a :: k) u.
(Typeable f, Typeable a, Typeable k, Typeable k, Data e) =>
(forall d. Data d => d -> u) -> ConstF e f a -> [u]
forall e k (f :: k) k (a :: k) r r'.
(Typeable f, Typeable a, Typeable k, Typeable k, Data e) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ConstF e f a -> r
forall e k (f :: k) k (a :: k) r r'.
(Typeable f, Typeable a, Typeable k, Typeable k, Data e) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ConstF e f a -> r
forall e k (f :: k) k (a :: k) (m :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, Data e,
Monad m) =>
(forall d. Data d => d -> m d) -> ConstF e f a -> m (ConstF e f a)
forall e k (f :: k) k (a :: k) (m :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, Data e,
MonadPlus m) =>
(forall d. Data d => d -> m d) -> ConstF e f a -> m (ConstF e f a)
forall e k (f :: k) k (a :: k) (c :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, Data e) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ConstF e f a)
forall e k (f :: k) k (a :: k) (c :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, Data e) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConstF e f a -> c (ConstF e f a)
forall e k (f :: k) k (a :: k) (t :: * -> *) (c :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, Data e,
Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (ConstF e f a))
forall e k (f :: k) k (a :: k) (t :: * -> * -> *) (c :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, Data e,
Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ConstF e f a))
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ConstF e f a -> m (ConstF e f a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ConstF e f a -> m (ConstF e f a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ConstF e f a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConstF e f a -> c (ConstF e f a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (ConstF e f a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ConstF e f a))
$cgfoldl :: forall e k (f :: k) k (a :: k) (c :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, Data e) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConstF e f a -> c (ConstF e f a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConstF e f a -> c (ConstF e f a)
$cgunfold :: forall e k (f :: k) k (a :: k) (c :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, Data e) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ConstF e f a)
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ConstF e f a)
$ctoConstr :: forall e k (f :: k) k (a :: k).
(Typeable f, Typeable a, Typeable k, Typeable k, Data e) =>
ConstF e f a -> Constr
toConstr :: ConstF e f a -> Constr
$cdataTypeOf :: forall e k (f :: k) k (a :: k).
(Typeable f, Typeable a, Typeable k, Typeable k, Data e) =>
ConstF e f a -> DataType
dataTypeOf :: ConstF e f a -> DataType
$cdataCast1 :: forall e k (f :: k) k (a :: k) (t :: * -> *) (c :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, Data e,
Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (ConstF e f a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (ConstF e f a))
$cdataCast2 :: forall e k (f :: k) k (a :: k) (t :: * -> * -> *) (c :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, Data e,
Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ConstF e f a))
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ConstF e f a))
$cgmapT :: forall e k (f :: k) k (a :: k).
(Typeable f, Typeable a, Typeable k, Typeable k, Data e) =>
(forall b. Data b => b -> b) -> ConstF e f a -> ConstF e f a
gmapT :: (forall b. Data b => b -> b) -> ConstF e f a -> ConstF e f a
$cgmapQl :: forall e k (f :: k) k (a :: k) r r'.
(Typeable f, Typeable a, Typeable k, Typeable k, Data e) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ConstF e f a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ConstF e f a -> r
$cgmapQr :: forall e k (f :: k) k (a :: k) r r'.
(Typeable f, Typeable a, Typeable k, Typeable k, Data e) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ConstF e f a -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ConstF e f a -> r
$cgmapQ :: forall e k (f :: k) k (a :: k) u.
(Typeable f, Typeable a, Typeable k, Typeable k, Data e) =>
(forall d. Data d => d -> u) -> ConstF e f a -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> ConstF e f a -> [u]
$cgmapQi :: forall e k (f :: k) k (a :: k) u.
(Typeable f, Typeable a, Typeable k, Typeable k, Data e) =>
Int -> (forall d. Data d => d -> u) -> ConstF e f a -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ConstF e f a -> u
$cgmapM :: forall e k (f :: k) k (a :: k) (m :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, Data e,
Monad m) =>
(forall d. Data d => d -> m d) -> ConstF e f a -> m (ConstF e f a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ConstF e f a -> m (ConstF e f a)
$cgmapMp :: forall e k (f :: k) k (a :: k) (m :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, Data e,
MonadPlus m) =>
(forall d. Data d => d -> m d) -> ConstF e f a -> m (ConstF e f a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ConstF e f a -> m (ConstF e f a)
$cgmapMo :: forall e k (f :: k) k (a :: k) (m :: * -> *).
(Typeable f, Typeable a, Typeable k, Typeable k, Data e,
MonadPlus m) =>
(forall d. Data d => d -> m d) -> ConstF e f a -> m (ConstF e f a)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ConstF e f a -> m (ConstF e f a)
Data)
deriveShow1 ''ConstF
deriveRead1 ''ConstF
deriveEq1 ''ConstF
deriveOrd1 ''ConstF
instance Contravariant (ConstF e f) where
contramap :: forall a' a. (a' -> a) -> ConstF e f a -> ConstF e f a'
contramap a' -> a
_ = ConstF e f a -> ConstF e f a'
forall a b. Coercible a b => a -> b
coerce
instance Monoid e => Divisible (ConstF e f) where
divide :: forall a b c.
(a -> (b, c)) -> ConstF e f b -> ConstF e f c -> ConstF e f a
divide a -> (b, c)
_ (ConstF e
x) (ConstF e
y) = e -> ConstF e f a
forall {k} {k} e (f :: k) (a :: k). e -> ConstF e f a
ConstF (e
x e -> e -> e
forall a. Semigroup a => a -> a -> a
<> e
y)
conquer :: forall a. ConstF e f a
conquer = e -> ConstF e f a
forall {k} {k} e (f :: k) (a :: k). e -> ConstF e f a
ConstF e
forall a. Monoid a => a
mempty
instance Semigroup e => Divise (ConstF e f) where
divise :: forall a b c.
(a -> (b, c)) -> ConstF e f b -> ConstF e f c -> ConstF e f a
divise a -> (b, c)
_ (ConstF e
x) (ConstF e
y) = e -> ConstF e f a
forall {k} {k} e (f :: k) (a :: k). e -> ConstF e f a
ConstF (e
x e -> e -> e
forall a. Semigroup a => a -> a -> a
<> e
y)
instance Invariant (ConstF e f) where
invmap :: forall a b. (a -> b) -> (b -> a) -> ConstF e f a -> ConstF e f b
invmap a -> b
_ b -> a
_ = ConstF e f a -> ConstF e f b
forall a b. Coercible a b => a -> b
coerce
instance HFunctor (ConstF e) where
hmap :: forall (f :: k -> *) (g :: k -> *).
(f ~> g) -> ConstF e f ~> ConstF e g
hmap f ~> g
_ = ConstF e f x -> ConstF e g x
forall a b. Coercible a b => a -> b
coerce
data HLift t f a = HPure (f a)
| HOther (t f a)
deriving (forall a b. (a -> b) -> HLift t f a -> HLift t f b)
-> (forall a b. a -> HLift t f b -> HLift t f a)
-> Functor (HLift t f)
forall a b. a -> HLift t f b -> HLift t f a
forall a b. (a -> b) -> HLift t f a -> HLift t f b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
forall (t :: (* -> *) -> * -> *) (f :: * -> *) a b.
(Functor f, Functor (t f)) =>
a -> HLift t f b -> HLift t f a
forall (t :: (* -> *) -> * -> *) (f :: * -> *) a b.
(Functor f, Functor (t f)) =>
(a -> b) -> HLift t f a -> HLift t f b
$cfmap :: forall (t :: (* -> *) -> * -> *) (f :: * -> *) a b.
(Functor f, Functor (t f)) =>
(a -> b) -> HLift t f a -> HLift t f b
fmap :: forall a b. (a -> b) -> HLift t f a -> HLift t f b
$c<$ :: forall (t :: (* -> *) -> * -> *) (f :: * -> *) a b.
(Functor f, Functor (t f)) =>
a -> HLift t f b -> HLift t f a
<$ :: forall a b. a -> HLift t f b -> HLift t f a
Functor
instance (Show1 (t f), Show1 f) => Show1 (HLift t f) where
liftShowsPrec :: forall a.
(Int -> a -> ShowS)
-> ([a] -> ShowS) -> Int -> HLift t f a -> ShowS
liftShowsPrec Int -> a -> ShowS
sp [a] -> ShowS
sl Int
d = \case
HPure f a
x -> (Int -> f a -> ShowS) -> String -> Int -> f a -> ShowS
forall a. (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
showsUnaryWith ((Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
forall (f :: * -> *) a.
Show1 f =>
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
liftShowsPrec Int -> a -> ShowS
sp [a] -> ShowS
sl) String
"HPure" Int
d f a
x
HOther t f a
x -> (Int -> t f a -> ShowS) -> String -> Int -> t f a -> ShowS
forall a. (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
showsUnaryWith ((Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> t f a -> ShowS
forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> t f a -> ShowS
forall (f :: * -> *) a.
Show1 f =>
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
liftShowsPrec Int -> a -> ShowS
sp [a] -> ShowS
sl) String
"HOther" Int
d t f a
x
deriving instance (Show (f a), Show (t f a)) => Show (HLift t f a)
deriving instance (Read (f a), Read (t f a)) => Read (HLift t f a)
deriving instance (Eq (f a), Eq (t f a)) => Eq (HLift t f a)
deriving instance (Ord (f a), Ord (t f a)) => Ord (HLift t f a)
instance (Eq1 (t f), Eq1 f) => Eq1 (HLift t f) where
liftEq :: forall a b. (a -> b -> Bool) -> HLift t f a -> HLift t f b -> Bool
liftEq a -> b -> Bool
eq = \case
HPure f a
x -> \case
HPure f b
y -> (a -> b -> Bool) -> f a -> f b -> Bool
forall a b. (a -> b -> Bool) -> f a -> f b -> Bool
forall (f :: * -> *) a b.
Eq1 f =>
(a -> b -> Bool) -> f a -> f b -> Bool
liftEq a -> b -> Bool
eq f a
x f b
y
HOther t f b
_ -> Bool
False
HOther t f a
x -> \case
HPure f b
_ -> Bool
False
HOther t f b
y -> (a -> b -> Bool) -> t f a -> t f b -> Bool
forall a b. (a -> b -> Bool) -> t f a -> t f b -> Bool
forall (f :: * -> *) a b.
Eq1 f =>
(a -> b -> Bool) -> f a -> f b -> Bool
liftEq a -> b -> Bool
eq t f a
x t f b
y
instance (Ord1 (t f), Ord1 f) => Ord1 (HLift t f) where
liftCompare :: forall a b.
(a -> b -> Ordering) -> HLift t f a -> HLift t f b -> Ordering
liftCompare a -> b -> Ordering
c = \case
HPure f a
x -> \case
HPure f b
y -> (a -> b -> Ordering) -> f a -> f b -> Ordering
forall a b. (a -> b -> Ordering) -> f a -> f b -> Ordering
forall (f :: * -> *) a b.
Ord1 f =>
(a -> b -> Ordering) -> f a -> f b -> Ordering
liftCompare a -> b -> Ordering
c f a
x f b
y
HOther t f b
_ -> Ordering
LT
HOther t f a
x -> \case
HPure f b
_ -> Ordering
GT
HOther t f b
y -> (a -> b -> Ordering) -> t f a -> t f b -> Ordering
forall a b. (a -> b -> Ordering) -> t f a -> t f b -> Ordering
forall (f :: * -> *) a b.
Ord1 f =>
(a -> b -> Ordering) -> f a -> f b -> Ordering
liftCompare a -> b -> Ordering
c t f a
x t f b
y
instance HFunctor t => HFunctor (HLift t) where
hmap :: forall (f :: k1 -> *) (g :: k1 -> *).
(f ~> g) -> HLift t f ~> HLift t g
hmap f ~> g
f = \case
HPure f x
x -> g x -> HLift t g x
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (a :: k).
f a -> HLift t f a
HPure (f x -> g x
f ~> g
f f x
x)
HOther t f x
x -> t g x -> HLift t g x
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (a :: k).
t f a -> HLift t f a
HOther ((f ~> g) -> t f ~> t g
forall {k} {k1} (t :: (k -> *) -> k1 -> *) (f :: k -> *)
(g :: k -> *).
HFunctor t =>
(f ~> g) -> t f ~> t g
forall (f :: k1 -> *) (g :: k1 -> *). (f ~> g) -> t f ~> t g
hmap f x -> g x
f ~> g
f t f x
x)
instance (Contravariant f, Contravariant (t f)) => Contravariant (HLift t f) where
contramap :: forall a' a. (a' -> a) -> HLift t f a -> HLift t f a'
contramap a' -> a
f = \case
HPure f a
x -> f a' -> HLift t f a'
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (a :: k).
f a -> HLift t f a
HPure ((a' -> a) -> f a -> f a'
forall a' a. (a' -> a) -> f a -> f a'
forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
contramap a' -> a
f f a
x)
HOther t f a
xs -> t f a' -> HLift t f a'
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (a :: k).
t f a -> HLift t f a
HOther ((a' -> a) -> t f a -> t f a'
forall a' a. (a' -> a) -> t f a -> t f a'
forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
contramap a' -> a
f t f a
xs)
instance (Invariant f, Invariant (t f)) => Invariant (HLift t f) where
invmap :: forall a b. (a -> b) -> (b -> a) -> HLift t f a -> HLift t f b
invmap a -> b
f b -> a
g = \case
HPure f a
x -> f b -> HLift t f b
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (a :: k).
f a -> HLift t f a
HPure ((a -> b) -> (b -> a) -> f a -> f b
forall a b. (a -> b) -> (b -> a) -> f a -> f b
forall (f :: * -> *) a b.
Invariant f =>
(a -> b) -> (b -> a) -> f a -> f b
invmap a -> b
f b -> a
g f a
x)
HOther t f a
xs -> t f b -> HLift t f b
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (a :: k).
t f a -> HLift t f a
HOther ((a -> b) -> (b -> a) -> t f a -> t f b
forall a b. (a -> b) -> (b -> a) -> t f a -> t f b
forall (f :: * -> *) a b.
Invariant f =>
(a -> b) -> (b -> a) -> f a -> f b
invmap a -> b
f b -> a
g t f a
xs)
retractHLift
:: Inject t
=> HLift t f a
-> t f a
retractHLift :: forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (a :: k).
Inject t =>
HLift t f a -> t f a
retractHLift = \case
HPure f a
x -> f a -> t f a
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
forall (f :: k -> *). f ~> t f
inject f a
x
HOther t f a
x -> t f a
x
data HFree t f a = HReturn (f a)
| HJoin (t (HFree t f) a)
deriving instance (Functor f, Functor (t (HFree t f))) => Functor (HFree t f)
instance (Contravariant f, Contravariant (t (HFree t f))) => Contravariant (HFree t f) where
contramap :: forall a' a. (a' -> a) -> HFree t f a -> HFree t f a'
contramap a' -> a
f = \case
HReturn f a
x -> f a' -> HFree t f a'
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (a :: k).
f a -> HFree t f a
HReturn ((a' -> a) -> f a -> f a'
forall a' a. (a' -> a) -> f a -> f a'
forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
contramap a' -> a
f f a
x)
HJoin t (HFree t f) a
xs -> t (HFree t f) a' -> HFree t f a'
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (a :: k).
t (HFree t f) a -> HFree t f a
HJoin ((a' -> a) -> t (HFree t f) a -> t (HFree t f) a'
forall a' a. (a' -> a) -> t (HFree t f) a -> t (HFree t f) a'
forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
contramap a' -> a
f t (HFree t f) a
xs)
instance (Invariant f, Invariant (t (HFree t f))) => Invariant (HFree t f) where
invmap :: forall a b. (a -> b) -> (b -> a) -> HFree t f a -> HFree t f b
invmap a -> b
f b -> a
g = \case
HReturn f a
x -> f b -> HFree t f b
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (a :: k).
f a -> HFree t f a
HReturn ((a -> b) -> (b -> a) -> f a -> f b
forall a b. (a -> b) -> (b -> a) -> f a -> f b
forall (f :: * -> *) a b.
Invariant f =>
(a -> b) -> (b -> a) -> f a -> f b
invmap a -> b
f b -> a
g f a
x)
HJoin t (HFree t f) a
xs -> t (HFree t f) b -> HFree t f b
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (a :: k).
t (HFree t f) a -> HFree t f a
HJoin ((a -> b) -> (b -> a) -> t (HFree t f) a -> t (HFree t f) b
forall a b.
(a -> b) -> (b -> a) -> t (HFree t f) a -> t (HFree t f) b
forall (f :: * -> *) a b.
Invariant f =>
(a -> b) -> (b -> a) -> f a -> f b
invmap a -> b
f b -> a
g t (HFree t f) a
xs)
foldHFree
:: forall t f g. HFunctor t
=> (f ~> g)
-> (t g ~> g)
-> (HFree t f ~> g)
foldHFree :: forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (g :: k -> *).
HFunctor t =>
(f ~> g) -> (t g ~> g) -> HFree t f ~> g
foldHFree f ~> g
f t g ~> g
g = HFree t f x -> g x
HFree t f ~> g
go
where
go :: HFree t f ~> g
go :: HFree t f ~> g
go (HReturn f x
x) = f x -> g x
f ~> g
f f x
x
go (HJoin t (HFree t f) x
x) = t g x -> g x
t g ~> g
g ((HFree t f ~> g) -> t (HFree t f) ~> t g
forall {k} {k1} (t :: (k -> *) -> k1 -> *) (f :: k -> *)
(g :: k -> *).
HFunctor t =>
(f ~> g) -> t f ~> t g
forall (f :: k -> *) (g :: k -> *). (f ~> g) -> t f ~> t g
hmap HFree t f x -> g x
HFree t f ~> g
go t (HFree t f) x
x)
retractHFree
:: HBind t
=> HFree t f a
-> t f a
retractHFree :: forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (a :: k).
HBind t =>
HFree t f a -> t f a
retractHFree = \case
HReturn f a
x -> f a -> t f a
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
forall (f :: k -> *). f ~> t f
inject f a
x
HJoin t (HFree t f) a
x -> (HFree t f ~> t f) -> t (HFree t f) ~> t f
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (g :: k -> *).
HBind t =>
(f ~> t g) -> t f ~> t g
forall (f :: k -> *) (g :: k -> *). (f ~> t g) -> t f ~> t g
hbind HFree t f x -> t f x
HFree t f ~> t f
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (a :: k).
HBind t =>
HFree t f a -> t f a
retractHFree t (HFree t f) a
x
instance (Show1 (t (HFree t f)), Show1 f) => Show1 (HFree t f) where
liftShowsPrec :: forall a.
(Int -> a -> ShowS)
-> ([a] -> ShowS) -> Int -> HFree t f a -> ShowS
liftShowsPrec Int -> a -> ShowS
sp [a] -> ShowS
sl Int
d = \case
HReturn f a
x -> (Int -> f a -> ShowS) -> String -> Int -> f a -> ShowS
forall a. (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
showsUnaryWith ((Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
forall (f :: * -> *) a.
Show1 f =>
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
liftShowsPrec Int -> a -> ShowS
sp [a] -> ShowS
sl) String
"HReturn" Int
d f a
x
HJoin t (HFree t f) a
x -> (Int -> t (HFree t f) a -> ShowS)
-> String -> Int -> t (HFree t f) a -> ShowS
forall a. (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
showsUnaryWith ((Int -> a -> ShowS)
-> ([a] -> ShowS) -> Int -> t (HFree t f) a -> ShowS
forall a.
(Int -> a -> ShowS)
-> ([a] -> ShowS) -> Int -> t (HFree t f) a -> ShowS
forall (f :: * -> *) a.
Show1 f =>
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
liftShowsPrec Int -> a -> ShowS
sp [a] -> ShowS
sl) String
"HJoin" Int
d t (HFree t f) a
x
instance (Show1 (t (HFree t f)), Show1 f, Show a) => Show (HFree t f a) where
showsPrec :: Int -> HFree t f a -> ShowS
showsPrec = (Int -> a -> ShowS)
-> ([a] -> ShowS) -> Int -> HFree t f a -> ShowS
forall a.
(Int -> a -> ShowS)
-> ([a] -> ShowS) -> Int -> HFree t f a -> ShowS
forall (f :: * -> *) a.
Show1 f =>
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
liftShowsPrec Int -> a -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec [a] -> ShowS
forall a. Show a => [a] -> ShowS
showList
instance HFunctor t => HFunctor (HFree t) where
hmap :: forall f g. (f ~> g) -> HFree t f ~> HFree t g
hmap :: forall (f :: k1 -> *) (g :: k1 -> *).
(f ~> g) -> HFree t f ~> HFree t g
hmap f ~> g
f = HFree t f x -> HFree t g x
HFree t f ~> HFree t g
go
where
go :: HFree t f ~> HFree t g
go :: HFree t f ~> HFree t g
go = \case
HReturn f x
x -> g x -> HFree t g x
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (a :: k).
f a -> HFree t f a
HReturn (f x -> g x
f ~> g
f f x
x)
HJoin t (HFree t f) x
x -> t (HFree t g) x -> HFree t g x
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (a :: k).
t (HFree t f) a -> HFree t f a
HJoin ((HFree t f ~> HFree t g) -> t (HFree t f) ~> t (HFree t g)
forall {k} {k1} (t :: (k -> *) -> k1 -> *) (f :: k -> *)
(g :: k -> *).
HFunctor t =>
(f ~> g) -> t f ~> t g
forall (f :: k1 -> *) (g :: k1 -> *). (f ~> g) -> t f ~> t g
hmap HFree t f x -> HFree t g x
HFree t f ~> HFree t g
go t (HFree t f) x
x)
class HFunctor t => Inject t where
inject :: f ~> t f
{-# MINIMAL inject #-}
injectMap :: (Inject t, Functor f) => (a -> b) -> f a -> t f b
injectMap :: forall (t :: (* -> *) -> * -> *) (f :: * -> *) a b.
(Inject t, Functor f) =>
(a -> b) -> f a -> t f b
injectMap a -> b
f = f b -> t f b
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
forall (f :: * -> *). f ~> t f
inject (f b -> t f b) -> (f a -> f b) -> f a -> t f b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> b) -> f a -> f b
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f
injectContramap :: (Inject t, Contravariant f) => (a -> b) -> f b -> t f a
injectContramap :: forall (t :: (* -> *) -> * -> *) (f :: * -> *) a b.
(Inject t, Contravariant f) =>
(a -> b) -> f b -> t f a
injectContramap a -> b
f = f a -> t f a
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
forall (f :: * -> *). f ~> t f
inject (f a -> t f a) -> (f b -> f a) -> f b -> t f a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> b) -> f b -> f a
forall a' a. (a' -> a) -> f a -> f a'
forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
contramap a -> b
f
class Inject t => HBind t where
hbind :: (f ~> t g) -> t f ~> t g
hbind f ~> t g
f = t (t g) x -> t g x
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
HBind t =>
t (t f) ~> t f
forall (f :: k -> *). t (t f) ~> t f
hjoin (t (t g) x -> t g x) -> (t f x -> t (t g) x) -> t f x -> t g x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (f ~> t g) -> t f ~> t (t g)
forall {k} {k1} (t :: (k -> *) -> k1 -> *) (f :: k -> *)
(g :: k -> *).
HFunctor t =>
(f ~> g) -> t f ~> t g
forall (f :: k -> *) (g :: k -> *). (f ~> g) -> t f ~> t g
hmap f x -> t g x
f ~> t g
f
hjoin :: t (t f) ~> t f
hjoin = (t f ~> t f) -> t (t f) ~> t f
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (g :: k -> *).
HBind t =>
(f ~> t g) -> t f ~> t g
forall (f :: k -> *) (g :: k -> *). (f ~> t g) -> t f ~> t g
hbind t f x -> t f x
t f ~> t f
forall a. a -> a
id
{-# MINIMAL hbind | hjoin #-}
instance Inject Coyoneda where
inject :: forall (f :: * -> *). f ~> Coyoneda f
inject = f x -> Coyoneda f x
forall (f :: * -> *). f ~> Coyoneda f
liftCoyoneda
instance Inject CCY.Coyoneda where
inject :: forall (f :: * -> *). f ~> Coyoneda f
inject = f x -> Coyoneda f x
forall (f :: * -> *). f ~> Coyoneda f
CCY.liftCoyoneda
instance Inject Ap where
inject :: forall (f :: * -> *). f ~> Ap f
inject = f x -> Ap f x
forall (f :: * -> *). f ~> Ap f
liftAp
instance Inject ListF where
inject :: forall (f :: k -> *). f ~> ListF f
inject = [f x] -> ListF f x
forall {k} (f :: k -> *) (a :: k). [f a] -> ListF f a
ListF ([f x] -> ListF f x) -> (f x -> [f x]) -> f x -> ListF f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (f x -> [f x] -> [f x]
forall a. a -> [a] -> [a]
:[])
instance Inject NonEmptyF where
inject :: forall (f :: k -> *). f ~> NonEmptyF f
inject = NonEmpty (f x) -> NonEmptyF f x
forall {k} (f :: k -> *) (a :: k). NonEmpty (f a) -> NonEmptyF f a
NonEmptyF (NonEmpty (f x) -> NonEmptyF f x)
-> (f x -> NonEmpty (f x)) -> f x -> NonEmptyF f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (f x -> [f x] -> NonEmpty (f x)
forall a. a -> [a] -> NonEmpty a
:| [])
instance Inject MaybeF where
inject :: forall (f :: k -> *). f ~> MaybeF f
inject = Maybe (f x) -> MaybeF f x
forall {k} (f :: k -> *) (a :: k). Maybe (f a) -> MaybeF f a
MaybeF (Maybe (f x) -> MaybeF f x)
-> (f x -> Maybe (f x)) -> f x -> MaybeF f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. f x -> Maybe (f x)
forall a. a -> Maybe a
Just
instance Monoid k => Inject (NEMapF k) where
inject :: forall (f :: k -> *). f ~> NEMapF k f
inject = NEMap k (f x) -> NEMapF k f x
forall {k} k1 (f :: k -> *) (a :: k).
NEMap k1 (f a) -> NEMapF k1 f a
NEMapF (NEMap k (f x) -> NEMapF k f x)
-> (f x -> NEMap k (f x)) -> f x -> NEMapF k f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. k -> f x -> NEMap k (f x)
forall k a. k -> a -> NEMap k a
NEM.singleton k
forall a. Monoid a => a
mempty
instance Monoid k => Inject (MapF k) where
inject :: forall (f :: k -> *). f ~> MapF k f
inject = Map k (f x) -> MapF k f x
forall {k} k1 (f :: k -> *) (a :: k). Map k1 (f a) -> MapF k1 f a
MapF (Map k (f x) -> MapF k f x)
-> (f x -> Map k (f x)) -> f x -> MapF k f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. k -> f x -> Map k (f x)
forall k a. k -> a -> Map k a
M.singleton k
forall a. Monoid a => a
mempty
instance Inject Step where
inject :: forall (f :: k -> *). f ~> Step f
inject = Natural -> f x -> Step f x
forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
0
instance Inject Steps where
inject :: forall (f :: k -> *). f ~> Steps f
inject = NEMap Natural (f x) -> Steps f x
forall {k} (f :: k -> *) (a :: k). NEMap Natural (f a) -> Steps f a
Steps (NEMap Natural (f x) -> Steps f x)
-> (f x -> NEMap Natural (f x)) -> f x -> Steps f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Natural -> f x -> NEMap Natural (f x)
forall k a. k -> a -> NEMap k a
NEM.singleton Natural
0
instance Inject Flagged where
inject :: forall (f :: k -> *). f ~> Flagged f
inject = Bool -> f x -> Flagged f x
forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
False
instance Inject (These1 f) where
inject :: forall (f :: * -> *). f ~> These1 f f
inject = f x -> These1 f f x
forall (f :: * -> *) (f :: * -> *). f ~> These1 f f
That1
instance Applicative f => Inject (Comp f :: (Type -> Type) -> Type -> Type) where
inject :: forall (f :: * -> *). f ~> Comp f f
inject f x
x = () -> f ()
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure () f () -> (() -> f x) -> Comp f f x
forall {k} (f :: * -> *) (g :: k -> *) (a :: k) x.
f x -> (x -> g a) -> Comp f g a
:>>= f x -> () -> f x
forall a b. a -> b -> a
const f x
x
instance Applicative f => Inject ((:.:) f) where
inject :: forall (f :: k -> *). f ~> (f :.: f)
inject f x
x = f (f x) -> (:.:) f f x
forall k2 k1 (f :: k2 -> *) (g :: k1 -> k2) (p :: k1).
f (g p) -> (:.:) f g p
Comp1 (f (f x) -> (:.:) f f x) -> f (f x) -> (:.:) f f x
forall a b. (a -> b) -> a -> b
$ f x -> f (f x)
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure f x
x
instance Plus f => Inject ((:*:) f) where
inject :: forall (f :: * -> *). f ~> (f :*: f)
inject = (f x
forall a. f a
forall (f :: * -> *) a. Plus f => f a
zero f x -> f x -> (:*:) f f x
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*:)
instance Plus f => Inject (Product f) where
inject :: forall (f :: * -> *). f ~> Product f f
inject = f x -> f x -> Product f f x
forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair f x
forall a. f a
forall (f :: * -> *) a. Plus f => f a
zero
instance Inject ((:+:) f) where
inject :: forall (f :: k -> *). f ~> (f :+: f)
inject = f x -> (:+:) f f x
forall k (f :: k -> *) (f :: k -> *). f ~> (f :+: f)
R1
instance Inject (Sum f) where
inject :: forall (f :: k -> *). f ~> Sum f f
inject = f x -> Sum f f x
forall k (f :: k -> *) (f :: k -> *). f ~> Sum f f
InR
instance Inject (M1 i c) where
inject :: forall (f :: k -> *). f ~> M1 i c f
inject = f x -> M1 i c f x
forall k i (c :: Meta) (f :: k -> *). f ~> M1 i c f
M1
instance Inject Alt.Alt where
inject :: forall (f :: * -> *). f ~> Alt f
inject = f x -> Alt f x
forall (f :: * -> *). f ~> Alt f
Alt.liftAlt
instance Inject Free where
inject :: forall (f :: * -> *). f ~> Free f
inject = f x -> Free f x
forall (f :: * -> *). f ~> Free f
liftFree
instance Inject Free1 where
inject :: forall (f :: * -> *). f ~> Free1 f
inject = f x -> Free1 f x
forall (f :: * -> *). f ~> Free1 f
liftFree1
instance Inject FA.Ap where
inject :: forall (f :: * -> *). f ~> Ap f
inject = f x -> Ap f x
forall (f :: * -> *). f ~> Ap f
FA.liftAp
instance Inject FAF.Ap where
inject :: forall (f :: * -> *). f ~> Ap f
inject = f x -> Ap f x
forall (f :: * -> *). f ~> Ap f
FAF.liftAp
instance Inject IdentityT where
inject :: forall (f :: k -> *). f ~> IdentityT f
inject = f x -> IdentityT f x
forall a b. Coercible a b => a -> b
coerce
instance Inject Lift where
inject :: forall (f :: * -> *). f ~> Lift f
inject = f x -> Lift f x
forall (f :: * -> *). f ~> Lift f
Other
instance Inject MaybeApply where
inject :: forall (f :: * -> *). f ~> MaybeApply f
inject = Either (f x) x -> MaybeApply f x
forall (f :: * -> *) a. Either (f a) a -> MaybeApply f a
MaybeApply (Either (f x) x -> MaybeApply f x)
-> (f x -> Either (f x) x) -> f x -> MaybeApply f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. f x -> Either (f x) x
forall a b. a -> Either a b
Left
instance Inject Backwards where
inject :: forall (f :: k -> *). f ~> Backwards f
inject = f x -> Backwards f x
forall k (f :: k -> *). f ~> Backwards f
Backwards
instance Inject WrappedApplicative where
inject :: forall (f :: * -> *). f ~> WrappedApplicative f
inject = f x -> WrappedApplicative f x
forall (f :: * -> *). f ~> WrappedApplicative f
WrapApplicative
instance Inject (ReaderT r) where
inject :: forall (f :: * -> *). f ~> ReaderT r f
inject = (r -> f x) -> ReaderT r f x
forall r (m :: * -> *) a. (r -> m a) -> ReaderT r m a
ReaderT ((r -> f x) -> ReaderT r f x)
-> (f x -> r -> f x) -> f x -> ReaderT r f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. f x -> r -> f x
forall a b. a -> b -> a
const
instance Monoid e => Inject (EnvT e) where
inject :: forall (f :: * -> *). f ~> EnvT e f
inject = e -> f x -> EnvT e f x
forall e (w :: * -> *) a. e -> w a -> EnvT e w a
EnvT e
forall a. Monoid a => a
mempty
instance Inject Reverse where
inject :: forall (f :: k -> *). f ~> Reverse f
inject = f x -> Reverse f x
forall k (f :: k -> *). f ~> Reverse f
Reverse
instance Inject ProxyF where
inject :: forall (f :: k -> *). f ~> ProxyF f
inject f x
_ = ProxyF f x
forall {k} {k} (f :: k) (a :: k). ProxyF f a
ProxyF
instance Monoid e => Inject (ConstF e) where
inject :: forall (f :: k -> *). f ~> ConstF e f
inject f x
_ = e -> ConstF e f x
forall {k} {k} e (f :: k) (a :: k). e -> ConstF e f a
ConstF e
forall a. Monoid a => a
mempty
instance (Inject s, Inject t) => Inject (ComposeT s t) where
inject :: forall (f :: * -> *). f ~> ComposeT s t f
inject = s (t f) x -> ComposeT s t f x
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
f (g m) a -> ComposeT f g m a
ComposeT (s (t f) x -> ComposeT s t f x)
-> (f x -> s (t f) x) -> f x -> ComposeT s t f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t f x -> s (t f) x
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
forall (f :: * -> *). f ~> s f
inject (t f x -> s (t f) x) -> (f x -> t f x) -> f x -> s (t f) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. f x -> t f x
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
forall (f :: * -> *). f ~> t f
inject
instance HFunctor t => Inject (HLift t) where
inject :: forall (f :: k -> *). f ~> HLift t f
inject = f x -> HLift t f x
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (a :: k).
f a -> HLift t f a
HPure
instance HFunctor t => Inject (HFree t) where
inject :: forall (f :: k -> *). f ~> HFree t f
inject = f x -> HFree t f x
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (a :: k).
f a -> HFree t f a
HReturn
instance HBind Coyoneda where
hbind :: forall (f :: * -> *) (g :: * -> *).
(f ~> Coyoneda g) -> Coyoneda f ~> Coyoneda g
hbind f ~> Coyoneda g
f (Coyoneda b -> x
g f b
x) = b -> x
g (b -> x) -> Coyoneda g b -> Coyoneda g x
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> f b -> Coyoneda g b
f ~> Coyoneda g
f f b
x
instance HBind Ap where
hbind :: forall (f :: * -> *) (g :: * -> *). (f ~> Ap g) -> Ap f ~> Ap g
hbind f ~> Ap g
f Ap f x
x = (f ~> Ap g) -> Ap f x -> Ap g x
forall (g :: * -> *) (f :: * -> *) a.
Applicative g =>
(forall x. f x -> g x) -> Ap f a -> g a
runAp f x -> Ap g x
f ~> Ap g
f Ap f x
x
instance HBind ListF where
hbind :: forall (f :: k -> *) (g :: k -> *).
(f ~> ListF g) -> ListF f ~> ListF g
hbind f ~> ListF g
f = (f x -> ListF g x) -> [f x] -> ListF g x
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap f x -> ListF g x
f ~> ListF g
f ([f x] -> ListF g x)
-> (ListF f x -> [f x]) -> ListF f x -> ListF g x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ListF f x -> [f x]
forall {k} (f :: k -> *) (a :: k). ListF f a -> [f a]
runListF
instance HBind NonEmptyF where
hbind :: forall (f :: k -> *) (g :: k -> *).
(f ~> NonEmptyF g) -> NonEmptyF f ~> NonEmptyF g
hbind f ~> NonEmptyF g
f = (f x -> NonEmptyF g x) -> NonEmpty (f x) -> NonEmptyF g x
forall m a. Semigroup m => (a -> m) -> NonEmpty a -> m
forall (t :: * -> *) m a.
(Foldable1 t, Semigroup m) =>
(a -> m) -> t a -> m
foldMap1 f x -> NonEmptyF g x
f ~> NonEmptyF g
f (NonEmpty (f x) -> NonEmptyF g x)
-> (NonEmptyF f x -> NonEmpty (f x))
-> NonEmptyF f x
-> NonEmptyF g x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyF f x -> NonEmpty (f x)
forall {k} (f :: k -> *) (a :: k). NonEmptyF f a -> NonEmpty (f a)
runNonEmptyF
instance HBind MaybeF where
hbind :: forall (f :: k -> *) (g :: k -> *).
(f ~> MaybeF g) -> MaybeF f ~> MaybeF g
hbind f ~> MaybeF g
f = (f x -> MaybeF g x) -> Maybe (f x) -> MaybeF g x
forall m a. Monoid m => (a -> m) -> Maybe a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap f x -> MaybeF g x
f ~> MaybeF g
f (Maybe (f x) -> MaybeF g x)
-> (MaybeF f x -> Maybe (f x)) -> MaybeF f x -> MaybeF g x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MaybeF f x -> Maybe (f x)
forall {k} (f :: k -> *) (a :: k). MaybeF f a -> Maybe (f a)
runMaybeF
instance HBind Step where
hbind :: forall (f :: k -> *) (g :: k -> *).
(f ~> Step g) -> Step f ~> Step g
hbind f ~> Step g
f (Step Natural
n f x
x) = Natural -> g x -> Step g x
forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step (Natural
n Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
+ Natural
m) g x
y
where
Step Natural
m g x
y = f x -> Step g x
f ~> Step g
f f x
x
instance HBind Flagged where
hbind :: forall (f :: k -> *) (g :: k -> *).
(f ~> Flagged g) -> Flagged f ~> Flagged g
hbind f ~> Flagged g
f (Flagged Bool
p f x
x) = Bool -> g x -> Flagged g x
forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged (Bool
p Bool -> Bool -> Bool
|| Bool
q) g x
y
where
Flagged Bool
q g x
y = f x -> Flagged g x
f ~> Flagged g
f f x
x
instance Alt f => HBind (These1 f) where
hbind :: forall (f :: * -> *) (g :: * -> *).
(f ~> These1 f g) -> These1 f f ~> These1 f g
hbind f ~> These1 f g
f = \case
This1 f x
x -> f x -> These1 f g x
forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1 f x
x
That1 f x
y -> f x -> These1 f g x
f ~> These1 f g
f f x
y
These1 f x
x f x
y -> case f x -> These1 f g x
f ~> These1 f g
f f x
y of
This1 f x
x' -> f x -> These1 f g x
forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1 (f x
x f x -> f x -> f x
forall a. f a -> f a -> f a
forall (f :: * -> *) a. Alt f => f a -> f a -> f a
<!> f x
x')
That1 g x
y' -> g x -> These1 f g x
forall (f :: * -> *) (f :: * -> *). f ~> These1 f f
That1 g x
y'
These1 f x
x' g x
y' -> f x -> g x -> These1 f g x
forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 (f x
x f x -> f x -> f x
forall a. f a -> f a -> f a
forall (f :: * -> *) a. Alt f => f a -> f a -> f a
<!> f x
x') g x
y'
instance Plus f => HBind ((:*:) f) where
hbind :: forall (f :: * -> *) (g :: * -> *).
(f ~> (f :*: g)) -> (f :*: f) ~> (f :*: g)
hbind f ~> (f :*: g)
f (f x
x :*: f x
y) = (f x
x f x -> f x -> f x
forall a. f a -> f a -> f a
forall (f :: * -> *) a. Alt f => f a -> f a -> f a
<!> f x
x') f x -> g x -> (:*:) f g x
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: g x
y'
where
f x
x' :*: g x
y' = f x -> (:*:) f g x
f ~> (f :*: g)
f f x
y
instance Plus f => HBind (Product f) where
hbind :: forall (f :: * -> *) (g :: * -> *).
(f ~> Product f g) -> Product f f ~> Product f g
hbind f ~> Product f g
f (Pair f x
x f x
y) = f x -> g x -> Product f g x
forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (f x
x f x -> f x -> f x
forall a. f a -> f a -> f a
forall (f :: * -> *) a. Alt f => f a -> f a -> f a
<!> f x
x') g x
y'
where
Pair f x
x' g x
y' = f x -> Product f g x
f ~> Product f g
f f x
y
instance HBind ((:+:) f) where
hbind :: forall (f :: k -> *) (g :: k -> *).
(f ~> (f :+: g)) -> (f :+: f) ~> (f :+: g)
hbind f ~> (f :+: g)
f = \case
L1 f x
x -> f x -> (:+:) f g x
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 f x
x
R1 f x
y -> f x -> (:+:) f g x
f ~> (f :+: g)
f f x
y
instance HBind (Sum f) where
hbind :: forall (f :: k -> *) (g :: k -> *).
(f ~> Sum f g) -> Sum f f ~> Sum f g
hbind f ~> Sum f g
f = \case
InL f x
x -> f x -> Sum f g x
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL f x
x
InR f x
y -> f x -> Sum f g x
f ~> Sum f g
f f x
y
instance HBind (M1 i c) where
hbind :: forall (f :: k -> *) (g :: k -> *).
(f ~> M1 i c g) -> M1 i c f ~> M1 i c g
hbind f ~> M1 i c g
f (M1 f x
x) = f x -> M1 i c g x
f ~> M1 i c g
f f x
x
instance HBind Alt.Alt where
hbind :: forall (f :: * -> *) (g :: * -> *). (f ~> Alt g) -> Alt f ~> Alt g
hbind f ~> Alt g
f Alt f x
x = (f ~> Alt g) -> Alt f x -> Alt g x
forall (f :: * -> *) (g :: * -> *) a.
Alternative g =>
(forall x. f x -> g x) -> Alt f a -> g a
Alt.runAlt f x -> Alt g x
f ~> Alt g
f Alt f x
x
instance HBind Free where
hbind :: forall (f :: * -> *) (g :: * -> *).
(f ~> Free g) -> Free f ~> Free g
hbind f ~> Free g
f Free f x
x = (f ~> Free g) -> Free f ~> Free g
forall (g :: * -> *) (f :: * -> *).
Monad g =>
(f ~> g) -> Free f ~> g
interpretFree f x -> Free g x
f ~> Free g
f Free f x
x
instance HBind Free1 where
hbind :: forall (f :: * -> *) (g :: * -> *).
(f ~> Free1 g) -> Free1 f ~> Free1 g
hbind f ~> Free1 g
f Free1 f x
x = (f ~> Free1 g) -> Free1 f ~> Free1 g
forall (g :: * -> *) (f :: * -> *).
Bind g =>
(f ~> g) -> Free1 f ~> g
interpretFree1 f x -> Free1 g x
f ~> Free1 g
f Free1 f x
x
instance HBind FA.Ap where
hbind :: forall (f :: * -> *) (g :: * -> *). (f ~> Ap g) -> Ap f ~> Ap g
hbind f ~> Ap g
f Ap f x
x = (f ~> Ap g) -> Ap f x -> Ap g x
forall (g :: * -> *) (f :: * -> *) a.
Applicative g =>
(forall x. f x -> g x) -> Ap f a -> g a
FA.runAp f x -> Ap g x
f ~> Ap g
f Ap f x
x
instance HBind FAF.Ap where
hbind :: forall (f :: * -> *) (g :: * -> *). (f ~> Ap g) -> Ap f ~> Ap g
hbind f ~> Ap g
f Ap f x
x = (f ~> Ap g) -> Ap f x -> Ap g x
forall (g :: * -> *) (f :: * -> *) a.
Applicative g =>
(forall x. f x -> g x) -> Ap f a -> g a
FAF.runAp f x -> Ap g x
f ~> Ap g
f Ap f x
x
instance HBind IdentityT where
hbind :: forall (f :: k -> *) (g :: k -> *).
(f ~> IdentityT g) -> IdentityT f ~> IdentityT g
hbind f ~> IdentityT g
f = f x -> IdentityT g x
f ~> IdentityT g
f (f x -> IdentityT g x)
-> (IdentityT f x -> f x) -> IdentityT f x -> IdentityT g x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IdentityT f x -> f x
forall {k} (f :: k -> *) (a :: k). IdentityT f a -> f a
runIdentityT
instance HBind Lift where
hbind :: forall (f :: * -> *) (g :: * -> *).
(f ~> Lift g) -> Lift f ~> Lift g
hbind f ~> Lift g
f Lift f x
x = (x -> Lift g x) -> (f x -> Lift g x) -> Lift f x -> Lift g x
forall a r (f :: * -> *). (a -> r) -> (f a -> r) -> Lift f a -> r
elimLift x -> Lift g x
forall a. a -> Lift g a
forall (p :: * -> *) a. Pointed p => a -> p a
point f x -> Lift g x
f ~> Lift g
f Lift f x
x
instance HBind MaybeApply where
hbind :: forall (f :: * -> *) (g :: * -> *).
(f ~> MaybeApply g) -> MaybeApply f ~> MaybeApply g
hbind f ~> MaybeApply g
f = (f x -> MaybeApply g x)
-> (x -> MaybeApply g x) -> Either (f x) x -> MaybeApply g x
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either f x -> MaybeApply g x
f ~> MaybeApply g
f x -> MaybeApply g x
forall a. a -> MaybeApply g a
forall (p :: * -> *) a. Pointed p => a -> p a
point (Either (f x) x -> MaybeApply g x)
-> (MaybeApply f x -> Either (f x) x)
-> MaybeApply f x
-> MaybeApply g x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MaybeApply f x -> Either (f x) x
forall (f :: * -> *) a. MaybeApply f a -> Either (f a) a
runMaybeApply
instance HBind Backwards where
hbind :: forall (f :: k -> *) (g :: k -> *).
(f ~> Backwards g) -> Backwards f ~> Backwards g
hbind f ~> Backwards g
f = f x -> Backwards g x
f ~> Backwards g
f (f x -> Backwards g x)
-> (Backwards f x -> f x) -> Backwards f x -> Backwards g x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Backwards f x -> f x
forall {k} (f :: k -> *) (a :: k). Backwards f a -> f a
forwards
instance HBind WrappedApplicative where
hbind :: forall (f :: * -> *) (g :: * -> *).
(f ~> WrappedApplicative g)
-> WrappedApplicative f ~> WrappedApplicative g
hbind f ~> WrappedApplicative g
f = f x -> WrappedApplicative g x
f ~> WrappedApplicative g
f (f x -> WrappedApplicative g x)
-> (WrappedApplicative f x -> f x)
-> WrappedApplicative f x
-> WrappedApplicative g x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrappedApplicative f x -> f x
forall (f :: * -> *) a. WrappedApplicative f a -> f a
unwrapApplicative
instance HBind Reverse where
hbind :: forall (f :: k -> *) (g :: k -> *).
(f ~> Reverse g) -> Reverse f ~> Reverse g
hbind f ~> Reverse g
f = f x -> Reverse g x
f ~> Reverse g
f (f x -> Reverse g x)
-> (Reverse f x -> f x) -> Reverse f x -> Reverse g x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Reverse f x -> f x
forall {k} (f :: k -> *) (a :: k). Reverse f a -> f a
getReverse
instance HBind ProxyF where
hbind :: forall (f :: k -> *) (g :: k -> *).
(f ~> ProxyF g) -> ProxyF f ~> ProxyF g
hbind f ~> ProxyF g
_ = ProxyF f x -> ProxyF g x
forall a b. Coercible a b => a -> b
coerce
instance Monoid e => HBind (EnvT e) where
hbind :: forall (f :: * -> *) (g :: * -> *).
(f ~> EnvT e g) -> EnvT e f ~> EnvT e g
hbind f ~> EnvT e g
f (EnvT e
e f x
x) = e -> g x -> EnvT e g x
forall e (w :: * -> *) a. e -> w a -> EnvT e w a
EnvT (e
e e -> e -> e
forall a. Semigroup a => a -> a -> a
<> e
e') g x
y
where
EnvT e
e' g x
y = f x -> EnvT e g x
f ~> EnvT e g
f f x
x
instance HBind t => HBind (HLift t) where
hbind :: forall (f :: k -> *) (g :: k -> *).
(f ~> HLift t g) -> HLift t f ~> HLift t g
hbind f ~> HLift t g
f = \case
HPure f x
x -> f x -> HLift t g x
f ~> HLift t g
f f x
x
HOther t f x
x -> t g x -> HLift t g x
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (a :: k).
t f a -> HLift t f a
HOther (t g x -> HLift t g x) -> t g x -> HLift t g x
forall a b. (a -> b) -> a -> b
$ (\f x
y -> case f x -> HLift t g x
f ~> HLift t g
f f x
y of
HPure g x
z -> g x -> t g x
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
forall (f :: k -> *). f ~> t f
inject g x
z
HOther t g x
z -> t g x
z) (forall {x :: k}. f x -> t g x) -> t f ~> t g
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (g :: k -> *).
HBind t =>
(f ~> t g) -> t f ~> t g
forall (f :: k -> *) (g :: k -> *). (f ~> t g) -> t f ~> t g
`hbind` t f x
x
instance HFunctor t => HBind (HFree t) where
hbind :: forall (f :: k -> *) (g :: k -> *).
(f ~> HFree t g) -> HFree t f ~> HFree t g
hbind f ~> HFree t g
f = \case
HReturn f x
x -> f x -> HFree t g x
f ~> HFree t g
f f x
x
HJoin t (HFree t f) x
x -> t (HFree t g) x -> HFree t g x
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (a :: k).
t (HFree t f) a -> HFree t f a
HJoin (t (HFree t g) x -> HFree t g x) -> t (HFree t g) x -> HFree t g x
forall a b. (a -> b) -> a -> b
$ (HFree t f ~> HFree t g) -> t (HFree t f) ~> t (HFree t g)
forall {k} {k1} (t :: (k -> *) -> k1 -> *) (f :: k -> *)
(g :: k -> *).
HFunctor t =>
(f ~> g) -> t f ~> t g
forall (f :: k -> *) (g :: k -> *). (f ~> g) -> t f ~> t g
hmap ((f ~> HFree t g) -> HFree t f ~> HFree t g
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (g :: k -> *).
HBind t =>
(f ~> t g) -> t f ~> t g
forall (f :: k -> *) (g :: k -> *).
(f ~> HFree t g) -> HFree t f ~> HFree t g
hbind f x -> HFree t g x
f ~> HFree t g
f) t (HFree t f) x
x