-- | Defines @newtype@s that serve as combinators
-- to compose deriving via strategies.

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UnboxedTuples #-}

module Capability.Accessors
  ( Coerce(..)
  , Rename(..)
  , Field(..)
  , Pos(..)
  , Ctor(..)
  , Lift(..)
  , (:.:)(..)
  ) where

import Control.Monad.IO.Class (MonadIO)
import Control.Monad.Primitive (PrimMonad)
import Data.Kind (Type)
import GHC.TypeLits (Nat, Symbol)

-- | Coerce the type in the context @m@ to @to@.
--
-- Example:
--
-- @
-- newtype MyInt = MyInt Int
-- newtype MyReader a = MyReader (Reader Int a)
--   deriving (HasReader "a" MyInt) via
--     Coerce MyInt (MonadReader (Reader Int))
-- @
--
-- Converts the @'Capability.Reader.HasReader' \"a\" Int@ instance of
-- @'Capability.Reader.MonadReader' (Reader Int)@ to a
-- @'Capability.Reader.HasReader' \"a\" MyInt@
-- instance using @Coercible Int MyInt@.
newtype Coerce (to :: Type) m (a :: Type) = Coerce (m a)
  deriving (a -> Coerce to m b -> Coerce to m a
(a -> b) -> Coerce to m a -> Coerce to m b
(forall a b. (a -> b) -> Coerce to m a -> Coerce to m b)
-> (forall a b. a -> Coerce to m b -> Coerce to m a)
-> Functor (Coerce to m)
forall a b. a -> Coerce to m b -> Coerce to m a
forall a b. (a -> b) -> Coerce to m a -> Coerce to m b
forall to (m :: * -> *) a b.
Functor m =>
a -> Coerce to m b -> Coerce to m a
forall to (m :: * -> *) a b.
Functor m =>
(a -> b) -> Coerce to m a -> Coerce to m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Coerce to m b -> Coerce to m a
$c<$ :: forall to (m :: * -> *) a b.
Functor m =>
a -> Coerce to m b -> Coerce to m a
fmap :: (a -> b) -> Coerce to m a -> Coerce to m b
$cfmap :: forall to (m :: * -> *) a b.
Functor m =>
(a -> b) -> Coerce to m a -> Coerce to m b
Functor, Functor (Coerce to m)
a -> Coerce to m a
Functor (Coerce to m)
-> (forall a. a -> Coerce to m a)
-> (forall a b.
    Coerce to m (a -> b) -> Coerce to m a -> Coerce to m b)
-> (forall a b c.
    (a -> b -> c) -> Coerce to m a -> Coerce to m b -> Coerce to m c)
-> (forall a b. Coerce to m a -> Coerce to m b -> Coerce to m b)
-> (forall a b. Coerce to m a -> Coerce to m b -> Coerce to m a)
-> Applicative (Coerce to m)
Coerce to m a -> Coerce to m b -> Coerce to m b
Coerce to m a -> Coerce to m b -> Coerce to m a
Coerce to m (a -> b) -> Coerce to m a -> Coerce to m b
(a -> b -> c) -> Coerce to m a -> Coerce to m b -> Coerce to m c
forall a. a -> Coerce to m a
forall a b. Coerce to m a -> Coerce to m b -> Coerce to m a
forall a b. Coerce to m a -> Coerce to m b -> Coerce to m b
forall a b. Coerce to m (a -> b) -> Coerce to m a -> Coerce to m b
forall a b c.
(a -> b -> c) -> Coerce to m a -> Coerce to m b -> Coerce to m c
forall to (m :: * -> *). Applicative m => Functor (Coerce to m)
forall to (m :: * -> *) a. Applicative m => a -> Coerce to m a
forall to (m :: * -> *) a b.
Applicative m =>
Coerce to m a -> Coerce to m b -> Coerce to m a
forall to (m :: * -> *) a b.
Applicative m =>
Coerce to m a -> Coerce to m b -> Coerce to m b
forall to (m :: * -> *) a b.
Applicative m =>
Coerce to m (a -> b) -> Coerce to m a -> Coerce to m b
forall to (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c) -> Coerce to m a -> Coerce to m b -> Coerce to m c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: Coerce to m a -> Coerce to m b -> Coerce to m a
$c<* :: forall to (m :: * -> *) a b.
Applicative m =>
Coerce to m a -> Coerce to m b -> Coerce to m a
*> :: Coerce to m a -> Coerce to m b -> Coerce to m b
$c*> :: forall to (m :: * -> *) a b.
Applicative m =>
Coerce to m a -> Coerce to m b -> Coerce to m b
liftA2 :: (a -> b -> c) -> Coerce to m a -> Coerce to m b -> Coerce to m c
$cliftA2 :: forall to (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c) -> Coerce to m a -> Coerce to m b -> Coerce to m c
<*> :: Coerce to m (a -> b) -> Coerce to m a -> Coerce to m b
$c<*> :: forall to (m :: * -> *) a b.
Applicative m =>
Coerce to m (a -> b) -> Coerce to m a -> Coerce to m b
pure :: a -> Coerce to m a
$cpure :: forall to (m :: * -> *) a. Applicative m => a -> Coerce to m a
$cp1Applicative :: forall to (m :: * -> *). Applicative m => Functor (Coerce to m)
Applicative, Applicative (Coerce to m)
a -> Coerce to m a
Applicative (Coerce to m)
-> (forall a b.
    Coerce to m a -> (a -> Coerce to m b) -> Coerce to m b)
-> (forall a b. Coerce to m a -> Coerce to m b -> Coerce to m b)
-> (forall a. a -> Coerce to m a)
-> Monad (Coerce to m)
Coerce to m a -> (a -> Coerce to m b) -> Coerce to m b
Coerce to m a -> Coerce to m b -> Coerce to m b
forall a. a -> Coerce to m a
forall a b. Coerce to m a -> Coerce to m b -> Coerce to m b
forall a b. Coerce to m a -> (a -> Coerce to m b) -> Coerce to m b
forall to (m :: * -> *). Monad m => Applicative (Coerce to m)
forall to (m :: * -> *) a. Monad m => a -> Coerce to m a
forall to (m :: * -> *) a b.
Monad m =>
Coerce to m a -> Coerce to m b -> Coerce to m b
forall to (m :: * -> *) a b.
Monad m =>
Coerce to m a -> (a -> Coerce to m b) -> Coerce to m b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: a -> Coerce to m a
$creturn :: forall to (m :: * -> *) a. Monad m => a -> Coerce to m a
>> :: Coerce to m a -> Coerce to m b -> Coerce to m b
$c>> :: forall to (m :: * -> *) a b.
Monad m =>
Coerce to m a -> Coerce to m b -> Coerce to m b
>>= :: Coerce to m a -> (a -> Coerce to m b) -> Coerce to m b
$c>>= :: forall to (m :: * -> *) a b.
Monad m =>
Coerce to m a -> (a -> Coerce to m b) -> Coerce to m b
$cp1Monad :: forall to (m :: * -> *). Monad m => Applicative (Coerce to m)
Monad, Monad (Coerce to m)
Monad (Coerce to m)
-> (forall a. IO a -> Coerce to m a) -> MonadIO (Coerce to m)
IO a -> Coerce to m a
forall a. IO a -> Coerce to m a
forall to (m :: * -> *). MonadIO m => Monad (Coerce to m)
forall to (m :: * -> *) a. MonadIO m => IO a -> Coerce to m a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
liftIO :: IO a -> Coerce to m a
$cliftIO :: forall to (m :: * -> *) a. MonadIO m => IO a -> Coerce to m a
$cp1MonadIO :: forall to (m :: * -> *). MonadIO m => Monad (Coerce to m)
MonadIO, Monad (Coerce to m)
Monad (Coerce to m)
-> (forall a.
    (State# (PrimState (Coerce to m))
     -> (# State# (PrimState (Coerce to m)), a #))
    -> Coerce to m a)
-> PrimMonad (Coerce to m)
(State# (PrimState (Coerce to m))
 -> (# State# (PrimState (Coerce to m)), a #))
-> Coerce to m a
forall a.
(State# (PrimState (Coerce to m))
 -> (# State# (PrimState (Coerce to m)), a #))
-> Coerce to m a
forall to (m :: * -> *). PrimMonad m => Monad (Coerce to m)
forall to (m :: * -> *) a.
PrimMonad m =>
(State# (PrimState (Coerce to m))
 -> (# State# (PrimState (Coerce to m)), a #))
-> Coerce to m a
forall (m :: * -> *).
Monad m
-> (forall a.
    (State# (PrimState m) -> (# State# (PrimState m), a #)) -> m a)
-> PrimMonad m
primitive :: (State# (PrimState (Coerce to m))
 -> (# State# (PrimState (Coerce to m)), a #))
-> Coerce to m a
$cprimitive :: forall to (m :: * -> *) a.
PrimMonad m =>
(State# (PrimState (Coerce to m))
 -> (# State# (PrimState (Coerce to m)), a #))
-> Coerce to m a
$cp1PrimMonad :: forall to (m :: * -> *). PrimMonad m => Monad (Coerce to m)
PrimMonad)

-- | Rename the tag.
--
-- Example:
--
-- @
-- newtype MyReader a = MyReader (Reader Int a)
--   deriving (HasReader "foo" Int) via
--     Rename "bar" (MonadReader (Reader Int))
-- @
--
-- Converts the @'Capability.Reader.HasReader' \"bar\" Int@ instance of
-- @'Capability.Reader.MonadReader' (Reader Int)@ to a
-- @'Capability.Reader.HasReader' \"foo\" Int@ instance by renaming the tag.
--
-- Note, that 'Capability.Reader.MonadReader' itself does not fix a tag,
-- and @Rename@ is redundant in this example.
--
-- See 'Pos' below for a common use-case.
newtype Rename (oldtag :: k) m (a :: Type) = Rename (m a)
  deriving (a -> Rename oldtag m b -> Rename oldtag m a
(a -> b) -> Rename oldtag m a -> Rename oldtag m b
(forall a b. (a -> b) -> Rename oldtag m a -> Rename oldtag m b)
-> (forall a b. a -> Rename oldtag m b -> Rename oldtag m a)
-> Functor (Rename oldtag m)
forall k (oldtag :: k) (m :: * -> *) a b.
Functor m =>
a -> Rename oldtag m b -> Rename oldtag m a
forall k (oldtag :: k) (m :: * -> *) a b.
Functor m =>
(a -> b) -> Rename oldtag m a -> Rename oldtag m b
forall a b. a -> Rename oldtag m b -> Rename oldtag m a
forall a b. (a -> b) -> Rename oldtag m a -> Rename oldtag m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Rename oldtag m b -> Rename oldtag m a
$c<$ :: forall k (oldtag :: k) (m :: * -> *) a b.
Functor m =>
a -> Rename oldtag m b -> Rename oldtag m a
fmap :: (a -> b) -> Rename oldtag m a -> Rename oldtag m b
$cfmap :: forall k (oldtag :: k) (m :: * -> *) a b.
Functor m =>
(a -> b) -> Rename oldtag m a -> Rename oldtag m b
Functor, Functor (Rename oldtag m)
a -> Rename oldtag m a
Functor (Rename oldtag m)
-> (forall a. a -> Rename oldtag m a)
-> (forall a b.
    Rename oldtag m (a -> b) -> Rename oldtag m a -> Rename oldtag m b)
-> (forall a b c.
    (a -> b -> c)
    -> Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m c)
-> (forall a b.
    Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m b)
-> (forall a b.
    Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m a)
-> Applicative (Rename oldtag m)
Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m b
Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m a
Rename oldtag m (a -> b) -> Rename oldtag m a -> Rename oldtag m b
(a -> b -> c)
-> Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m c
forall a. a -> Rename oldtag m a
forall k (oldtag :: k) (m :: * -> *).
Applicative m =>
Functor (Rename oldtag m)
forall k (oldtag :: k) (m :: * -> *) a.
Applicative m =>
a -> Rename oldtag m a
forall k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m a
forall k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m b
forall k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Rename oldtag m (a -> b) -> Rename oldtag m a -> Rename oldtag m b
forall k (oldtag :: k) (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m c
forall a b.
Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m a
forall a b.
Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m b
forall a b.
Rename oldtag m (a -> b) -> Rename oldtag m a -> Rename oldtag m b
forall a b c.
(a -> b -> c)
-> Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m a
$c<* :: forall k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m a
*> :: Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m b
$c*> :: forall k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m b
liftA2 :: (a -> b -> c)
-> Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m c
$cliftA2 :: forall k (oldtag :: k) (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m c
<*> :: Rename oldtag m (a -> b) -> Rename oldtag m a -> Rename oldtag m b
$c<*> :: forall k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Rename oldtag m (a -> b) -> Rename oldtag m a -> Rename oldtag m b
pure :: a -> Rename oldtag m a
$cpure :: forall k (oldtag :: k) (m :: * -> *) a.
Applicative m =>
a -> Rename oldtag m a
$cp1Applicative :: forall k (oldtag :: k) (m :: * -> *).
Applicative m =>
Functor (Rename oldtag m)
Applicative, Applicative (Rename oldtag m)
a -> Rename oldtag m a
Applicative (Rename oldtag m)
-> (forall a b.
    Rename oldtag m a -> (a -> Rename oldtag m b) -> Rename oldtag m b)
-> (forall a b.
    Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m b)
-> (forall a. a -> Rename oldtag m a)
-> Monad (Rename oldtag m)
Rename oldtag m a -> (a -> Rename oldtag m b) -> Rename oldtag m b
Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m b
forall a. a -> Rename oldtag m a
forall k (oldtag :: k) (m :: * -> *).
Monad m =>
Applicative (Rename oldtag m)
forall k (oldtag :: k) (m :: * -> *) a.
Monad m =>
a -> Rename oldtag m a
forall k (oldtag :: k) (m :: * -> *) a b.
Monad m =>
Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m b
forall k (oldtag :: k) (m :: * -> *) a b.
Monad m =>
Rename oldtag m a -> (a -> Rename oldtag m b) -> Rename oldtag m b
forall a b.
Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m b
forall a b.
Rename oldtag m a -> (a -> Rename oldtag m b) -> Rename oldtag m b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: a -> Rename oldtag m a
$creturn :: forall k (oldtag :: k) (m :: * -> *) a.
Monad m =>
a -> Rename oldtag m a
>> :: Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m b
$c>> :: forall k (oldtag :: k) (m :: * -> *) a b.
Monad m =>
Rename oldtag m a -> Rename oldtag m b -> Rename oldtag m b
>>= :: Rename oldtag m a -> (a -> Rename oldtag m b) -> Rename oldtag m b
$c>>= :: forall k (oldtag :: k) (m :: * -> *) a b.
Monad m =>
Rename oldtag m a -> (a -> Rename oldtag m b) -> Rename oldtag m b
$cp1Monad :: forall k (oldtag :: k) (m :: * -> *).
Monad m =>
Applicative (Rename oldtag m)
Monad, Monad (Rename oldtag m)
Monad (Rename oldtag m)
-> (forall a. IO a -> Rename oldtag m a)
-> MonadIO (Rename oldtag m)
IO a -> Rename oldtag m a
forall a. IO a -> Rename oldtag m a
forall k (oldtag :: k) (m :: * -> *).
MonadIO m =>
Monad (Rename oldtag m)
forall k (oldtag :: k) (m :: * -> *) a.
MonadIO m =>
IO a -> Rename oldtag m a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
liftIO :: IO a -> Rename oldtag m a
$cliftIO :: forall k (oldtag :: k) (m :: * -> *) a.
MonadIO m =>
IO a -> Rename oldtag m a
$cp1MonadIO :: forall k (oldtag :: k) (m :: * -> *).
MonadIO m =>
Monad (Rename oldtag m)
MonadIO, Monad (Rename oldtag m)
Monad (Rename oldtag m)
-> (forall a.
    (State# (PrimState (Rename oldtag m))
     -> (# State# (PrimState (Rename oldtag m)), a #))
    -> Rename oldtag m a)
-> PrimMonad (Rename oldtag m)
(State# (PrimState (Rename oldtag m))
 -> (# State# (PrimState (Rename oldtag m)), a #))
-> Rename oldtag m a
forall a.
(State# (PrimState (Rename oldtag m))
 -> (# State# (PrimState (Rename oldtag m)), a #))
-> Rename oldtag m a
forall k (oldtag :: k) (m :: * -> *).
PrimMonad m =>
Monad (Rename oldtag m)
forall k (oldtag :: k) (m :: * -> *) a.
PrimMonad m =>
(State# (PrimState (Rename oldtag m))
 -> (# State# (PrimState (Rename oldtag m)), a #))
-> Rename oldtag m a
forall (m :: * -> *).
Monad m
-> (forall a.
    (State# (PrimState m) -> (# State# (PrimState m), a #)) -> m a)
-> PrimMonad m
primitive :: (State# (PrimState (Rename oldtag m))
 -> (# State# (PrimState (Rename oldtag m)), a #))
-> Rename oldtag m a
$cprimitive :: forall k (oldtag :: k) (m :: * -> *) a.
PrimMonad m =>
(State# (PrimState (Rename oldtag m))
 -> (# State# (PrimState (Rename oldtag m)), a #))
-> Rename oldtag m a
$cp1PrimMonad :: forall k (oldtag :: k) (m :: * -> *).
PrimMonad m =>
Monad (Rename oldtag m)
PrimMonad)

-- | Access the record field @field@ in the context @m@.
--
-- Example:
--
-- @
-- data Foo = Foo { foo :: Int }
-- newtype MyReader a = MyReader (Reader Foo a)
--   deriving (HasReader "foo" Int) via
--     Field "foo" () (MonadReader (Reader Foo))
-- @
--
-- Converts the @'Capability.Reader.HasReader' () Foo@ instance of
-- @'Capability.Reader.MonadReader' (Reader Foo)@ to a
-- @'Capability.Reader.HasReader' \"foo\" Int@
-- instance by focusing on the field @foo@ in the @Foo@ record.
--
-- See 'Rename' for a way to change the tag.
newtype Field (field :: Symbol) (oldtag :: k) m (a :: Type) = Field (m a)
  deriving (a -> Field field oldtag m b -> Field field oldtag m a
(a -> b) -> Field field oldtag m a -> Field field oldtag m b
(forall a b.
 (a -> b) -> Field field oldtag m a -> Field field oldtag m b)
-> (forall a b.
    a -> Field field oldtag m b -> Field field oldtag m a)
-> Functor (Field field oldtag m)
forall a b. a -> Field field oldtag m b -> Field field oldtag m a
forall a b.
(a -> b) -> Field field oldtag m a -> Field field oldtag m b
forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Functor m =>
a -> Field field oldtag m b -> Field field oldtag m a
forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Functor m =>
(a -> b) -> Field field oldtag m a -> Field field oldtag m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Field field oldtag m b -> Field field oldtag m a
$c<$ :: forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Functor m =>
a -> Field field oldtag m b -> Field field oldtag m a
fmap :: (a -> b) -> Field field oldtag m a -> Field field oldtag m b
$cfmap :: forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Functor m =>
(a -> b) -> Field field oldtag m a -> Field field oldtag m b
Functor, Functor (Field field oldtag m)
a -> Field field oldtag m a
Functor (Field field oldtag m)
-> (forall a. a -> Field field oldtag m a)
-> (forall a b.
    Field field oldtag m (a -> b)
    -> Field field oldtag m a -> Field field oldtag m b)
-> (forall a b c.
    (a -> b -> c)
    -> Field field oldtag m a
    -> Field field oldtag m b
    -> Field field oldtag m c)
-> (forall a b.
    Field field oldtag m a
    -> Field field oldtag m b -> Field field oldtag m b)
-> (forall a b.
    Field field oldtag m a
    -> Field field oldtag m b -> Field field oldtag m a)
-> Applicative (Field field oldtag m)
Field field oldtag m a
-> Field field oldtag m b -> Field field oldtag m b
Field field oldtag m a
-> Field field oldtag m b -> Field field oldtag m a
Field field oldtag m (a -> b)
-> Field field oldtag m a -> Field field oldtag m b
(a -> b -> c)
-> Field field oldtag m a
-> Field field oldtag m b
-> Field field oldtag m c
forall a. a -> Field field oldtag m a
forall a b.
Field field oldtag m a
-> Field field oldtag m b -> Field field oldtag m a
forall a b.
Field field oldtag m a
-> Field field oldtag m b -> Field field oldtag m b
forall a b.
Field field oldtag m (a -> b)
-> Field field oldtag m a -> Field field oldtag m b
forall a b c.
(a -> b -> c)
-> Field field oldtag m a
-> Field field oldtag m b
-> Field field oldtag m c
forall (field :: Symbol) k (oldtag :: k) (m :: * -> *).
Applicative m =>
Functor (Field field oldtag m)
forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a.
Applicative m =>
a -> Field field oldtag m a
forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Field field oldtag m a
-> Field field oldtag m b -> Field field oldtag m a
forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Field field oldtag m a
-> Field field oldtag m b -> Field field oldtag m b
forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Field field oldtag m (a -> b)
-> Field field oldtag m a -> Field field oldtag m b
forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> Field field oldtag m a
-> Field field oldtag m b
-> Field field oldtag m c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: Field field oldtag m a
-> Field field oldtag m b -> Field field oldtag m a
$c<* :: forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Field field oldtag m a
-> Field field oldtag m b -> Field field oldtag m a
*> :: Field field oldtag m a
-> Field field oldtag m b -> Field field oldtag m b
$c*> :: forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Field field oldtag m a
-> Field field oldtag m b -> Field field oldtag m b
liftA2 :: (a -> b -> c)
-> Field field oldtag m a
-> Field field oldtag m b
-> Field field oldtag m c
$cliftA2 :: forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> Field field oldtag m a
-> Field field oldtag m b
-> Field field oldtag m c
<*> :: Field field oldtag m (a -> b)
-> Field field oldtag m a -> Field field oldtag m b
$c<*> :: forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Field field oldtag m (a -> b)
-> Field field oldtag m a -> Field field oldtag m b
pure :: a -> Field field oldtag m a
$cpure :: forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a.
Applicative m =>
a -> Field field oldtag m a
$cp1Applicative :: forall (field :: Symbol) k (oldtag :: k) (m :: * -> *).
Applicative m =>
Functor (Field field oldtag m)
Applicative, Applicative (Field field oldtag m)
a -> Field field oldtag m a
Applicative (Field field oldtag m)
-> (forall a b.
    Field field oldtag m a
    -> (a -> Field field oldtag m b) -> Field field oldtag m b)
-> (forall a b.
    Field field oldtag m a
    -> Field field oldtag m b -> Field field oldtag m b)
-> (forall a. a -> Field field oldtag m a)
-> Monad (Field field oldtag m)
Field field oldtag m a
-> (a -> Field field oldtag m b) -> Field field oldtag m b
Field field oldtag m a
-> Field field oldtag m b -> Field field oldtag m b
forall a. a -> Field field oldtag m a
forall a b.
Field field oldtag m a
-> Field field oldtag m b -> Field field oldtag m b
forall a b.
Field field oldtag m a
-> (a -> Field field oldtag m b) -> Field field oldtag m b
forall (field :: Symbol) k (oldtag :: k) (m :: * -> *).
Monad m =>
Applicative (Field field oldtag m)
forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a.
Monad m =>
a -> Field field oldtag m a
forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Monad m =>
Field field oldtag m a
-> Field field oldtag m b -> Field field oldtag m b
forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Monad m =>
Field field oldtag m a
-> (a -> Field field oldtag m b) -> Field field oldtag m b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: a -> Field field oldtag m a
$creturn :: forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a.
Monad m =>
a -> Field field oldtag m a
>> :: Field field oldtag m a
-> Field field oldtag m b -> Field field oldtag m b
$c>> :: forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Monad m =>
Field field oldtag m a
-> Field field oldtag m b -> Field field oldtag m b
>>= :: Field field oldtag m a
-> (a -> Field field oldtag m b) -> Field field oldtag m b
$c>>= :: forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Monad m =>
Field field oldtag m a
-> (a -> Field field oldtag m b) -> Field field oldtag m b
$cp1Monad :: forall (field :: Symbol) k (oldtag :: k) (m :: * -> *).
Monad m =>
Applicative (Field field oldtag m)
Monad, Monad (Field field oldtag m)
Monad (Field field oldtag m)
-> (forall a. IO a -> Field field oldtag m a)
-> MonadIO (Field field oldtag m)
IO a -> Field field oldtag m a
forall a. IO a -> Field field oldtag m a
forall (field :: Symbol) k (oldtag :: k) (m :: * -> *).
MonadIO m =>
Monad (Field field oldtag m)
forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a.
MonadIO m =>
IO a -> Field field oldtag m a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
liftIO :: IO a -> Field field oldtag m a
$cliftIO :: forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a.
MonadIO m =>
IO a -> Field field oldtag m a
$cp1MonadIO :: forall (field :: Symbol) k (oldtag :: k) (m :: * -> *).
MonadIO m =>
Monad (Field field oldtag m)
MonadIO, Monad (Field field oldtag m)
Monad (Field field oldtag m)
-> (forall a.
    (State# (PrimState (Field field oldtag m))
     -> (# State# (PrimState (Field field oldtag m)), a #))
    -> Field field oldtag m a)
-> PrimMonad (Field field oldtag m)
(State# (PrimState (Field field oldtag m))
 -> (# State# (PrimState (Field field oldtag m)), a #))
-> Field field oldtag m a
forall a.
(State# (PrimState (Field field oldtag m))
 -> (# State# (PrimState (Field field oldtag m)), a #))
-> Field field oldtag m a
forall (field :: Symbol) k (oldtag :: k) (m :: * -> *).
PrimMonad m =>
Monad (Field field oldtag m)
forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a.
PrimMonad m =>
(State# (PrimState (Field field oldtag m))
 -> (# State# (PrimState (Field field oldtag m)), a #))
-> Field field oldtag m a
forall (m :: * -> *).
Monad m
-> (forall a.
    (State# (PrimState m) -> (# State# (PrimState m), a #)) -> m a)
-> PrimMonad m
primitive :: (State# (PrimState (Field field oldtag m))
 -> (# State# (PrimState (Field field oldtag m)), a #))
-> Field field oldtag m a
$cprimitive :: forall (field :: Symbol) k (oldtag :: k) (m :: * -> *) a.
PrimMonad m =>
(State# (PrimState (Field field oldtag m))
 -> (# State# (PrimState (Field field oldtag m)), a #))
-> Field field oldtag m a
$cp1PrimMonad :: forall (field :: Symbol) k (oldtag :: k) (m :: * -> *).
PrimMonad m =>
Monad (Field field oldtag m)
PrimMonad)

-- | Access the value at position @pos@ in the context @m@.
--
-- Example:
--
-- @
-- newtype MyReader a = MyReader (Reader (Int, Bool) a)
--   deriving (HasReader 1 Int) via
--     Pos 1 () (MonadReader (Reader (Int, Bool)))
-- @
--
-- Converts the @'Capability.Reader.HasReader' () (Int, Bool)@ instance of
-- @'Capability.Reader.MonadReader' (Reader (Int, Bool))@ to a
-- @'Capability.Reader.HasReader' 1 Int@ instance
-- by focusing on the first element of the tuple.
--
-- The implied number tag can be renamed to a more descriptive name using
-- the 'Rename' combinator:
--
-- @
-- newtype MyReader a = MyReader (Reader (Int, Bool) a)
--   deriving (HasReader "foo" Int) via
--     Rename 1 (Pos 1 () (MonadReader (Reader (Int, Bool))))
-- @
newtype Pos (pos :: Nat) (oldtag :: k) m (a :: Type) = Pos (m a)
  deriving (a -> Pos pos oldtag m b -> Pos pos oldtag m a
(a -> b) -> Pos pos oldtag m a -> Pos pos oldtag m b
(forall a b. (a -> b) -> Pos pos oldtag m a -> Pos pos oldtag m b)
-> (forall a b. a -> Pos pos oldtag m b -> Pos pos oldtag m a)
-> Functor (Pos pos oldtag m)
forall a b. a -> Pos pos oldtag m b -> Pos pos oldtag m a
forall a b. (a -> b) -> Pos pos oldtag m a -> Pos pos oldtag m b
forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a b.
Functor m =>
a -> Pos pos oldtag m b -> Pos pos oldtag m a
forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a b.
Functor m =>
(a -> b) -> Pos pos oldtag m a -> Pos pos oldtag m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Pos pos oldtag m b -> Pos pos oldtag m a
$c<$ :: forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a b.
Functor m =>
a -> Pos pos oldtag m b -> Pos pos oldtag m a
fmap :: (a -> b) -> Pos pos oldtag m a -> Pos pos oldtag m b
$cfmap :: forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a b.
Functor m =>
(a -> b) -> Pos pos oldtag m a -> Pos pos oldtag m b
Functor, Functor (Pos pos oldtag m)
a -> Pos pos oldtag m a
Functor (Pos pos oldtag m)
-> (forall a. a -> Pos pos oldtag m a)
-> (forall a b.
    Pos pos oldtag m (a -> b)
    -> Pos pos oldtag m a -> Pos pos oldtag m b)
-> (forall a b c.
    (a -> b -> c)
    -> Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m c)
-> (forall a b.
    Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m b)
-> (forall a b.
    Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m a)
-> Applicative (Pos pos oldtag m)
Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m b
Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m a
Pos pos oldtag m (a -> b)
-> Pos pos oldtag m a -> Pos pos oldtag m b
(a -> b -> c)
-> Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m c
forall a. a -> Pos pos oldtag m a
forall a b.
Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m a
forall a b.
Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m b
forall a b.
Pos pos oldtag m (a -> b)
-> Pos pos oldtag m a -> Pos pos oldtag m b
forall a b c.
(a -> b -> c)
-> Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m c
forall (pos :: Nat) k (oldtag :: k) (m :: * -> *).
Applicative m =>
Functor (Pos pos oldtag m)
forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a.
Applicative m =>
a -> Pos pos oldtag m a
forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m a
forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m b
forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Pos pos oldtag m (a -> b)
-> Pos pos oldtag m a -> Pos pos oldtag m b
forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m a
$c<* :: forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m a
*> :: Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m b
$c*> :: forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m b
liftA2 :: (a -> b -> c)
-> Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m c
$cliftA2 :: forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m c
<*> :: Pos pos oldtag m (a -> b)
-> Pos pos oldtag m a -> Pos pos oldtag m b
$c<*> :: forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Pos pos oldtag m (a -> b)
-> Pos pos oldtag m a -> Pos pos oldtag m b
pure :: a -> Pos pos oldtag m a
$cpure :: forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a.
Applicative m =>
a -> Pos pos oldtag m a
$cp1Applicative :: forall (pos :: Nat) k (oldtag :: k) (m :: * -> *).
Applicative m =>
Functor (Pos pos oldtag m)
Applicative, Applicative (Pos pos oldtag m)
a -> Pos pos oldtag m a
Applicative (Pos pos oldtag m)
-> (forall a b.
    Pos pos oldtag m a
    -> (a -> Pos pos oldtag m b) -> Pos pos oldtag m b)
-> (forall a b.
    Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m b)
-> (forall a. a -> Pos pos oldtag m a)
-> Monad (Pos pos oldtag m)
Pos pos oldtag m a
-> (a -> Pos pos oldtag m b) -> Pos pos oldtag m b
Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m b
forall a. a -> Pos pos oldtag m a
forall a b.
Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m b
forall a b.
Pos pos oldtag m a
-> (a -> Pos pos oldtag m b) -> Pos pos oldtag m b
forall (pos :: Nat) k (oldtag :: k) (m :: * -> *).
Monad m =>
Applicative (Pos pos oldtag m)
forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a.
Monad m =>
a -> Pos pos oldtag m a
forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a b.
Monad m =>
Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m b
forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a b.
Monad m =>
Pos pos oldtag m a
-> (a -> Pos pos oldtag m b) -> Pos pos oldtag m b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: a -> Pos pos oldtag m a
$creturn :: forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a.
Monad m =>
a -> Pos pos oldtag m a
>> :: Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m b
$c>> :: forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a b.
Monad m =>
Pos pos oldtag m a -> Pos pos oldtag m b -> Pos pos oldtag m b
>>= :: Pos pos oldtag m a
-> (a -> Pos pos oldtag m b) -> Pos pos oldtag m b
$c>>= :: forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a b.
Monad m =>
Pos pos oldtag m a
-> (a -> Pos pos oldtag m b) -> Pos pos oldtag m b
$cp1Monad :: forall (pos :: Nat) k (oldtag :: k) (m :: * -> *).
Monad m =>
Applicative (Pos pos oldtag m)
Monad, Monad (Pos pos oldtag m)
Monad (Pos pos oldtag m)
-> (forall a. IO a -> Pos pos oldtag m a)
-> MonadIO (Pos pos oldtag m)
IO a -> Pos pos oldtag m a
forall a. IO a -> Pos pos oldtag m a
forall (pos :: Nat) k (oldtag :: k) (m :: * -> *).
MonadIO m =>
Monad (Pos pos oldtag m)
forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a.
MonadIO m =>
IO a -> Pos pos oldtag m a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
liftIO :: IO a -> Pos pos oldtag m a
$cliftIO :: forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a.
MonadIO m =>
IO a -> Pos pos oldtag m a
$cp1MonadIO :: forall (pos :: Nat) k (oldtag :: k) (m :: * -> *).
MonadIO m =>
Monad (Pos pos oldtag m)
MonadIO, Monad (Pos pos oldtag m)
Monad (Pos pos oldtag m)
-> (forall a.
    (State# (PrimState (Pos pos oldtag m))
     -> (# State# (PrimState (Pos pos oldtag m)), a #))
    -> Pos pos oldtag m a)
-> PrimMonad (Pos pos oldtag m)
(State# (PrimState (Pos pos oldtag m))
 -> (# State# (PrimState (Pos pos oldtag m)), a #))
-> Pos pos oldtag m a
forall a.
(State# (PrimState (Pos pos oldtag m))
 -> (# State# (PrimState (Pos pos oldtag m)), a #))
-> Pos pos oldtag m a
forall (pos :: Nat) k (oldtag :: k) (m :: * -> *).
PrimMonad m =>
Monad (Pos pos oldtag m)
forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a.
PrimMonad m =>
(State# (PrimState (Pos pos oldtag m))
 -> (# State# (PrimState (Pos pos oldtag m)), a #))
-> Pos pos oldtag m a
forall (m :: * -> *).
Monad m
-> (forall a.
    (State# (PrimState m) -> (# State# (PrimState m), a #)) -> m a)
-> PrimMonad m
primitive :: (State# (PrimState (Pos pos oldtag m))
 -> (# State# (PrimState (Pos pos oldtag m)), a #))
-> Pos pos oldtag m a
$cprimitive :: forall (pos :: Nat) k (oldtag :: k) (m :: * -> *) a.
PrimMonad m =>
(State# (PrimState (Pos pos oldtag m))
 -> (# State# (PrimState (Pos pos oldtag m)), a #))
-> Pos pos oldtag m a
$cp1PrimMonad :: forall (pos :: Nat) k (oldtag :: k) (m :: * -> *).
PrimMonad m =>
Monad (Pos pos oldtag m)
PrimMonad)

-- | Choose the given constructor in the sum-type in context @m@.
--
-- Example:
--
-- @
-- data MyError = ErrA String | ErrB String
-- newtype MyExcept a = MyExcept (ExceptT MyError Identity a)
--   deriving (HasThrow \"ErrB" String) via
--     Ctor \"ErrB" () (MonadError (ExceptT MyError Identity))
-- @
--
-- Converts the @'Capability.Error.HasThrow' () \"MyError\"@ instance of
-- @'Capability.Error.MonadError' (ExceptT MyError Identity)@ to a
-- @'Capability.Error.HasThrow' \"ErrB\" String@
-- instance by wrapping thrown @String@s in the @ErrB@ constructor.
newtype Ctor (ctor :: Symbol) (oldtag :: k) m (a :: Type) = Ctor (m a)
  deriving (a -> Ctor ctor oldtag m b -> Ctor ctor oldtag m a
(a -> b) -> Ctor ctor oldtag m a -> Ctor ctor oldtag m b
(forall a b.
 (a -> b) -> Ctor ctor oldtag m a -> Ctor ctor oldtag m b)
-> (forall a b. a -> Ctor ctor oldtag m b -> Ctor ctor oldtag m a)
-> Functor (Ctor ctor oldtag m)
forall a b. a -> Ctor ctor oldtag m b -> Ctor ctor oldtag m a
forall a b.
(a -> b) -> Ctor ctor oldtag m a -> Ctor ctor oldtag m b
forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Functor m =>
a -> Ctor ctor oldtag m b -> Ctor ctor oldtag m a
forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Functor m =>
(a -> b) -> Ctor ctor oldtag m a -> Ctor ctor oldtag m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Ctor ctor oldtag m b -> Ctor ctor oldtag m a
$c<$ :: forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Functor m =>
a -> Ctor ctor oldtag m b -> Ctor ctor oldtag m a
fmap :: (a -> b) -> Ctor ctor oldtag m a -> Ctor ctor oldtag m b
$cfmap :: forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Functor m =>
(a -> b) -> Ctor ctor oldtag m a -> Ctor ctor oldtag m b
Functor, Functor (Ctor ctor oldtag m)
a -> Ctor ctor oldtag m a
Functor (Ctor ctor oldtag m)
-> (forall a. a -> Ctor ctor oldtag m a)
-> (forall a b.
    Ctor ctor oldtag m (a -> b)
    -> Ctor ctor oldtag m a -> Ctor ctor oldtag m b)
-> (forall a b c.
    (a -> b -> c)
    -> Ctor ctor oldtag m a
    -> Ctor ctor oldtag m b
    -> Ctor ctor oldtag m c)
-> (forall a b.
    Ctor ctor oldtag m a
    -> Ctor ctor oldtag m b -> Ctor ctor oldtag m b)
-> (forall a b.
    Ctor ctor oldtag m a
    -> Ctor ctor oldtag m b -> Ctor ctor oldtag m a)
-> Applicative (Ctor ctor oldtag m)
Ctor ctor oldtag m a
-> Ctor ctor oldtag m b -> Ctor ctor oldtag m b
Ctor ctor oldtag m a
-> Ctor ctor oldtag m b -> Ctor ctor oldtag m a
Ctor ctor oldtag m (a -> b)
-> Ctor ctor oldtag m a -> Ctor ctor oldtag m b
(a -> b -> c)
-> Ctor ctor oldtag m a
-> Ctor ctor oldtag m b
-> Ctor ctor oldtag m c
forall a. a -> Ctor ctor oldtag m a
forall a b.
Ctor ctor oldtag m a
-> Ctor ctor oldtag m b -> Ctor ctor oldtag m a
forall a b.
Ctor ctor oldtag m a
-> Ctor ctor oldtag m b -> Ctor ctor oldtag m b
forall a b.
Ctor ctor oldtag m (a -> b)
-> Ctor ctor oldtag m a -> Ctor ctor oldtag m b
forall a b c.
(a -> b -> c)
-> Ctor ctor oldtag m a
-> Ctor ctor oldtag m b
-> Ctor ctor oldtag m c
forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *).
Applicative m =>
Functor (Ctor ctor oldtag m)
forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a.
Applicative m =>
a -> Ctor ctor oldtag m a
forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Ctor ctor oldtag m a
-> Ctor ctor oldtag m b -> Ctor ctor oldtag m a
forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Ctor ctor oldtag m a
-> Ctor ctor oldtag m b -> Ctor ctor oldtag m b
forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Ctor ctor oldtag m (a -> b)
-> Ctor ctor oldtag m a -> Ctor ctor oldtag m b
forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> Ctor ctor oldtag m a
-> Ctor ctor oldtag m b
-> Ctor ctor oldtag m c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: Ctor ctor oldtag m a
-> Ctor ctor oldtag m b -> Ctor ctor oldtag m a
$c<* :: forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Ctor ctor oldtag m a
-> Ctor ctor oldtag m b -> Ctor ctor oldtag m a
*> :: Ctor ctor oldtag m a
-> Ctor ctor oldtag m b -> Ctor ctor oldtag m b
$c*> :: forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Ctor ctor oldtag m a
-> Ctor ctor oldtag m b -> Ctor ctor oldtag m b
liftA2 :: (a -> b -> c)
-> Ctor ctor oldtag m a
-> Ctor ctor oldtag m b
-> Ctor ctor oldtag m c
$cliftA2 :: forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> Ctor ctor oldtag m a
-> Ctor ctor oldtag m b
-> Ctor ctor oldtag m c
<*> :: Ctor ctor oldtag m (a -> b)
-> Ctor ctor oldtag m a -> Ctor ctor oldtag m b
$c<*> :: forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Applicative m =>
Ctor ctor oldtag m (a -> b)
-> Ctor ctor oldtag m a -> Ctor ctor oldtag m b
pure :: a -> Ctor ctor oldtag m a
$cpure :: forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a.
Applicative m =>
a -> Ctor ctor oldtag m a
$cp1Applicative :: forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *).
Applicative m =>
Functor (Ctor ctor oldtag m)
Applicative, Applicative (Ctor ctor oldtag m)
a -> Ctor ctor oldtag m a
Applicative (Ctor ctor oldtag m)
-> (forall a b.
    Ctor ctor oldtag m a
    -> (a -> Ctor ctor oldtag m b) -> Ctor ctor oldtag m b)
-> (forall a b.
    Ctor ctor oldtag m a
    -> Ctor ctor oldtag m b -> Ctor ctor oldtag m b)
-> (forall a. a -> Ctor ctor oldtag m a)
-> Monad (Ctor ctor oldtag m)
Ctor ctor oldtag m a
-> (a -> Ctor ctor oldtag m b) -> Ctor ctor oldtag m b
Ctor ctor oldtag m a
-> Ctor ctor oldtag m b -> Ctor ctor oldtag m b
forall a. a -> Ctor ctor oldtag m a
forall a b.
Ctor ctor oldtag m a
-> Ctor ctor oldtag m b -> Ctor ctor oldtag m b
forall a b.
Ctor ctor oldtag m a
-> (a -> Ctor ctor oldtag m b) -> Ctor ctor oldtag m b
forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *).
Monad m =>
Applicative (Ctor ctor oldtag m)
forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a.
Monad m =>
a -> Ctor ctor oldtag m a
forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Monad m =>
Ctor ctor oldtag m a
-> Ctor ctor oldtag m b -> Ctor ctor oldtag m b
forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Monad m =>
Ctor ctor oldtag m a
-> (a -> Ctor ctor oldtag m b) -> Ctor ctor oldtag m b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: a -> Ctor ctor oldtag m a
$creturn :: forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a.
Monad m =>
a -> Ctor ctor oldtag m a
>> :: Ctor ctor oldtag m a
-> Ctor ctor oldtag m b -> Ctor ctor oldtag m b
$c>> :: forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Monad m =>
Ctor ctor oldtag m a
-> Ctor ctor oldtag m b -> Ctor ctor oldtag m b
>>= :: Ctor ctor oldtag m a
-> (a -> Ctor ctor oldtag m b) -> Ctor ctor oldtag m b
$c>>= :: forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a b.
Monad m =>
Ctor ctor oldtag m a
-> (a -> Ctor ctor oldtag m b) -> Ctor ctor oldtag m b
$cp1Monad :: forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *).
Monad m =>
Applicative (Ctor ctor oldtag m)
Monad, Monad (Ctor ctor oldtag m)
Monad (Ctor ctor oldtag m)
-> (forall a. IO a -> Ctor ctor oldtag m a)
-> MonadIO (Ctor ctor oldtag m)
IO a -> Ctor ctor oldtag m a
forall a. IO a -> Ctor ctor oldtag m a
forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *).
MonadIO m =>
Monad (Ctor ctor oldtag m)
forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a.
MonadIO m =>
IO a -> Ctor ctor oldtag m a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
liftIO :: IO a -> Ctor ctor oldtag m a
$cliftIO :: forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a.
MonadIO m =>
IO a -> Ctor ctor oldtag m a
$cp1MonadIO :: forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *).
MonadIO m =>
Monad (Ctor ctor oldtag m)
MonadIO, Monad (Ctor ctor oldtag m)
Monad (Ctor ctor oldtag m)
-> (forall a.
    (State# (PrimState (Ctor ctor oldtag m))
     -> (# State# (PrimState (Ctor ctor oldtag m)), a #))
    -> Ctor ctor oldtag m a)
-> PrimMonad (Ctor ctor oldtag m)
(State# (PrimState (Ctor ctor oldtag m))
 -> (# State# (PrimState (Ctor ctor oldtag m)), a #))
-> Ctor ctor oldtag m a
forall a.
(State# (PrimState (Ctor ctor oldtag m))
 -> (# State# (PrimState (Ctor ctor oldtag m)), a #))
-> Ctor ctor oldtag m a
forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *).
PrimMonad m =>
Monad (Ctor ctor oldtag m)
forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a.
PrimMonad m =>
(State# (PrimState (Ctor ctor oldtag m))
 -> (# State# (PrimState (Ctor ctor oldtag m)), a #))
-> Ctor ctor oldtag m a
forall (m :: * -> *).
Monad m
-> (forall a.
    (State# (PrimState m) -> (# State# (PrimState m), a #)) -> m a)
-> PrimMonad m
primitive :: (State# (PrimState (Ctor ctor oldtag m))
 -> (# State# (PrimState (Ctor ctor oldtag m)), a #))
-> Ctor ctor oldtag m a
$cprimitive :: forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *) a.
PrimMonad m =>
(State# (PrimState (Ctor ctor oldtag m))
 -> (# State# (PrimState (Ctor ctor oldtag m)), a #))
-> Ctor ctor oldtag m a
$cp1PrimMonad :: forall (ctor :: Symbol) k (oldtag :: k) (m :: * -> *).
PrimMonad m =>
Monad (Ctor ctor oldtag m)
PrimMonad)

-- | Skip one level in a monad transformer stack.
--
-- Note, that instances generated with this strategy can incur a performance
-- penalty.
--
-- Example:
--
-- @
-- newtype MyStates a = MyStates (StateT Int (State Bool) a)
--   deriving (HasState "foo" Bool) via
--     Lift (StateT Int (MonadState (State Bool)))
-- @
--
-- Uses the 'Control.Monad.Trans.Class.MonadTrans' instance of
-- @StateT Int@ to lift
-- the @'Capability.State.HasState' "\foo\" Bool@ instance of the underlying
-- @'Capability.State.MonadState' (State Bool)@ over the
-- @StateT Int@ monad transformer.
newtype Lift m (a :: Type) = Lift (m a)
  deriving (a -> Lift m b -> Lift m a
(a -> b) -> Lift m a -> Lift m b
(forall a b. (a -> b) -> Lift m a -> Lift m b)
-> (forall a b. a -> Lift m b -> Lift m a) -> Functor (Lift m)
forall a b. a -> Lift m b -> Lift m a
forall a b. (a -> b) -> Lift m a -> Lift m b
forall (m :: * -> *) a b. Functor m => a -> Lift m b -> Lift m a
forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> Lift m a -> Lift m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Lift m b -> Lift m a
$c<$ :: forall (m :: * -> *) a b. Functor m => a -> Lift m b -> Lift m a
fmap :: (a -> b) -> Lift m a -> Lift m b
$cfmap :: forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> Lift m a -> Lift m b
Functor, Functor (Lift m)
a -> Lift m a
Functor (Lift m)
-> (forall a. a -> Lift m a)
-> (forall a b. Lift m (a -> b) -> Lift m a -> Lift m b)
-> (forall a b c.
    (a -> b -> c) -> Lift m a -> Lift m b -> Lift m c)
-> (forall a b. Lift m a -> Lift m b -> Lift m b)
-> (forall a b. Lift m a -> Lift m b -> Lift m a)
-> Applicative (Lift m)
Lift m a -> Lift m b -> Lift m b
Lift m a -> Lift m b -> Lift m a
Lift m (a -> b) -> Lift m a -> Lift m b
(a -> b -> c) -> Lift m a -> Lift m b -> Lift m c
forall a. a -> Lift m a
forall a b. Lift m a -> Lift m b -> Lift m a
forall a b. Lift m a -> Lift m b -> Lift m b
forall a b. Lift m (a -> b) -> Lift m a -> Lift m b
forall a b c. (a -> b -> c) -> Lift m a -> Lift m b -> Lift m c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
forall (m :: * -> *). Applicative m => Functor (Lift m)
forall (m :: * -> *) a. Applicative m => a -> Lift m a
forall (m :: * -> *) a b.
Applicative m =>
Lift m a -> Lift m b -> Lift m a
forall (m :: * -> *) a b.
Applicative m =>
Lift m a -> Lift m b -> Lift m b
forall (m :: * -> *) a b.
Applicative m =>
Lift m (a -> b) -> Lift m a -> Lift m b
forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c) -> Lift m a -> Lift m b -> Lift m c
<* :: Lift m a -> Lift m b -> Lift m a
$c<* :: forall (m :: * -> *) a b.
Applicative m =>
Lift m a -> Lift m b -> Lift m a
*> :: Lift m a -> Lift m b -> Lift m b
$c*> :: forall (m :: * -> *) a b.
Applicative m =>
Lift m a -> Lift m b -> Lift m b
liftA2 :: (a -> b -> c) -> Lift m a -> Lift m b -> Lift m c
$cliftA2 :: forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c) -> Lift m a -> Lift m b -> Lift m c
<*> :: Lift m (a -> b) -> Lift m a -> Lift m b
$c<*> :: forall (m :: * -> *) a b.
Applicative m =>
Lift m (a -> b) -> Lift m a -> Lift m b
pure :: a -> Lift m a
$cpure :: forall (m :: * -> *) a. Applicative m => a -> Lift m a
$cp1Applicative :: forall (m :: * -> *). Applicative m => Functor (Lift m)
Applicative, Applicative (Lift m)
a -> Lift m a
Applicative (Lift m)
-> (forall a b. Lift m a -> (a -> Lift m b) -> Lift m b)
-> (forall a b. Lift m a -> Lift m b -> Lift m b)
-> (forall a. a -> Lift m a)
-> Monad (Lift m)
Lift m a -> (a -> Lift m b) -> Lift m b
Lift m a -> Lift m b -> Lift m b
forall a. a -> Lift m a
forall a b. Lift m a -> Lift m b -> Lift m b
forall a b. Lift m a -> (a -> Lift m b) -> Lift m b
forall (m :: * -> *). Monad m => Applicative (Lift m)
forall (m :: * -> *) a. Monad m => a -> Lift m a
forall (m :: * -> *) a b.
Monad m =>
Lift m a -> Lift m b -> Lift m b
forall (m :: * -> *) a b.
Monad m =>
Lift m a -> (a -> Lift m b) -> Lift m b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: a -> Lift m a
$creturn :: forall (m :: * -> *) a. Monad m => a -> Lift m a
>> :: Lift m a -> Lift m b -> Lift m b
$c>> :: forall (m :: * -> *) a b.
Monad m =>
Lift m a -> Lift m b -> Lift m b
>>= :: Lift m a -> (a -> Lift m b) -> Lift m b
$c>>= :: forall (m :: * -> *) a b.
Monad m =>
Lift m a -> (a -> Lift m b) -> Lift m b
$cp1Monad :: forall (m :: * -> *). Monad m => Applicative (Lift m)
Monad, Monad (Lift m)
Monad (Lift m) -> (forall a. IO a -> Lift m a) -> MonadIO (Lift m)
IO a -> Lift m a
forall a. IO a -> Lift m a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
forall (m :: * -> *). MonadIO m => Monad (Lift m)
forall (m :: * -> *) a. MonadIO m => IO a -> Lift m a
liftIO :: IO a -> Lift m a
$cliftIO :: forall (m :: * -> *) a. MonadIO m => IO a -> Lift m a
$cp1MonadIO :: forall (m :: * -> *). MonadIO m => Monad (Lift m)
MonadIO, Monad (Lift m)
Monad (Lift m)
-> (forall a.
    (State# (PrimState (Lift m))
     -> (# State# (PrimState (Lift m)), a #))
    -> Lift m a)
-> PrimMonad (Lift m)
(State# (PrimState (Lift m))
 -> (# State# (PrimState (Lift m)), a #))
-> Lift m a
forall a.
(State# (PrimState (Lift m))
 -> (# State# (PrimState (Lift m)), a #))
-> Lift m a
forall (m :: * -> *).
Monad m
-> (forall a.
    (State# (PrimState m) -> (# State# (PrimState m), a #)) -> m a)
-> PrimMonad m
forall (m :: * -> *). PrimMonad m => Monad (Lift m)
forall (m :: * -> *) a.
PrimMonad m =>
(State# (PrimState (Lift m))
 -> (# State# (PrimState (Lift m)), a #))
-> Lift m a
primitive :: (State# (PrimState (Lift m))
 -> (# State# (PrimState (Lift m)), a #))
-> Lift m a
$cprimitive :: forall (m :: * -> *) a.
PrimMonad m =>
(State# (PrimState (Lift m))
 -> (# State# (PrimState (Lift m)), a #))
-> Lift m a
$cp1PrimMonad :: forall (m :: * -> *). PrimMonad m => Monad (Lift m)
PrimMonad)


-- | Compose two accessors.
--
-- This is not necessary in deriving via clauses, but in places where a
-- transformer is expected as a type argument. E.g. 'HasError.wrapError'.
newtype (:.:)
  (t2 :: (Type -> Type) -> Type -> Type)
  (t1 :: (Type -> Type) -> Type -> Type)
  (m :: Type -> Type)
  (a :: Type)
  = (:.:) (m a)
  deriving (a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m a
(a -> b) -> (:.:) t2 t1 m a -> (:.:) t2 t1 m b
(forall a b. (a -> b) -> (:.:) t2 t1 m a -> (:.:) t2 t1 m b)
-> (forall a b. a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m a)
-> Functor ((:.:) t2 t1 m)
forall a b. a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m a
forall a b. (a -> b) -> (:.:) t2 t1 m a -> (:.:) t2 t1 m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
Functor m =>
a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m a
forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
Functor m =>
(a -> b) -> (:.:) t2 t1 m a -> (:.:) t2 t1 m b
<$ :: a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m a
$c<$ :: forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
Functor m =>
a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m a
fmap :: (a -> b) -> (:.:) t2 t1 m a -> (:.:) t2 t1 m b
$cfmap :: forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
Functor m =>
(a -> b) -> (:.:) t2 t1 m a -> (:.:) t2 t1 m b
Functor, Functor ((:.:) t2 t1 m)
a -> (:.:) t2 t1 m a
Functor ((:.:) t2 t1 m)
-> (forall a. a -> (:.:) t2 t1 m a)
-> (forall a b.
    (:.:) t2 t1 m (a -> b) -> (:.:) t2 t1 m a -> (:.:) t2 t1 m b)
-> (forall a b c.
    (a -> b -> c)
    -> (:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m c)
-> (forall a b.
    (:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m b)
-> (forall a b.
    (:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m a)
-> Applicative ((:.:) t2 t1 m)
(:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m b
(:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m a
(:.:) t2 t1 m (a -> b) -> (:.:) t2 t1 m a -> (:.:) t2 t1 m b
(a -> b -> c)
-> (:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m c
forall a. a -> (:.:) t2 t1 m a
forall a b. (:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m a
forall a b. (:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m b
forall a b.
(:.:) t2 t1 m (a -> b) -> (:.:) t2 t1 m a -> (:.:) t2 t1 m b
forall a b c.
(a -> b -> c)
-> (:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *).
Applicative m =>
Functor ((:.:) t2 t1 m)
forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a.
Applicative m =>
a -> (:.:) t2 t1 m a
forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
Applicative m =>
(:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m a
forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
Applicative m =>
(:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m b
forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
Applicative m =>
(:.:) t2 t1 m (a -> b) -> (:.:) t2 t1 m a -> (:.:) t2 t1 m b
forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> (:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m c
<* :: (:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m a
$c<* :: forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
Applicative m =>
(:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m a
*> :: (:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m b
$c*> :: forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
Applicative m =>
(:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m b
liftA2 :: (a -> b -> c)
-> (:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m c
$cliftA2 :: forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> (:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m c
<*> :: (:.:) t2 t1 m (a -> b) -> (:.:) t2 t1 m a -> (:.:) t2 t1 m b
$c<*> :: forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
Applicative m =>
(:.:) t2 t1 m (a -> b) -> (:.:) t2 t1 m a -> (:.:) t2 t1 m b
pure :: a -> (:.:) t2 t1 m a
$cpure :: forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a.
Applicative m =>
a -> (:.:) t2 t1 m a
$cp1Applicative :: forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *).
Applicative m =>
Functor ((:.:) t2 t1 m)
Applicative, Applicative ((:.:) t2 t1 m)
a -> (:.:) t2 t1 m a
Applicative ((:.:) t2 t1 m)
-> (forall a b.
    (:.:) t2 t1 m a -> (a -> (:.:) t2 t1 m b) -> (:.:) t2 t1 m b)
-> (forall a b.
    (:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m b)
-> (forall a. a -> (:.:) t2 t1 m a)
-> Monad ((:.:) t2 t1 m)
(:.:) t2 t1 m a -> (a -> (:.:) t2 t1 m b) -> (:.:) t2 t1 m b
(:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m b
forall a. a -> (:.:) t2 t1 m a
forall a b. (:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m b
forall a b.
(:.:) t2 t1 m a -> (a -> (:.:) t2 t1 m b) -> (:.:) t2 t1 m b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *).
Monad m =>
Applicative ((:.:) t2 t1 m)
forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a.
Monad m =>
a -> (:.:) t2 t1 m a
forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
Monad m =>
(:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m b
forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
Monad m =>
(:.:) t2 t1 m a -> (a -> (:.:) t2 t1 m b) -> (:.:) t2 t1 m b
return :: a -> (:.:) t2 t1 m a
$creturn :: forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a.
Monad m =>
a -> (:.:) t2 t1 m a
>> :: (:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m b
$c>> :: forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
Monad m =>
(:.:) t2 t1 m a -> (:.:) t2 t1 m b -> (:.:) t2 t1 m b
>>= :: (:.:) t2 t1 m a -> (a -> (:.:) t2 t1 m b) -> (:.:) t2 t1 m b
$c>>= :: forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a b.
Monad m =>
(:.:) t2 t1 m a -> (a -> (:.:) t2 t1 m b) -> (:.:) t2 t1 m b
$cp1Monad :: forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *).
Monad m =>
Applicative ((:.:) t2 t1 m)
Monad, Monad ((:.:) t2 t1 m)
Monad ((:.:) t2 t1 m)
-> (forall a. IO a -> (:.:) t2 t1 m a) -> MonadIO ((:.:) t2 t1 m)
IO a -> (:.:) t2 t1 m a
forall a. IO a -> (:.:) t2 t1 m a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *).
MonadIO m =>
Monad ((:.:) t2 t1 m)
forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a.
MonadIO m =>
IO a -> (:.:) t2 t1 m a
liftIO :: IO a -> (:.:) t2 t1 m a
$cliftIO :: forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a.
MonadIO m =>
IO a -> (:.:) t2 t1 m a
$cp1MonadIO :: forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *).
MonadIO m =>
Monad ((:.:) t2 t1 m)
MonadIO, Monad ((:.:) t2 t1 m)
Monad ((:.:) t2 t1 m)
-> (forall a.
    (State# (PrimState ((:.:) t2 t1 m))
     -> (# State# (PrimState ((:.:) t2 t1 m)), a #))
    -> (:.:) t2 t1 m a)
-> PrimMonad ((:.:) t2 t1 m)
(State# (PrimState ((:.:) t2 t1 m))
 -> (# State# (PrimState ((:.:) t2 t1 m)), a #))
-> (:.:) t2 t1 m a
forall a.
(State# (PrimState ((:.:) t2 t1 m))
 -> (# State# (PrimState ((:.:) t2 t1 m)), a #))
-> (:.:) t2 t1 m a
forall (m :: * -> *).
Monad m
-> (forall a.
    (State# (PrimState m) -> (# State# (PrimState m), a #)) -> m a)
-> PrimMonad m
forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *).
PrimMonad m =>
Monad ((:.:) t2 t1 m)
forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a.
PrimMonad m =>
(State# (PrimState ((:.:) t2 t1 m))
 -> (# State# (PrimState ((:.:) t2 t1 m)), a #))
-> (:.:) t2 t1 m a
primitive :: (State# (PrimState ((:.:) t2 t1 m))
 -> (# State# (PrimState ((:.:) t2 t1 m)), a #))
-> (:.:) t2 t1 m a
$cprimitive :: forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *) a.
PrimMonad m =>
(State# (PrimState ((:.:) t2 t1 m))
 -> (# State# (PrimState ((:.:) t2 t1 m)), a #))
-> (:.:) t2 t1 m a
$cp1PrimMonad :: forall (t2 :: (* -> *) -> * -> *) (t1 :: (* -> *) -> * -> *)
       (m :: * -> *).
PrimMonad m =>
Monad ((:.:) t2 t1 m)
PrimMonad)
infixr 9 :.: