{-# LANGUAGE QuantifiedConstraints #-}

-- This Source Code Form is subject to the terms of the Mozilla Public
-- License, v. 2.0. If a copy of the MPL was not distributed with this
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.

{- |
Copyright   :  (c) 2023 Yamada Ryo
License     :  MPL-2.0 (see the file LICENSE)
Maintainer  :  ymdfield@outlook.jp
Stability   :  experimental
Portability :  portable

A type class to abstract away the encoding details of the Freer monad transformers.
-}
module Control.Monad.Trans.Freer where

import Control.Effect.Class (Instruction, type (~>))
import Control.Freer.Trans (TransFreer, hoistFreer, interpretFT, liftLowerFT)
import Control.Monad.Cont (ContT)
import Control.Monad.Trans (MonadTrans, lift)
import Data.Coerce (Coercible, coerce)
import Data.Kind (Type)

-- | A type class to abstract away the encoding details of the Freer monad transformers.
class
    (TransFreer Monad fr, forall ins. MonadTrans (fr ins)) =>
    MonadTransFreer fr
    where
    interpretMK :: Monad m => (ins ~> ContT r m) -> fr ins m ~> ContT r m
    interpretMK = forall (fr :: (* -> *) -> (* -> *) -> * -> *) (m :: * -> *)
       (t :: (* -> *) -> * -> *) (ins :: * -> *).
(MonadTransFreer fr, Monad m, MonadTrans t, Monad (t m)) =>
(ins ~> t m) -> fr ins m ~> t m
interpretMT
    {-# INLINE interpretMK #-}

    reinterpretMK :: Monad m => (ins ~> ContT r (fr ins m)) -> fr ins m ~> ContT r (fr ins m)
    reinterpretMK = forall (fr :: (* -> *) -> (* -> *) -> * -> *) (m :: * -> *)
       (t :: (* -> *) -> * -> *) (n :: * -> *) (ins :: * -> *).
(MonadTransFreer fr, Monad m, MonadTrans t, Coercible n (fr ins m),
 Monad (t n), Monad n) =>
(ins ~> t n) -> fr ins m ~> t n
reinterpretMT
    {-# INLINE reinterpretMK #-}

    interpretMT :: (Monad m, MonadTrans t, Monad (t m)) => (ins ~> t m) -> fr ins m ~> t m
    interpretMT = forall {k} (c :: (k -> *) -> Constraint)
       (fr :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *) (g :: k -> *)
       (ins :: k -> *).
(TransFreer c fr, c f, c g) =>
(f ~> g) -> (ins ~> g) -> fr ins f ~> g
interpretFT forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift
    {-# INLINE interpretMT #-}

    reinterpretMT ::
        forall m t n ins.
        (Monad m, MonadTrans t, Coercible n (fr ins m), Monad (t n), Monad n) =>
        (ins ~> t n) ->
        fr ins m ~> t n
    reinterpretMT ins ~> t n
f = forall (fr :: (* -> *) -> (* -> *) -> * -> *) (m :: * -> *)
       (t :: (* -> *) -> * -> *) (ins :: * -> *).
(MonadTransFreer fr, Monad m, MonadTrans t, Monad (t m)) =>
(ins ~> t m) -> fr ins m ~> t m
interpretMT ins ~> t n
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (c :: (k -> *) -> Constraint)
       (fr :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *) (g :: k -> *)
       (ins :: k -> *).
(TransFreer c fr, c f, c g) =>
(f ~> g) -> fr ins f ~> fr ins g
hoistFreer (coerce :: forall a b. Coercible a b => a -> b
coerce forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (c :: (k -> *) -> Constraint)
       (fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
       (f :: k -> *).
(TransFreer c fr, c f) =>
f ~> fr ins f
liftLowerFT @Monad @fr @ins)
    {-# INLINE reinterpretMT #-}

reinterpretTTViaFinal ::
    forall fr m t n ins.
    ( MonadTransFreer fr
    , Monad m
    , MonadTrans t
    , Coercible n (fr ins m)
    , Monad (t n)
    , Monad n
    ) =>
    (ins ~> t n) ->
    fr ins m ~> t n
reinterpretTTViaFinal :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (m :: * -> *)
       (t :: (* -> *) -> * -> *) (n :: * -> *) (ins :: * -> *).
(MonadTransFreer fr, Monad m, MonadTrans t, Coercible n (fr ins m),
 Monad (t n), Monad n) =>
(ins ~> t n) -> fr ins m ~> t n
reinterpretTTViaFinal = forall {k} (c :: (k -> *) -> Constraint)
       (fr :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *) (g :: k -> *)
       (ins :: k -> *).
(TransFreer c fr, c f, c g) =>
(f ~> g) -> (ins ~> g) -> fr ins f ~> g
interpretFT forall a b. (a -> b) -> a -> b
$ forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. coerce :: forall a b. Coercible a b => a -> b
coerce forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (c :: (k -> *) -> Constraint)
       (fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
       (f :: k -> *).
(TransFreer c fr, c f) =>
f ~> fr ins f
liftLowerFT @Monad @fr @ins
{-# INLINE reinterpretTTViaFinal #-}

newtype ViaLiftLower (fr :: Instruction -> (Type -> Type) -> Type -> Type) ins m a = ViaLiftLower
    {forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
ViaLiftLower fr ins m a -> fr ins m a
runViaLiftLower :: fr ins m a}
    deriving newtype (forall a b. a -> ViaLiftLower fr ins m b -> ViaLiftLower fr ins m a
forall a b.
(a -> b) -> ViaLiftLower fr ins m a -> ViaLiftLower fr ins m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a b.
Functor (fr ins m) =>
a -> ViaLiftLower fr ins m b -> ViaLiftLower fr ins m a
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a b.
Functor (fr ins m) =>
(a -> b) -> ViaLiftLower fr ins m a -> ViaLiftLower fr ins m b
<$ :: forall a b. a -> ViaLiftLower fr ins m b -> ViaLiftLower fr ins m a
$c<$ :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a b.
Functor (fr ins m) =>
a -> ViaLiftLower fr ins m b -> ViaLiftLower fr ins m a
fmap :: forall a b.
(a -> b) -> ViaLiftLower fr ins m a -> ViaLiftLower fr ins m b
$cfmap :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a b.
Functor (fr ins m) =>
(a -> b) -> ViaLiftLower fr ins m a -> ViaLiftLower fr ins m b
Functor, forall a. a -> ViaLiftLower fr ins m a
forall a b.
ViaLiftLower fr ins m a
-> ViaLiftLower fr ins m b -> ViaLiftLower fr ins m a
forall a b.
ViaLiftLower fr ins m a
-> ViaLiftLower fr ins m b -> ViaLiftLower fr ins m b
forall a b.
ViaLiftLower fr ins m (a -> b)
-> ViaLiftLower fr ins m a -> ViaLiftLower fr ins m b
forall a b c.
(a -> b -> c)
-> ViaLiftLower fr ins m a
-> ViaLiftLower fr ins m b
-> ViaLiftLower fr ins 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 {fr :: (* -> *) -> (* -> *) -> * -> *} {ins :: * -> *}
       {m :: * -> *}.
Applicative (fr ins m) =>
Functor (ViaLiftLower fr ins m)
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
Applicative (fr ins m) =>
a -> ViaLiftLower fr ins m a
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a b.
Applicative (fr ins m) =>
ViaLiftLower fr ins m a
-> ViaLiftLower fr ins m b -> ViaLiftLower fr ins m a
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a b.
Applicative (fr ins m) =>
ViaLiftLower fr ins m a
-> ViaLiftLower fr ins m b -> ViaLiftLower fr ins m b
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a b.
Applicative (fr ins m) =>
ViaLiftLower fr ins m (a -> b)
-> ViaLiftLower fr ins m a -> ViaLiftLower fr ins m b
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a b c.
Applicative (fr ins m) =>
(a -> b -> c)
-> ViaLiftLower fr ins m a
-> ViaLiftLower fr ins m b
-> ViaLiftLower fr ins m c
<* :: forall a b.
ViaLiftLower fr ins m a
-> ViaLiftLower fr ins m b -> ViaLiftLower fr ins m a
$c<* :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a b.
Applicative (fr ins m) =>
ViaLiftLower fr ins m a
-> ViaLiftLower fr ins m b -> ViaLiftLower fr ins m a
*> :: forall a b.
ViaLiftLower fr ins m a
-> ViaLiftLower fr ins m b -> ViaLiftLower fr ins m b
$c*> :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a b.
Applicative (fr ins m) =>
ViaLiftLower fr ins m a
-> ViaLiftLower fr ins m b -> ViaLiftLower fr ins m b
liftA2 :: forall a b c.
(a -> b -> c)
-> ViaLiftLower fr ins m a
-> ViaLiftLower fr ins m b
-> ViaLiftLower fr ins m c
$cliftA2 :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a b c.
Applicative (fr ins m) =>
(a -> b -> c)
-> ViaLiftLower fr ins m a
-> ViaLiftLower fr ins m b
-> ViaLiftLower fr ins m c
<*> :: forall a b.
ViaLiftLower fr ins m (a -> b)
-> ViaLiftLower fr ins m a -> ViaLiftLower fr ins m b
$c<*> :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a b.
Applicative (fr ins m) =>
ViaLiftLower fr ins m (a -> b)
-> ViaLiftLower fr ins m a -> ViaLiftLower fr ins m b
pure :: forall a. a -> ViaLiftLower fr ins m a
$cpure :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
Applicative (fr ins m) =>
a -> ViaLiftLower fr ins m a
Applicative, forall a. a -> ViaLiftLower fr ins m a
forall a b.
ViaLiftLower fr ins m a
-> ViaLiftLower fr ins m b -> ViaLiftLower fr ins m b
forall a b.
ViaLiftLower fr ins m a
-> (a -> ViaLiftLower fr ins m b) -> ViaLiftLower fr ins 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 {fr :: (* -> *) -> (* -> *) -> * -> *} {ins :: * -> *}
       {m :: * -> *}.
Monad (fr ins m) =>
Applicative (ViaLiftLower fr ins m)
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
Monad (fr ins m) =>
a -> ViaLiftLower fr ins m a
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a b.
Monad (fr ins m) =>
ViaLiftLower fr ins m a
-> ViaLiftLower fr ins m b -> ViaLiftLower fr ins m b
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a b.
Monad (fr ins m) =>
ViaLiftLower fr ins m a
-> (a -> ViaLiftLower fr ins m b) -> ViaLiftLower fr ins m b
return :: forall a. a -> ViaLiftLower fr ins m a
$creturn :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
Monad (fr ins m) =>
a -> ViaLiftLower fr ins m a
>> :: forall a b.
ViaLiftLower fr ins m a
-> ViaLiftLower fr ins m b -> ViaLiftLower fr ins m b
$c>> :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a b.
Monad (fr ins m) =>
ViaLiftLower fr ins m a
-> ViaLiftLower fr ins m b -> ViaLiftLower fr ins m b
>>= :: forall a b.
ViaLiftLower fr ins m a
-> (a -> ViaLiftLower fr ins m b) -> ViaLiftLower fr ins m b
$c>>= :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a b.
Monad (fr ins m) =>
ViaLiftLower fr ins m a
-> (a -> ViaLiftLower fr ins m b) -> ViaLiftLower fr ins m b
Monad)
    deriving stock (forall a. ViaLiftLower fr ins m a -> Bool
forall m a. Monoid m => (a -> m) -> ViaLiftLower fr ins m a -> m
forall a b. (a -> b -> b) -> b -> ViaLiftLower fr ins m a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
(Foldable (fr ins m), Eq a) =>
a -> ViaLiftLower fr ins m a -> Bool
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
(Foldable (fr ins m), Num a) =>
ViaLiftLower fr ins m a -> a
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
(Foldable (fr ins m), Ord a) =>
ViaLiftLower fr ins m a -> a
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) m.
(Foldable (fr ins m), Monoid m) =>
ViaLiftLower fr ins m m -> m
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
Foldable (fr ins m) =>
ViaLiftLower fr ins m a -> Bool
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
Foldable (fr ins m) =>
ViaLiftLower fr ins m a -> Int
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
Foldable (fr ins m) =>
ViaLiftLower fr ins m a -> [a]
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
Foldable (fr ins m) =>
(a -> a -> a) -> ViaLiftLower fr ins m a -> a
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) m a.
(Foldable (fr ins m), Monoid m) =>
(a -> m) -> ViaLiftLower fr ins m a -> m
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) b a.
Foldable (fr ins m) =>
(b -> a -> b) -> b -> ViaLiftLower fr ins m a -> b
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a b.
Foldable (fr ins m) =>
(a -> b -> b) -> b -> ViaLiftLower fr ins m a -> b
product :: forall a. Num a => ViaLiftLower fr ins m a -> a
$cproduct :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
(Foldable (fr ins m), Num a) =>
ViaLiftLower fr ins m a -> a
sum :: forall a. Num a => ViaLiftLower fr ins m a -> a
$csum :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
(Foldable (fr ins m), Num a) =>
ViaLiftLower fr ins m a -> a
minimum :: forall a. Ord a => ViaLiftLower fr ins m a -> a
$cminimum :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
(Foldable (fr ins m), Ord a) =>
ViaLiftLower fr ins m a -> a
maximum :: forall a. Ord a => ViaLiftLower fr ins m a -> a
$cmaximum :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
(Foldable (fr ins m), Ord a) =>
ViaLiftLower fr ins m a -> a
elem :: forall a. Eq a => a -> ViaLiftLower fr ins m a -> Bool
$celem :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
(Foldable (fr ins m), Eq a) =>
a -> ViaLiftLower fr ins m a -> Bool
length :: forall a. ViaLiftLower fr ins m a -> Int
$clength :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
Foldable (fr ins m) =>
ViaLiftLower fr ins m a -> Int
null :: forall a. ViaLiftLower fr ins m a -> Bool
$cnull :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
Foldable (fr ins m) =>
ViaLiftLower fr ins m a -> Bool
toList :: forall a. ViaLiftLower fr ins m a -> [a]
$ctoList :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
Foldable (fr ins m) =>
ViaLiftLower fr ins m a -> [a]
foldl1 :: forall a. (a -> a -> a) -> ViaLiftLower fr ins m a -> a
$cfoldl1 :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
Foldable (fr ins m) =>
(a -> a -> a) -> ViaLiftLower fr ins m a -> a
foldr1 :: forall a. (a -> a -> a) -> ViaLiftLower fr ins m a -> a
$cfoldr1 :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
Foldable (fr ins m) =>
(a -> a -> a) -> ViaLiftLower fr ins m a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> ViaLiftLower fr ins m a -> b
$cfoldl' :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) b a.
Foldable (fr ins m) =>
(b -> a -> b) -> b -> ViaLiftLower fr ins m a -> b
foldl :: forall b a. (b -> a -> b) -> b -> ViaLiftLower fr ins m a -> b
$cfoldl :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) b a.
Foldable (fr ins m) =>
(b -> a -> b) -> b -> ViaLiftLower fr ins m a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> ViaLiftLower fr ins m a -> b
$cfoldr' :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a b.
Foldable (fr ins m) =>
(a -> b -> b) -> b -> ViaLiftLower fr ins m a -> b
foldr :: forall a b. (a -> b -> b) -> b -> ViaLiftLower fr ins m a -> b
$cfoldr :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a b.
Foldable (fr ins m) =>
(a -> b -> b) -> b -> ViaLiftLower fr ins m a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> ViaLiftLower fr ins m a -> m
$cfoldMap' :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) m a.
(Foldable (fr ins m), Monoid m) =>
(a -> m) -> ViaLiftLower fr ins m a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> ViaLiftLower fr ins m a -> m
$cfoldMap :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) m a.
(Foldable (fr ins m), Monoid m) =>
(a -> m) -> ViaLiftLower fr ins m a -> m
fold :: forall m. Monoid m => ViaLiftLower fr ins m m -> m
$cfold :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) m.
(Foldable (fr ins m), Monoid m) =>
ViaLiftLower fr ins m m -> m
Foldable, 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 (f :: * -> *) a b.
Applicative f =>
(a -> f b)
-> ViaLiftLower fr ins m a -> f (ViaLiftLower fr ins m b)
forall {fr :: (* -> *) -> (* -> *) -> * -> *} {ins :: * -> *}
       {m :: * -> *}.
Traversable (fr ins m) =>
Functor (ViaLiftLower fr ins m)
forall {fr :: (* -> *) -> (* -> *) -> * -> *} {ins :: * -> *}
       {m :: * -> *}.
Traversable (fr ins m) =>
Foldable (ViaLiftLower fr ins m)
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) (m :: * -> *) a.
(Traversable (fr ins m), Monad m) =>
ViaLiftLower fr ins m (m a) -> m (ViaLiftLower fr ins m a)
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) (f :: * -> *) a.
(Traversable (fr ins m), Applicative f) =>
ViaLiftLower fr ins m (f a) -> f (ViaLiftLower fr ins m a)
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) (m :: * -> *) a b.
(Traversable (fr ins m), Monad m) =>
(a -> m b)
-> ViaLiftLower fr ins m a -> m (ViaLiftLower fr ins m b)
forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) (f :: * -> *) a b.
(Traversable (fr ins m), Applicative f) =>
(a -> f b)
-> ViaLiftLower fr ins m a -> f (ViaLiftLower fr ins m b)
sequence :: forall (m :: * -> *) a.
Monad m =>
ViaLiftLower fr ins m (m a) -> m (ViaLiftLower fr ins m a)
$csequence :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) (m :: * -> *) a.
(Traversable (fr ins m), Monad m) =>
ViaLiftLower fr ins m (m a) -> m (ViaLiftLower fr ins m a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b)
-> ViaLiftLower fr ins m a -> m (ViaLiftLower fr ins m b)
$cmapM :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) (m :: * -> *) a b.
(Traversable (fr ins m), Monad m) =>
(a -> m b)
-> ViaLiftLower fr ins m a -> m (ViaLiftLower fr ins m b)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
ViaLiftLower fr ins m (f a) -> f (ViaLiftLower fr ins m a)
$csequenceA :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) (f :: * -> *) a.
(Traversable (fr ins m), Applicative f) =>
ViaLiftLower fr ins m (f a) -> f (ViaLiftLower fr ins m a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b)
-> ViaLiftLower fr ins m a -> f (ViaLiftLower fr ins m b)
$ctraverse :: forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) (f :: * -> *) a b.
(Traversable (fr ins m), Applicative f) =>
(a -> f b)
-> ViaLiftLower fr ins m a -> f (ViaLiftLower fr ins m b)
Traversable)

instance TransFreer Monad h => MonadTrans (ViaLiftLower h ins) where
    lift :: forall (m :: * -> *) a. Monad m => m a -> ViaLiftLower h ins m a
lift = forall (fr :: (* -> *) -> (* -> *) -> * -> *) (ins :: * -> *)
       (m :: * -> *) a.
fr ins m a -> ViaLiftLower fr ins m a
ViaLiftLower forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (c :: (k -> *) -> Constraint)
       (fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
       (f :: k -> *).
(TransFreer c fr, c f) =>
f ~> fr ins f
liftLowerFT
    {-# INLINE lift #-}