{-# LANGUAGE DeriveAnyClass, DeriveFunctor, DeriveGeneric, DerivingStrategies, FlexibleContexts, FlexibleInstances, GeneralizedNewtypeDeriving, MultiParamTypeClasses, TypeOperators, UndecidableInstances #-}
module Control.Effect.Trace
(
Trace(..)
, trace
, runTraceByPrinting
, TraceByPrintingC(..)
, runTraceByIgnoring
, TraceByIgnoringC(..)
, runTraceByReturning
, TraceByReturningC(..)
, Carrier
, Member
, run
) where
import Control.Applicative (Alternative(..))
import Control.Effect.Carrier
import Control.Effect.State
import Control.Monad (MonadPlus(..))
import qualified Control.Monad.Fail as Fail
import Control.Monad.Fix
import Control.Monad.IO.Class
import Control.Monad.Trans.Class
import Data.Bifunctor (first)
import GHC.Generics (Generic1)
import System.IO
data Trace m k = Trace
{ Trace m k -> String
traceMessage :: String
, Trace m k -> m k
traceCont :: m k
}
deriving stock (a -> Trace m b -> Trace m a
(a -> b) -> Trace m a -> Trace m b
(forall a b. (a -> b) -> Trace m a -> Trace m b)
-> (forall a b. a -> Trace m b -> Trace m a) -> Functor (Trace m)
forall a b. a -> Trace m b -> Trace m a
forall a b. (a -> b) -> Trace m a -> Trace m b
forall (m :: * -> *) a b. Functor m => a -> Trace m b -> Trace m a
forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> Trace m a -> Trace m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Trace m b -> Trace m a
$c<$ :: forall (m :: * -> *) a b. Functor m => a -> Trace m b -> Trace m a
fmap :: (a -> b) -> Trace m a -> Trace m b
$cfmap :: forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> Trace m a -> Trace m b
Functor, (forall a. Trace m a -> Rep1 (Trace m) a)
-> (forall a. Rep1 (Trace m) a -> Trace m a) -> Generic1 (Trace m)
forall a. Rep1 (Trace m) a -> Trace m a
forall a. Trace m a -> Rep1 (Trace m) a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
forall (m :: * -> *) a. Rep1 (Trace m) a -> Trace m a
forall (m :: * -> *) a. Trace m a -> Rep1 (Trace m) a
$cto1 :: forall (m :: * -> *) a. Rep1 (Trace m) a -> Trace m a
$cfrom1 :: forall (m :: * -> *) a. Trace m a -> Rep1 (Trace m) a
Generic1)
deriving anyclass ((forall (f :: * -> *) a b.
Functor (Trace f) =>
(a -> b) -> Trace f a -> Trace f b)
-> (forall (m :: * -> *) (n :: * -> *) a.
Functor m =>
(forall x. m x -> n x) -> Trace m a -> Trace n a)
-> HFunctor Trace
forall (f :: * -> *) a b.
Functor (Trace f) =>
(a -> b) -> Trace f a -> Trace f b
forall (m :: * -> *) (n :: * -> *) a.
Functor m =>
(forall x. m x -> n x) -> Trace m a -> Trace n a
forall (h :: (* -> *) -> * -> *).
(forall (f :: * -> *) a b.
Functor (h f) =>
(a -> b) -> h f a -> h f b)
-> (forall (m :: * -> *) (n :: * -> *) a.
Functor m =>
(forall x. m x -> n x) -> h m a -> h n a)
-> HFunctor h
hmap :: (forall x. m x -> n x) -> Trace m a -> Trace n a
$chmap :: forall (m :: * -> *) (n :: * -> *) a.
Functor m =>
(forall x. m x -> n x) -> Trace m a -> Trace n a
fmap' :: (a -> b) -> Trace f a -> Trace f b
$cfmap' :: forall (f :: * -> *) a b.
Functor (Trace f) =>
(a -> b) -> Trace f a -> Trace f b
HFunctor, HFunctor Trace
HFunctor Trace =>
(forall (f :: * -> *) (m :: * -> *) (n :: * -> *) a.
(Functor f, Monad m) =>
f ()
-> (forall x. f (m x) -> n (f x)) -> Trace m a -> Trace n (f a))
-> Effect Trace
forall (f :: * -> *) (m :: * -> *) (n :: * -> *) a.
(Functor f, Monad m) =>
f ()
-> (forall x. f (m x) -> n (f x)) -> Trace m a -> Trace n (f a)
forall (sig :: (* -> *) -> * -> *).
HFunctor sig =>
(forall (f :: * -> *) (m :: * -> *) (n :: * -> *) a.
(Functor f, Monad m) =>
f () -> (forall x. f (m x) -> n (f x)) -> sig m a -> sig n (f a))
-> Effect sig
handle :: f ()
-> (forall x. f (m x) -> n (f x)) -> Trace m a -> Trace n (f a)
$chandle :: forall (f :: * -> *) (m :: * -> *) (n :: * -> *) a.
(Functor f, Monad m) =>
f ()
-> (forall x. f (m x) -> n (f x)) -> Trace m a -> Trace n (f a)
$cp1Effect :: HFunctor Trace
Effect)
trace :: (Member Trace sig, Carrier sig m) => String -> m ()
trace :: String -> m ()
trace message :: String
message = Trace m () -> m ()
forall (effect :: (* -> *) -> * -> *) (sig :: (* -> *) -> * -> *)
(m :: * -> *) a.
(Member effect sig, Carrier sig m) =>
effect m a -> m a
send (String -> m () -> Trace m ()
forall (m :: * -> *) k. String -> m k -> Trace m k
Trace String
message (() -> m ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ()))
runTraceByPrinting :: TraceByPrintingC m a -> m a
runTraceByPrinting :: TraceByPrintingC m a -> m a
runTraceByPrinting = TraceByPrintingC m a -> m a
forall (m :: * -> *) a. TraceByPrintingC m a -> m a
runTraceByPrintingC
newtype TraceByPrintingC m a = TraceByPrintingC { TraceByPrintingC m a -> m a
runTraceByPrintingC :: m a }
deriving newtype (Applicative (TraceByPrintingC m)
TraceByPrintingC m a
Applicative (TraceByPrintingC m) =>
(forall a. TraceByPrintingC m a)
-> (forall a.
TraceByPrintingC m a
-> TraceByPrintingC m a -> TraceByPrintingC m a)
-> (forall a. TraceByPrintingC m a -> TraceByPrintingC m [a])
-> (forall a. TraceByPrintingC m a -> TraceByPrintingC m [a])
-> Alternative (TraceByPrintingC m)
TraceByPrintingC m a
-> TraceByPrintingC m a -> TraceByPrintingC m a
TraceByPrintingC m a -> TraceByPrintingC m [a]
TraceByPrintingC m a -> TraceByPrintingC m [a]
forall a. TraceByPrintingC m a
forall a. TraceByPrintingC m a -> TraceByPrintingC m [a]
forall a.
TraceByPrintingC m a
-> TraceByPrintingC m a -> TraceByPrintingC m a
forall (f :: * -> *).
Applicative f =>
(forall a. f a)
-> (forall a. f a -> f a -> f a)
-> (forall a. f a -> f [a])
-> (forall a. f a -> f [a])
-> Alternative f
forall (m :: * -> *).
Alternative m =>
Applicative (TraceByPrintingC m)
forall (m :: * -> *) a. Alternative m => TraceByPrintingC m a
forall (m :: * -> *) a.
Alternative m =>
TraceByPrintingC m a -> TraceByPrintingC m [a]
forall (m :: * -> *) a.
Alternative m =>
TraceByPrintingC m a
-> TraceByPrintingC m a -> TraceByPrintingC m a
many :: TraceByPrintingC m a -> TraceByPrintingC m [a]
$cmany :: forall (m :: * -> *) a.
Alternative m =>
TraceByPrintingC m a -> TraceByPrintingC m [a]
some :: TraceByPrintingC m a -> TraceByPrintingC m [a]
$csome :: forall (m :: * -> *) a.
Alternative m =>
TraceByPrintingC m a -> TraceByPrintingC m [a]
<|> :: TraceByPrintingC m a
-> TraceByPrintingC m a -> TraceByPrintingC m a
$c<|> :: forall (m :: * -> *) a.
Alternative m =>
TraceByPrintingC m a
-> TraceByPrintingC m a -> TraceByPrintingC m a
empty :: TraceByPrintingC m a
$cempty :: forall (m :: * -> *) a. Alternative m => TraceByPrintingC m a
$cp1Alternative :: forall (m :: * -> *).
Alternative m =>
Applicative (TraceByPrintingC m)
Alternative, Functor (TraceByPrintingC m)
a -> TraceByPrintingC m a
Functor (TraceByPrintingC m) =>
(forall a. a -> TraceByPrintingC m a)
-> (forall a b.
TraceByPrintingC m (a -> b)
-> TraceByPrintingC m a -> TraceByPrintingC m b)
-> (forall a b c.
(a -> b -> c)
-> TraceByPrintingC m a
-> TraceByPrintingC m b
-> TraceByPrintingC m c)
-> (forall a b.
TraceByPrintingC m a
-> TraceByPrintingC m b -> TraceByPrintingC m b)
-> (forall a b.
TraceByPrintingC m a
-> TraceByPrintingC m b -> TraceByPrintingC m a)
-> Applicative (TraceByPrintingC m)
TraceByPrintingC m a
-> TraceByPrintingC m b -> TraceByPrintingC m b
TraceByPrintingC m a
-> TraceByPrintingC m b -> TraceByPrintingC m a
TraceByPrintingC m (a -> b)
-> TraceByPrintingC m a -> TraceByPrintingC m b
(a -> b -> c)
-> TraceByPrintingC m a
-> TraceByPrintingC m b
-> TraceByPrintingC m c
forall a. a -> TraceByPrintingC m a
forall a b.
TraceByPrintingC m a
-> TraceByPrintingC m b -> TraceByPrintingC m a
forall a b.
TraceByPrintingC m a
-> TraceByPrintingC m b -> TraceByPrintingC m b
forall a b.
TraceByPrintingC m (a -> b)
-> TraceByPrintingC m a -> TraceByPrintingC m b
forall a b c.
(a -> b -> c)
-> TraceByPrintingC m a
-> TraceByPrintingC m b
-> TraceByPrintingC 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 (TraceByPrintingC m)
forall (m :: * -> *) a. Applicative m => a -> TraceByPrintingC m a
forall (m :: * -> *) a b.
Applicative m =>
TraceByPrintingC m a
-> TraceByPrintingC m b -> TraceByPrintingC m a
forall (m :: * -> *) a b.
Applicative m =>
TraceByPrintingC m a
-> TraceByPrintingC m b -> TraceByPrintingC m b
forall (m :: * -> *) a b.
Applicative m =>
TraceByPrintingC m (a -> b)
-> TraceByPrintingC m a -> TraceByPrintingC m b
forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> TraceByPrintingC m a
-> TraceByPrintingC m b
-> TraceByPrintingC m c
<* :: TraceByPrintingC m a
-> TraceByPrintingC m b -> TraceByPrintingC m a
$c<* :: forall (m :: * -> *) a b.
Applicative m =>
TraceByPrintingC m a
-> TraceByPrintingC m b -> TraceByPrintingC m a
*> :: TraceByPrintingC m a
-> TraceByPrintingC m b -> TraceByPrintingC m b
$c*> :: forall (m :: * -> *) a b.
Applicative m =>
TraceByPrintingC m a
-> TraceByPrintingC m b -> TraceByPrintingC m b
liftA2 :: (a -> b -> c)
-> TraceByPrintingC m a
-> TraceByPrintingC m b
-> TraceByPrintingC m c
$cliftA2 :: forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> TraceByPrintingC m a
-> TraceByPrintingC m b
-> TraceByPrintingC m c
<*> :: TraceByPrintingC m (a -> b)
-> TraceByPrintingC m a -> TraceByPrintingC m b
$c<*> :: forall (m :: * -> *) a b.
Applicative m =>
TraceByPrintingC m (a -> b)
-> TraceByPrintingC m a -> TraceByPrintingC m b
pure :: a -> TraceByPrintingC m a
$cpure :: forall (m :: * -> *) a. Applicative m => a -> TraceByPrintingC m a
$cp1Applicative :: forall (m :: * -> *). Applicative m => Functor (TraceByPrintingC m)
Applicative, a -> TraceByPrintingC m b -> TraceByPrintingC m a
(a -> b) -> TraceByPrintingC m a -> TraceByPrintingC m b
(forall a b.
(a -> b) -> TraceByPrintingC m a -> TraceByPrintingC m b)
-> (forall a b. a -> TraceByPrintingC m b -> TraceByPrintingC m a)
-> Functor (TraceByPrintingC m)
forall a b. a -> TraceByPrintingC m b -> TraceByPrintingC m a
forall a b.
(a -> b) -> TraceByPrintingC m a -> TraceByPrintingC m b
forall (m :: * -> *) a b.
Functor m =>
a -> TraceByPrintingC m b -> TraceByPrintingC m a
forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> TraceByPrintingC m a -> TraceByPrintingC m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> TraceByPrintingC m b -> TraceByPrintingC m a
$c<$ :: forall (m :: * -> *) a b.
Functor m =>
a -> TraceByPrintingC m b -> TraceByPrintingC m a
fmap :: (a -> b) -> TraceByPrintingC m a -> TraceByPrintingC m b
$cfmap :: forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> TraceByPrintingC m a -> TraceByPrintingC m b
Functor, Applicative (TraceByPrintingC m)
a -> TraceByPrintingC m a
Applicative (TraceByPrintingC m) =>
(forall a b.
TraceByPrintingC m a
-> (a -> TraceByPrintingC m b) -> TraceByPrintingC m b)
-> (forall a b.
TraceByPrintingC m a
-> TraceByPrintingC m b -> TraceByPrintingC m b)
-> (forall a. a -> TraceByPrintingC m a)
-> Monad (TraceByPrintingC m)
TraceByPrintingC m a
-> (a -> TraceByPrintingC m b) -> TraceByPrintingC m b
TraceByPrintingC m a
-> TraceByPrintingC m b -> TraceByPrintingC m b
forall a. a -> TraceByPrintingC m a
forall a b.
TraceByPrintingC m a
-> TraceByPrintingC m b -> TraceByPrintingC m b
forall a b.
TraceByPrintingC m a
-> (a -> TraceByPrintingC m b) -> TraceByPrintingC m b
forall (m :: * -> *). Monad m => Applicative (TraceByPrintingC m)
forall (m :: * -> *) a. Monad m => a -> TraceByPrintingC m a
forall (m :: * -> *) a b.
Monad m =>
TraceByPrintingC m a
-> TraceByPrintingC m b -> TraceByPrintingC m b
forall (m :: * -> *) a b.
Monad m =>
TraceByPrintingC m a
-> (a -> TraceByPrintingC m b) -> TraceByPrintingC 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 -> TraceByPrintingC m a
$creturn :: forall (m :: * -> *) a. Monad m => a -> TraceByPrintingC m a
>> :: TraceByPrintingC m a
-> TraceByPrintingC m b -> TraceByPrintingC m b
$c>> :: forall (m :: * -> *) a b.
Monad m =>
TraceByPrintingC m a
-> TraceByPrintingC m b -> TraceByPrintingC m b
>>= :: TraceByPrintingC m a
-> (a -> TraceByPrintingC m b) -> TraceByPrintingC m b
$c>>= :: forall (m :: * -> *) a b.
Monad m =>
TraceByPrintingC m a
-> (a -> TraceByPrintingC m b) -> TraceByPrintingC m b
$cp1Monad :: forall (m :: * -> *). Monad m => Applicative (TraceByPrintingC m)
Monad, Monad (TraceByPrintingC m)
Monad (TraceByPrintingC m) =>
(forall a. String -> TraceByPrintingC m a)
-> MonadFail (TraceByPrintingC m)
String -> TraceByPrintingC m a
forall a. String -> TraceByPrintingC m a
forall (m :: * -> *).
Monad m =>
(forall a. String -> m a) -> MonadFail m
forall (m :: * -> *). MonadFail m => Monad (TraceByPrintingC m)
forall (m :: * -> *) a.
MonadFail m =>
String -> TraceByPrintingC m a
fail :: String -> TraceByPrintingC m a
$cfail :: forall (m :: * -> *) a.
MonadFail m =>
String -> TraceByPrintingC m a
$cp1MonadFail :: forall (m :: * -> *). MonadFail m => Monad (TraceByPrintingC m)
Fail.MonadFail, Monad (TraceByPrintingC m)
Monad (TraceByPrintingC m) =>
(forall a. (a -> TraceByPrintingC m a) -> TraceByPrintingC m a)
-> MonadFix (TraceByPrintingC m)
(a -> TraceByPrintingC m a) -> TraceByPrintingC m a
forall a. (a -> TraceByPrintingC m a) -> TraceByPrintingC m a
forall (m :: * -> *).
Monad m =>
(forall a. (a -> m a) -> m a) -> MonadFix m
forall (m :: * -> *). MonadFix m => Monad (TraceByPrintingC m)
forall (m :: * -> *) a.
MonadFix m =>
(a -> TraceByPrintingC m a) -> TraceByPrintingC m a
mfix :: (a -> TraceByPrintingC m a) -> TraceByPrintingC m a
$cmfix :: forall (m :: * -> *) a.
MonadFix m =>
(a -> TraceByPrintingC m a) -> TraceByPrintingC m a
$cp1MonadFix :: forall (m :: * -> *). MonadFix m => Monad (TraceByPrintingC m)
MonadFix, Monad (TraceByPrintingC m)
Monad (TraceByPrintingC m) =>
(forall a. IO a -> TraceByPrintingC m a)
-> MonadIO (TraceByPrintingC m)
IO a -> TraceByPrintingC m a
forall a. IO a -> TraceByPrintingC m a
forall (m :: * -> *).
Monad m =>
(forall a. IO a -> m a) -> MonadIO m
forall (m :: * -> *). MonadIO m => Monad (TraceByPrintingC m)
forall (m :: * -> *) a. MonadIO m => IO a -> TraceByPrintingC m a
liftIO :: IO a -> TraceByPrintingC m a
$cliftIO :: forall (m :: * -> *) a. MonadIO m => IO a -> TraceByPrintingC m a
$cp1MonadIO :: forall (m :: * -> *). MonadIO m => Monad (TraceByPrintingC m)
MonadIO, Monad (TraceByPrintingC m)
Alternative (TraceByPrintingC m)
TraceByPrintingC m a
(Alternative (TraceByPrintingC m), Monad (TraceByPrintingC m)) =>
(forall a. TraceByPrintingC m a)
-> (forall a.
TraceByPrintingC m a
-> TraceByPrintingC m a -> TraceByPrintingC m a)
-> MonadPlus (TraceByPrintingC m)
TraceByPrintingC m a
-> TraceByPrintingC m a -> TraceByPrintingC m a
forall a. TraceByPrintingC m a
forall a.
TraceByPrintingC m a
-> TraceByPrintingC m a -> TraceByPrintingC m a
forall (m :: * -> *).
(Alternative m, Monad m) =>
(forall a. m a) -> (forall a. m a -> m a -> m a) -> MonadPlus m
forall (m :: * -> *). MonadPlus m => Monad (TraceByPrintingC m)
forall (m :: * -> *).
MonadPlus m =>
Alternative (TraceByPrintingC m)
forall (m :: * -> *) a. MonadPlus m => TraceByPrintingC m a
forall (m :: * -> *) a.
MonadPlus m =>
TraceByPrintingC m a
-> TraceByPrintingC m a -> TraceByPrintingC m a
mplus :: TraceByPrintingC m a
-> TraceByPrintingC m a -> TraceByPrintingC m a
$cmplus :: forall (m :: * -> *) a.
MonadPlus m =>
TraceByPrintingC m a
-> TraceByPrintingC m a -> TraceByPrintingC m a
mzero :: TraceByPrintingC m a
$cmzero :: forall (m :: * -> *) a. MonadPlus m => TraceByPrintingC m a
$cp2MonadPlus :: forall (m :: * -> *). MonadPlus m => Monad (TraceByPrintingC m)
$cp1MonadPlus :: forall (m :: * -> *).
MonadPlus m =>
Alternative (TraceByPrintingC m)
MonadPlus)
instance MonadTrans TraceByPrintingC where
lift :: m a -> TraceByPrintingC m a
lift = m a -> TraceByPrintingC m a
forall (m :: * -> *) a. m a -> TraceByPrintingC m a
TraceByPrintingC
{-# INLINE lift #-}
instance (MonadIO m, Carrier sig m) => Carrier (Trace :+: sig) (TraceByPrintingC m) where
eff :: (:+:) Trace sig (TraceByPrintingC m) a -> TraceByPrintingC m a
eff (L (Trace s :: String
s k :: TraceByPrintingC m a
k)) = IO () -> TraceByPrintingC m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (Handle -> String -> IO ()
hPutStrLn Handle
stderr String
s) TraceByPrintingC m ()
-> TraceByPrintingC m a -> TraceByPrintingC m a
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> TraceByPrintingC m a
k
eff (R other :: sig (TraceByPrintingC m) a
other) = m a -> TraceByPrintingC m a
forall (m :: * -> *) a. m a -> TraceByPrintingC m a
TraceByPrintingC (sig m a -> m a
forall (sig :: (* -> *) -> * -> *) (m :: * -> *) a.
Carrier sig m =>
sig m a -> m a
eff (sig (TraceByPrintingC m) a -> sig m a
forall (sig :: (* -> *) -> * -> *) (f :: * -> *) (g :: * -> *) a.
(HFunctor sig, Functor f, Coercible f g) =>
sig f a -> sig g a
handleCoercible sig (TraceByPrintingC m) a
other))
{-# INLINE eff #-}
runTraceByIgnoring :: TraceByIgnoringC m a -> m a
runTraceByIgnoring :: TraceByIgnoringC m a -> m a
runTraceByIgnoring = TraceByIgnoringC m a -> m a
forall (m :: * -> *) a. TraceByIgnoringC m a -> m a
runTraceByIgnoringC
newtype TraceByIgnoringC m a = TraceByIgnoringC { TraceByIgnoringC m a -> m a
runTraceByIgnoringC :: m a }
deriving newtype (Applicative (TraceByIgnoringC m)
TraceByIgnoringC m a
Applicative (TraceByIgnoringC m) =>
(forall a. TraceByIgnoringC m a)
-> (forall a.
TraceByIgnoringC m a
-> TraceByIgnoringC m a -> TraceByIgnoringC m a)
-> (forall a. TraceByIgnoringC m a -> TraceByIgnoringC m [a])
-> (forall a. TraceByIgnoringC m a -> TraceByIgnoringC m [a])
-> Alternative (TraceByIgnoringC m)
TraceByIgnoringC m a
-> TraceByIgnoringC m a -> TraceByIgnoringC m a
TraceByIgnoringC m a -> TraceByIgnoringC m [a]
TraceByIgnoringC m a -> TraceByIgnoringC m [a]
forall a. TraceByIgnoringC m a
forall a. TraceByIgnoringC m a -> TraceByIgnoringC m [a]
forall a.
TraceByIgnoringC m a
-> TraceByIgnoringC m a -> TraceByIgnoringC m a
forall (f :: * -> *).
Applicative f =>
(forall a. f a)
-> (forall a. f a -> f a -> f a)
-> (forall a. f a -> f [a])
-> (forall a. f a -> f [a])
-> Alternative f
forall (m :: * -> *).
Alternative m =>
Applicative (TraceByIgnoringC m)
forall (m :: * -> *) a. Alternative m => TraceByIgnoringC m a
forall (m :: * -> *) a.
Alternative m =>
TraceByIgnoringC m a -> TraceByIgnoringC m [a]
forall (m :: * -> *) a.
Alternative m =>
TraceByIgnoringC m a
-> TraceByIgnoringC m a -> TraceByIgnoringC m a
many :: TraceByIgnoringC m a -> TraceByIgnoringC m [a]
$cmany :: forall (m :: * -> *) a.
Alternative m =>
TraceByIgnoringC m a -> TraceByIgnoringC m [a]
some :: TraceByIgnoringC m a -> TraceByIgnoringC m [a]
$csome :: forall (m :: * -> *) a.
Alternative m =>
TraceByIgnoringC m a -> TraceByIgnoringC m [a]
<|> :: TraceByIgnoringC m a
-> TraceByIgnoringC m a -> TraceByIgnoringC m a
$c<|> :: forall (m :: * -> *) a.
Alternative m =>
TraceByIgnoringC m a
-> TraceByIgnoringC m a -> TraceByIgnoringC m a
empty :: TraceByIgnoringC m a
$cempty :: forall (m :: * -> *) a. Alternative m => TraceByIgnoringC m a
$cp1Alternative :: forall (m :: * -> *).
Alternative m =>
Applicative (TraceByIgnoringC m)
Alternative, Functor (TraceByIgnoringC m)
a -> TraceByIgnoringC m a
Functor (TraceByIgnoringC m) =>
(forall a. a -> TraceByIgnoringC m a)
-> (forall a b.
TraceByIgnoringC m (a -> b)
-> TraceByIgnoringC m a -> TraceByIgnoringC m b)
-> (forall a b c.
(a -> b -> c)
-> TraceByIgnoringC m a
-> TraceByIgnoringC m b
-> TraceByIgnoringC m c)
-> (forall a b.
TraceByIgnoringC m a
-> TraceByIgnoringC m b -> TraceByIgnoringC m b)
-> (forall a b.
TraceByIgnoringC m a
-> TraceByIgnoringC m b -> TraceByIgnoringC m a)
-> Applicative (TraceByIgnoringC m)
TraceByIgnoringC m a
-> TraceByIgnoringC m b -> TraceByIgnoringC m b
TraceByIgnoringC m a
-> TraceByIgnoringC m b -> TraceByIgnoringC m a
TraceByIgnoringC m (a -> b)
-> TraceByIgnoringC m a -> TraceByIgnoringC m b
(a -> b -> c)
-> TraceByIgnoringC m a
-> TraceByIgnoringC m b
-> TraceByIgnoringC m c
forall a. a -> TraceByIgnoringC m a
forall a b.
TraceByIgnoringC m a
-> TraceByIgnoringC m b -> TraceByIgnoringC m a
forall a b.
TraceByIgnoringC m a
-> TraceByIgnoringC m b -> TraceByIgnoringC m b
forall a b.
TraceByIgnoringC m (a -> b)
-> TraceByIgnoringC m a -> TraceByIgnoringC m b
forall a b c.
(a -> b -> c)
-> TraceByIgnoringC m a
-> TraceByIgnoringC m b
-> TraceByIgnoringC 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 (TraceByIgnoringC m)
forall (m :: * -> *) a. Applicative m => a -> TraceByIgnoringC m a
forall (m :: * -> *) a b.
Applicative m =>
TraceByIgnoringC m a
-> TraceByIgnoringC m b -> TraceByIgnoringC m a
forall (m :: * -> *) a b.
Applicative m =>
TraceByIgnoringC m a
-> TraceByIgnoringC m b -> TraceByIgnoringC m b
forall (m :: * -> *) a b.
Applicative m =>
TraceByIgnoringC m (a -> b)
-> TraceByIgnoringC m a -> TraceByIgnoringC m b
forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> TraceByIgnoringC m a
-> TraceByIgnoringC m b
-> TraceByIgnoringC m c
<* :: TraceByIgnoringC m a
-> TraceByIgnoringC m b -> TraceByIgnoringC m a
$c<* :: forall (m :: * -> *) a b.
Applicative m =>
TraceByIgnoringC m a
-> TraceByIgnoringC m b -> TraceByIgnoringC m a
*> :: TraceByIgnoringC m a
-> TraceByIgnoringC m b -> TraceByIgnoringC m b
$c*> :: forall (m :: * -> *) a b.
Applicative m =>
TraceByIgnoringC m a
-> TraceByIgnoringC m b -> TraceByIgnoringC m b
liftA2 :: (a -> b -> c)
-> TraceByIgnoringC m a
-> TraceByIgnoringC m b
-> TraceByIgnoringC m c
$cliftA2 :: forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> TraceByIgnoringC m a
-> TraceByIgnoringC m b
-> TraceByIgnoringC m c
<*> :: TraceByIgnoringC m (a -> b)
-> TraceByIgnoringC m a -> TraceByIgnoringC m b
$c<*> :: forall (m :: * -> *) a b.
Applicative m =>
TraceByIgnoringC m (a -> b)
-> TraceByIgnoringC m a -> TraceByIgnoringC m b
pure :: a -> TraceByIgnoringC m a
$cpure :: forall (m :: * -> *) a. Applicative m => a -> TraceByIgnoringC m a
$cp1Applicative :: forall (m :: * -> *). Applicative m => Functor (TraceByIgnoringC m)
Applicative, a -> TraceByIgnoringC m b -> TraceByIgnoringC m a
(a -> b) -> TraceByIgnoringC m a -> TraceByIgnoringC m b
(forall a b.
(a -> b) -> TraceByIgnoringC m a -> TraceByIgnoringC m b)
-> (forall a b. a -> TraceByIgnoringC m b -> TraceByIgnoringC m a)
-> Functor (TraceByIgnoringC m)
forall a b. a -> TraceByIgnoringC m b -> TraceByIgnoringC m a
forall a b.
(a -> b) -> TraceByIgnoringC m a -> TraceByIgnoringC m b
forall (m :: * -> *) a b.
Functor m =>
a -> TraceByIgnoringC m b -> TraceByIgnoringC m a
forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> TraceByIgnoringC m a -> TraceByIgnoringC m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> TraceByIgnoringC m b -> TraceByIgnoringC m a
$c<$ :: forall (m :: * -> *) a b.
Functor m =>
a -> TraceByIgnoringC m b -> TraceByIgnoringC m a
fmap :: (a -> b) -> TraceByIgnoringC m a -> TraceByIgnoringC m b
$cfmap :: forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> TraceByIgnoringC m a -> TraceByIgnoringC m b
Functor, Applicative (TraceByIgnoringC m)
a -> TraceByIgnoringC m a
Applicative (TraceByIgnoringC m) =>
(forall a b.
TraceByIgnoringC m a
-> (a -> TraceByIgnoringC m b) -> TraceByIgnoringC m b)
-> (forall a b.
TraceByIgnoringC m a
-> TraceByIgnoringC m b -> TraceByIgnoringC m b)
-> (forall a. a -> TraceByIgnoringC m a)
-> Monad (TraceByIgnoringC m)
TraceByIgnoringC m a
-> (a -> TraceByIgnoringC m b) -> TraceByIgnoringC m b
TraceByIgnoringC m a
-> TraceByIgnoringC m b -> TraceByIgnoringC m b
forall a. a -> TraceByIgnoringC m a
forall a b.
TraceByIgnoringC m a
-> TraceByIgnoringC m b -> TraceByIgnoringC m b
forall a b.
TraceByIgnoringC m a
-> (a -> TraceByIgnoringC m b) -> TraceByIgnoringC m b
forall (m :: * -> *). Monad m => Applicative (TraceByIgnoringC m)
forall (m :: * -> *) a. Monad m => a -> TraceByIgnoringC m a
forall (m :: * -> *) a b.
Monad m =>
TraceByIgnoringC m a
-> TraceByIgnoringC m b -> TraceByIgnoringC m b
forall (m :: * -> *) a b.
Monad m =>
TraceByIgnoringC m a
-> (a -> TraceByIgnoringC m b) -> TraceByIgnoringC 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 -> TraceByIgnoringC m a
$creturn :: forall (m :: * -> *) a. Monad m => a -> TraceByIgnoringC m a
>> :: TraceByIgnoringC m a
-> TraceByIgnoringC m b -> TraceByIgnoringC m b
$c>> :: forall (m :: * -> *) a b.
Monad m =>
TraceByIgnoringC m a
-> TraceByIgnoringC m b -> TraceByIgnoringC m b
>>= :: TraceByIgnoringC m a
-> (a -> TraceByIgnoringC m b) -> TraceByIgnoringC m b
$c>>= :: forall (m :: * -> *) a b.
Monad m =>
TraceByIgnoringC m a
-> (a -> TraceByIgnoringC m b) -> TraceByIgnoringC m b
$cp1Monad :: forall (m :: * -> *). Monad m => Applicative (TraceByIgnoringC m)
Monad, Monad (TraceByIgnoringC m)
Monad (TraceByIgnoringC m) =>
(forall a. String -> TraceByIgnoringC m a)
-> MonadFail (TraceByIgnoringC m)
String -> TraceByIgnoringC m a
forall a. String -> TraceByIgnoringC m a
forall (m :: * -> *).
Monad m =>
(forall a. String -> m a) -> MonadFail m
forall (m :: * -> *). MonadFail m => Monad (TraceByIgnoringC m)
forall (m :: * -> *) a.
MonadFail m =>
String -> TraceByIgnoringC m a
fail :: String -> TraceByIgnoringC m a
$cfail :: forall (m :: * -> *) a.
MonadFail m =>
String -> TraceByIgnoringC m a
$cp1MonadFail :: forall (m :: * -> *). MonadFail m => Monad (TraceByIgnoringC m)
Fail.MonadFail, Monad (TraceByIgnoringC m)
Monad (TraceByIgnoringC m) =>
(forall a. (a -> TraceByIgnoringC m a) -> TraceByIgnoringC m a)
-> MonadFix (TraceByIgnoringC m)
(a -> TraceByIgnoringC m a) -> TraceByIgnoringC m a
forall a. (a -> TraceByIgnoringC m a) -> TraceByIgnoringC m a
forall (m :: * -> *).
Monad m =>
(forall a. (a -> m a) -> m a) -> MonadFix m
forall (m :: * -> *). MonadFix m => Monad (TraceByIgnoringC m)
forall (m :: * -> *) a.
MonadFix m =>
(a -> TraceByIgnoringC m a) -> TraceByIgnoringC m a
mfix :: (a -> TraceByIgnoringC m a) -> TraceByIgnoringC m a
$cmfix :: forall (m :: * -> *) a.
MonadFix m =>
(a -> TraceByIgnoringC m a) -> TraceByIgnoringC m a
$cp1MonadFix :: forall (m :: * -> *). MonadFix m => Monad (TraceByIgnoringC m)
MonadFix, Monad (TraceByIgnoringC m)
Monad (TraceByIgnoringC m) =>
(forall a. IO a -> TraceByIgnoringC m a)
-> MonadIO (TraceByIgnoringC m)
IO a -> TraceByIgnoringC m a
forall a. IO a -> TraceByIgnoringC m a
forall (m :: * -> *).
Monad m =>
(forall a. IO a -> m a) -> MonadIO m
forall (m :: * -> *). MonadIO m => Monad (TraceByIgnoringC m)
forall (m :: * -> *) a. MonadIO m => IO a -> TraceByIgnoringC m a
liftIO :: IO a -> TraceByIgnoringC m a
$cliftIO :: forall (m :: * -> *) a. MonadIO m => IO a -> TraceByIgnoringC m a
$cp1MonadIO :: forall (m :: * -> *). MonadIO m => Monad (TraceByIgnoringC m)
MonadIO, Monad (TraceByIgnoringC m)
Alternative (TraceByIgnoringC m)
TraceByIgnoringC m a
(Alternative (TraceByIgnoringC m), Monad (TraceByIgnoringC m)) =>
(forall a. TraceByIgnoringC m a)
-> (forall a.
TraceByIgnoringC m a
-> TraceByIgnoringC m a -> TraceByIgnoringC m a)
-> MonadPlus (TraceByIgnoringC m)
TraceByIgnoringC m a
-> TraceByIgnoringC m a -> TraceByIgnoringC m a
forall a. TraceByIgnoringC m a
forall a.
TraceByIgnoringC m a
-> TraceByIgnoringC m a -> TraceByIgnoringC m a
forall (m :: * -> *).
(Alternative m, Monad m) =>
(forall a. m a) -> (forall a. m a -> m a -> m a) -> MonadPlus m
forall (m :: * -> *). MonadPlus m => Monad (TraceByIgnoringC m)
forall (m :: * -> *).
MonadPlus m =>
Alternative (TraceByIgnoringC m)
forall (m :: * -> *) a. MonadPlus m => TraceByIgnoringC m a
forall (m :: * -> *) a.
MonadPlus m =>
TraceByIgnoringC m a
-> TraceByIgnoringC m a -> TraceByIgnoringC m a
mplus :: TraceByIgnoringC m a
-> TraceByIgnoringC m a -> TraceByIgnoringC m a
$cmplus :: forall (m :: * -> *) a.
MonadPlus m =>
TraceByIgnoringC m a
-> TraceByIgnoringC m a -> TraceByIgnoringC m a
mzero :: TraceByIgnoringC m a
$cmzero :: forall (m :: * -> *) a. MonadPlus m => TraceByIgnoringC m a
$cp2MonadPlus :: forall (m :: * -> *). MonadPlus m => Monad (TraceByIgnoringC m)
$cp1MonadPlus :: forall (m :: * -> *).
MonadPlus m =>
Alternative (TraceByIgnoringC m)
MonadPlus)
instance MonadTrans TraceByIgnoringC where
lift :: m a -> TraceByIgnoringC m a
lift = m a -> TraceByIgnoringC m a
forall (m :: * -> *) a. m a -> TraceByIgnoringC m a
TraceByIgnoringC
{-# INLINE lift #-}
instance Carrier sig m => Carrier (Trace :+: sig) (TraceByIgnoringC m) where
eff :: (:+:) Trace sig (TraceByIgnoringC m) a -> TraceByIgnoringC m a
eff (L trace :: Trace (TraceByIgnoringC m) a
trace) = Trace (TraceByIgnoringC m) a -> TraceByIgnoringC m a
forall (m :: * -> *) k. Trace m k -> m k
traceCont Trace (TraceByIgnoringC m) a
trace
eff (R other :: sig (TraceByIgnoringC m) a
other) = m a -> TraceByIgnoringC m a
forall (m :: * -> *) a. m a -> TraceByIgnoringC m a
TraceByIgnoringC (sig m a -> m a
forall (sig :: (* -> *) -> * -> *) (m :: * -> *) a.
Carrier sig m =>
sig m a -> m a
eff (sig (TraceByIgnoringC m) a -> sig m a
forall (sig :: (* -> *) -> * -> *) (f :: * -> *) (g :: * -> *) a.
(HFunctor sig, Functor f, Coercible f g) =>
sig f a -> sig g a
handleCoercible sig (TraceByIgnoringC m) a
other))
{-# INLINE eff #-}
runTraceByReturning :: Functor m => TraceByReturningC m a -> m ([String], a)
runTraceByReturning :: TraceByReturningC m a -> m ([String], a)
runTraceByReturning = (([String], a) -> ([String], a))
-> m ([String], a) -> m ([String], a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (([String] -> [String]) -> ([String], a) -> ([String], a)
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first [String] -> [String]
forall a. [a] -> [a]
reverse) (m ([String], a) -> m ([String], a))
-> (TraceByReturningC m a -> m ([String], a))
-> TraceByReturningC m a
-> m ([String], a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [String] -> StateC [String] m a -> m ([String], a)
forall s (m :: * -> *) a. s -> StateC s m a -> m (s, a)
runState [] (StateC [String] m a -> m ([String], a))
-> (TraceByReturningC m a -> StateC [String] m a)
-> TraceByReturningC m a
-> m ([String], a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TraceByReturningC m a -> StateC [String] m a
forall (m :: * -> *) a.
TraceByReturningC m a -> StateC [String] m a
runTraceByReturningC
newtype TraceByReturningC m a = TraceByReturningC { TraceByReturningC m a -> StateC [String] m a
runTraceByReturningC :: StateC [String] m a }
deriving newtype (Applicative (TraceByReturningC m)
TraceByReturningC m a
Applicative (TraceByReturningC m) =>
(forall a. TraceByReturningC m a)
-> (forall a.
TraceByReturningC m a
-> TraceByReturningC m a -> TraceByReturningC m a)
-> (forall a. TraceByReturningC m a -> TraceByReturningC m [a])
-> (forall a. TraceByReturningC m a -> TraceByReturningC m [a])
-> Alternative (TraceByReturningC m)
TraceByReturningC m a
-> TraceByReturningC m a -> TraceByReturningC m a
TraceByReturningC m a -> TraceByReturningC m [a]
TraceByReturningC m a -> TraceByReturningC m [a]
forall a. TraceByReturningC m a
forall a. TraceByReturningC m a -> TraceByReturningC m [a]
forall a.
TraceByReturningC m a
-> TraceByReturningC m a -> TraceByReturningC m a
forall (f :: * -> *).
Applicative f =>
(forall a. f a)
-> (forall a. f a -> f a -> f a)
-> (forall a. f a -> f [a])
-> (forall a. f a -> f [a])
-> Alternative f
forall (m :: * -> *).
(Alternative m, Monad m) =>
Applicative (TraceByReturningC m)
forall (m :: * -> *) a.
(Alternative m, Monad m) =>
TraceByReturningC m a
forall (m :: * -> *) a.
(Alternative m, Monad m) =>
TraceByReturningC m a -> TraceByReturningC m [a]
forall (m :: * -> *) a.
(Alternative m, Monad m) =>
TraceByReturningC m a
-> TraceByReturningC m a -> TraceByReturningC m a
many :: TraceByReturningC m a -> TraceByReturningC m [a]
$cmany :: forall (m :: * -> *) a.
(Alternative m, Monad m) =>
TraceByReturningC m a -> TraceByReturningC m [a]
some :: TraceByReturningC m a -> TraceByReturningC m [a]
$csome :: forall (m :: * -> *) a.
(Alternative m, Monad m) =>
TraceByReturningC m a -> TraceByReturningC m [a]
<|> :: TraceByReturningC m a
-> TraceByReturningC m a -> TraceByReturningC m a
$c<|> :: forall (m :: * -> *) a.
(Alternative m, Monad m) =>
TraceByReturningC m a
-> TraceByReturningC m a -> TraceByReturningC m a
empty :: TraceByReturningC m a
$cempty :: forall (m :: * -> *) a.
(Alternative m, Monad m) =>
TraceByReturningC m a
$cp1Alternative :: forall (m :: * -> *).
(Alternative m, Monad m) =>
Applicative (TraceByReturningC m)
Alternative, Functor (TraceByReturningC m)
a -> TraceByReturningC m a
Functor (TraceByReturningC m) =>
(forall a. a -> TraceByReturningC m a)
-> (forall a b.
TraceByReturningC m (a -> b)
-> TraceByReturningC m a -> TraceByReturningC m b)
-> (forall a b c.
(a -> b -> c)
-> TraceByReturningC m a
-> TraceByReturningC m b
-> TraceByReturningC m c)
-> (forall a b.
TraceByReturningC m a
-> TraceByReturningC m b -> TraceByReturningC m b)
-> (forall a b.
TraceByReturningC m a
-> TraceByReturningC m b -> TraceByReturningC m a)
-> Applicative (TraceByReturningC m)
TraceByReturningC m a
-> TraceByReturningC m b -> TraceByReturningC m b
TraceByReturningC m a
-> TraceByReturningC m b -> TraceByReturningC m a
TraceByReturningC m (a -> b)
-> TraceByReturningC m a -> TraceByReturningC m b
(a -> b -> c)
-> TraceByReturningC m a
-> TraceByReturningC m b
-> TraceByReturningC m c
forall a. a -> TraceByReturningC m a
forall a b.
TraceByReturningC m a
-> TraceByReturningC m b -> TraceByReturningC m a
forall a b.
TraceByReturningC m a
-> TraceByReturningC m b -> TraceByReturningC m b
forall a b.
TraceByReturningC m (a -> b)
-> TraceByReturningC m a -> TraceByReturningC m b
forall a b c.
(a -> b -> c)
-> TraceByReturningC m a
-> TraceByReturningC m b
-> TraceByReturningC m c
forall (m :: * -> *). Monad m => Functor (TraceByReturningC m)
forall (m :: * -> *) a. Monad m => a -> TraceByReturningC m a
forall (m :: * -> *) a b.
Monad m =>
TraceByReturningC m a
-> TraceByReturningC m b -> TraceByReturningC m a
forall (m :: * -> *) a b.
Monad m =>
TraceByReturningC m a
-> TraceByReturningC m b -> TraceByReturningC m b
forall (m :: * -> *) a b.
Monad m =>
TraceByReturningC m (a -> b)
-> TraceByReturningC m a -> TraceByReturningC m b
forall (m :: * -> *) a b c.
Monad m =>
(a -> b -> c)
-> TraceByReturningC m a
-> TraceByReturningC m b
-> TraceByReturningC 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
<* :: TraceByReturningC m a
-> TraceByReturningC m b -> TraceByReturningC m a
$c<* :: forall (m :: * -> *) a b.
Monad m =>
TraceByReturningC m a
-> TraceByReturningC m b -> TraceByReturningC m a
*> :: TraceByReturningC m a
-> TraceByReturningC m b -> TraceByReturningC m b
$c*> :: forall (m :: * -> *) a b.
Monad m =>
TraceByReturningC m a
-> TraceByReturningC m b -> TraceByReturningC m b
liftA2 :: (a -> b -> c)
-> TraceByReturningC m a
-> TraceByReturningC m b
-> TraceByReturningC m c
$cliftA2 :: forall (m :: * -> *) a b c.
Monad m =>
(a -> b -> c)
-> TraceByReturningC m a
-> TraceByReturningC m b
-> TraceByReturningC m c
<*> :: TraceByReturningC m (a -> b)
-> TraceByReturningC m a -> TraceByReturningC m b
$c<*> :: forall (m :: * -> *) a b.
Monad m =>
TraceByReturningC m (a -> b)
-> TraceByReturningC m a -> TraceByReturningC m b
pure :: a -> TraceByReturningC m a
$cpure :: forall (m :: * -> *) a. Monad m => a -> TraceByReturningC m a
$cp1Applicative :: forall (m :: * -> *). Monad m => Functor (TraceByReturningC m)
Applicative, a -> TraceByReturningC m b -> TraceByReturningC m a
(a -> b) -> TraceByReturningC m a -> TraceByReturningC m b
(forall a b.
(a -> b) -> TraceByReturningC m a -> TraceByReturningC m b)
-> (forall a b.
a -> TraceByReturningC m b -> TraceByReturningC m a)
-> Functor (TraceByReturningC m)
forall a b. a -> TraceByReturningC m b -> TraceByReturningC m a
forall a b.
(a -> b) -> TraceByReturningC m a -> TraceByReturningC m b
forall (m :: * -> *) a b.
Functor m =>
a -> TraceByReturningC m b -> TraceByReturningC m a
forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> TraceByReturningC m a -> TraceByReturningC m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> TraceByReturningC m b -> TraceByReturningC m a
$c<$ :: forall (m :: * -> *) a b.
Functor m =>
a -> TraceByReturningC m b -> TraceByReturningC m a
fmap :: (a -> b) -> TraceByReturningC m a -> TraceByReturningC m b
$cfmap :: forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> TraceByReturningC m a -> TraceByReturningC m b
Functor, Applicative (TraceByReturningC m)
a -> TraceByReturningC m a
Applicative (TraceByReturningC m) =>
(forall a b.
TraceByReturningC m a
-> (a -> TraceByReturningC m b) -> TraceByReturningC m b)
-> (forall a b.
TraceByReturningC m a
-> TraceByReturningC m b -> TraceByReturningC m b)
-> (forall a. a -> TraceByReturningC m a)
-> Monad (TraceByReturningC m)
TraceByReturningC m a
-> (a -> TraceByReturningC m b) -> TraceByReturningC m b
TraceByReturningC m a
-> TraceByReturningC m b -> TraceByReturningC m b
forall a. a -> TraceByReturningC m a
forall a b.
TraceByReturningC m a
-> TraceByReturningC m b -> TraceByReturningC m b
forall a b.
TraceByReturningC m a
-> (a -> TraceByReturningC m b) -> TraceByReturningC m b
forall (m :: * -> *). Monad m => Applicative (TraceByReturningC m)
forall (m :: * -> *) a. Monad m => a -> TraceByReturningC m a
forall (m :: * -> *) a b.
Monad m =>
TraceByReturningC m a
-> TraceByReturningC m b -> TraceByReturningC m b
forall (m :: * -> *) a b.
Monad m =>
TraceByReturningC m a
-> (a -> TraceByReturningC m b) -> TraceByReturningC 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 -> TraceByReturningC m a
$creturn :: forall (m :: * -> *) a. Monad m => a -> TraceByReturningC m a
>> :: TraceByReturningC m a
-> TraceByReturningC m b -> TraceByReturningC m b
$c>> :: forall (m :: * -> *) a b.
Monad m =>
TraceByReturningC m a
-> TraceByReturningC m b -> TraceByReturningC m b
>>= :: TraceByReturningC m a
-> (a -> TraceByReturningC m b) -> TraceByReturningC m b
$c>>= :: forall (m :: * -> *) a b.
Monad m =>
TraceByReturningC m a
-> (a -> TraceByReturningC m b) -> TraceByReturningC m b
$cp1Monad :: forall (m :: * -> *). Monad m => Applicative (TraceByReturningC m)
Monad, Monad (TraceByReturningC m)
Monad (TraceByReturningC m) =>
(forall a. String -> TraceByReturningC m a)
-> MonadFail (TraceByReturningC m)
String -> TraceByReturningC m a
forall a. String -> TraceByReturningC m a
forall (m :: * -> *).
Monad m =>
(forall a. String -> m a) -> MonadFail m
forall (m :: * -> *). MonadFail m => Monad (TraceByReturningC m)
forall (m :: * -> *) a.
MonadFail m =>
String -> TraceByReturningC m a
fail :: String -> TraceByReturningC m a
$cfail :: forall (m :: * -> *) a.
MonadFail m =>
String -> TraceByReturningC m a
$cp1MonadFail :: forall (m :: * -> *). MonadFail m => Monad (TraceByReturningC m)
Fail.MonadFail, Monad (TraceByReturningC m)
Monad (TraceByReturningC m) =>
(forall a. (a -> TraceByReturningC m a) -> TraceByReturningC m a)
-> MonadFix (TraceByReturningC m)
(a -> TraceByReturningC m a) -> TraceByReturningC m a
forall a. (a -> TraceByReturningC m a) -> TraceByReturningC m a
forall (m :: * -> *).
Monad m =>
(forall a. (a -> m a) -> m a) -> MonadFix m
forall (m :: * -> *). MonadFix m => Monad (TraceByReturningC m)
forall (m :: * -> *) a.
MonadFix m =>
(a -> TraceByReturningC m a) -> TraceByReturningC m a
mfix :: (a -> TraceByReturningC m a) -> TraceByReturningC m a
$cmfix :: forall (m :: * -> *) a.
MonadFix m =>
(a -> TraceByReturningC m a) -> TraceByReturningC m a
$cp1MonadFix :: forall (m :: * -> *). MonadFix m => Monad (TraceByReturningC m)
MonadFix, Monad (TraceByReturningC m)
Monad (TraceByReturningC m) =>
(forall a. IO a -> TraceByReturningC m a)
-> MonadIO (TraceByReturningC m)
IO a -> TraceByReturningC m a
forall a. IO a -> TraceByReturningC m a
forall (m :: * -> *).
Monad m =>
(forall a. IO a -> m a) -> MonadIO m
forall (m :: * -> *). MonadIO m => Monad (TraceByReturningC m)
forall (m :: * -> *) a. MonadIO m => IO a -> TraceByReturningC m a
liftIO :: IO a -> TraceByReturningC m a
$cliftIO :: forall (m :: * -> *) a. MonadIO m => IO a -> TraceByReturningC m a
$cp1MonadIO :: forall (m :: * -> *). MonadIO m => Monad (TraceByReturningC m)
MonadIO, Monad (TraceByReturningC m)
Alternative (TraceByReturningC m)
TraceByReturningC m a
(Alternative (TraceByReturningC m), Monad (TraceByReturningC m)) =>
(forall a. TraceByReturningC m a)
-> (forall a.
TraceByReturningC m a
-> TraceByReturningC m a -> TraceByReturningC m a)
-> MonadPlus (TraceByReturningC m)
TraceByReturningC m a
-> TraceByReturningC m a -> TraceByReturningC m a
forall a. TraceByReturningC m a
forall a.
TraceByReturningC m a
-> TraceByReturningC m a -> TraceByReturningC m a
forall (m :: * -> *).
(Alternative m, Monad m) =>
Monad (TraceByReturningC m)
forall (m :: * -> *).
(Alternative m, Monad m) =>
Alternative (TraceByReturningC m)
forall (m :: * -> *).
(Alternative m, Monad m) =>
(forall a. m a) -> (forall a. m a -> m a -> m a) -> MonadPlus m
forall (m :: * -> *) a.
(Alternative m, Monad m) =>
TraceByReturningC m a
forall (m :: * -> *) a.
(Alternative m, Monad m) =>
TraceByReturningC m a
-> TraceByReturningC m a -> TraceByReturningC m a
mplus :: TraceByReturningC m a
-> TraceByReturningC m a -> TraceByReturningC m a
$cmplus :: forall (m :: * -> *) a.
(Alternative m, Monad m) =>
TraceByReturningC m a
-> TraceByReturningC m a -> TraceByReturningC m a
mzero :: TraceByReturningC m a
$cmzero :: forall (m :: * -> *) a.
(Alternative m, Monad m) =>
TraceByReturningC m a
$cp2MonadPlus :: forall (m :: * -> *).
(Alternative m, Monad m) =>
Monad (TraceByReturningC m)
$cp1MonadPlus :: forall (m :: * -> *).
(Alternative m, Monad m) =>
Alternative (TraceByReturningC m)
MonadPlus, m a -> TraceByReturningC m a
(forall (m :: * -> *) a. Monad m => m a -> TraceByReturningC m a)
-> MonadTrans TraceByReturningC
forall (m :: * -> *) a. Monad m => m a -> TraceByReturningC m a
forall (t :: (* -> *) -> * -> *).
(forall (m :: * -> *) a. Monad m => m a -> t m a) -> MonadTrans t
lift :: m a -> TraceByReturningC m a
$clift :: forall (m :: * -> *) a. Monad m => m a -> TraceByReturningC m a
MonadTrans)
instance (Carrier sig m, Effect sig) => Carrier (Trace :+: sig) (TraceByReturningC m) where
eff :: (:+:) Trace sig (TraceByReturningC m) a -> TraceByReturningC m a
eff (L (Trace m :: String
m k :: TraceByReturningC m a
k)) = StateC [String] m () -> TraceByReturningC m ()
forall (m :: * -> *) a.
StateC [String] m a -> TraceByReturningC m a
TraceByReturningC (([String] -> [String]) -> StateC [String] m ()
forall s (sig :: (* -> *) -> * -> *) (m :: * -> *).
(Member (State s) sig, Carrier sig m) =>
(s -> s) -> m ()
modify (String
m String -> [String] -> [String]
forall a. a -> [a] -> [a]
:)) TraceByReturningC m ()
-> TraceByReturningC m a -> TraceByReturningC m a
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> TraceByReturningC m a
k
eff (R other :: sig (TraceByReturningC m) a
other) = StateC [String] m a -> TraceByReturningC m a
forall (m :: * -> *) a.
StateC [String] m a -> TraceByReturningC m a
TraceByReturningC ((:+:) (State [String]) sig (StateC [String] m) a
-> StateC [String] m a
forall (sig :: (* -> *) -> * -> *) (m :: * -> *) a.
Carrier sig m =>
sig m a -> m a
eff (sig (StateC [String] m) a
-> (:+:) (State [String]) sig (StateC [String] m) a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) k.
g m k -> (:+:) f g m k
R (sig (TraceByReturningC m) a -> sig (StateC [String] m) a
forall (sig :: (* -> *) -> * -> *) (f :: * -> *) (g :: * -> *) a.
(HFunctor sig, Functor f, Coercible f g) =>
sig f a -> sig g a
handleCoercible sig (TraceByReturningC m) a
other)))