module Control.Monad.Hefty.Log (
module Control.Monad.Hefty.Log,
module Data.Effect.Log,
)
where
import Colog.Core (LogAction (LogAction))
import Control.Monad.Hefty (Eff, interpret, send, type (<|), type (~>))
import Control.Monad.Hefty.Output (Output (..), output)
import Data.Effect.Log
import Prelude hiding (log)
runLogAsOutput :: (Output msg <| ef) => Eff eh (Log msg ': ef) ~> Eff eh ef
runLogAsOutput :: forall msg (ef :: [EffectF]) (eh :: [EffectH]).
(Output msg <| ef) =>
Eff eh (Log msg : ef) ~> Eff eh ef
runLogAsOutput = (Log msg ~> Eff eh ef) -> Eff eh (Log msg : ef) ~> Eff eh ef
forall (e :: EffectF) (ef :: [EffectF]) (eh :: [EffectH]).
(e ~> Eff eh ef) -> Eff eh (e : ef) ~> Eff eh ef
interpret \(Log msg
msg) -> msg -> Eff eh ef ()
forall o (f :: EffectF). SendFOE (Output o) f => o -> f ()
output msg
msg
runOutputAsLog :: (Log msg <| ef) => Eff eh (Output msg ': ef) ~> Eff eh ef
runOutputAsLog :: forall msg (ef :: [EffectF]) (eh :: [EffectH]).
(Log msg <| ef) =>
Eff eh (Output msg : ef) ~> Eff eh ef
runOutputAsLog = (Output msg ~> Eff eh ef) -> Eff eh (Output msg : ef) ~> Eff eh ef
forall (e :: EffectF) (ef :: [EffectF]) (eh :: [EffectH]).
(e ~> Eff eh ef) -> Eff eh (e : ef) ~> Eff eh ef
interpret \(Output msg
msg) -> msg -> Eff eh ef ()
forall msg (f :: EffectF). SendFOE (Log msg) f => msg -> f ()
log msg
msg
runLogAction :: LogAction (Eff eh ef) msg -> Eff eh (Log msg ': ef) ~> Eff eh ef
runLogAction :: forall (eh :: [EffectH]) (ef :: [EffectF]) msg.
LogAction (Eff eh ef) msg -> Eff eh (Log msg : ef) ~> Eff eh ef
runLogAction (LogAction msg -> Eff eh ef ()
f) = (Log msg ~> Eff eh ef) -> Eff eh (Log msg : ef) ~> Eff eh ef
forall (e :: EffectF) (ef :: [EffectF]) (eh :: [EffectH]).
(e ~> Eff eh ef) -> Eff eh (e : ef) ~> Eff eh ef
interpret \(Log msg
msg) -> msg -> Eff eh ef ()
f msg
msg
runLogActionEmbed :: (m <| ef) => LogAction m msg -> Eff eh (Log msg ': ef) ~> Eff eh ef
runLogActionEmbed :: forall (m :: EffectF) (ef :: [EffectF]) msg (eh :: [EffectH]).
(m <| ef) =>
LogAction m msg -> Eff eh (Log msg : ef) ~> Eff eh ef
runLogActionEmbed (LogAction msg -> m ()
f) = (Log msg ~> Eff eh ef) -> Eff eh (Log msg : ef) ~> Eff eh ef
forall (e :: EffectF) (ef :: [EffectF]) (eh :: [EffectH]).
(e ~> Eff eh ef) -> Eff eh (e : ef) ~> Eff eh ef
interpret \(Log msg
msg) -> m () -> Eff eh ef ()
m ~> Eff eh ef
forall (e :: EffectF) (ef :: [EffectF]) (eh :: [EffectH]).
(e <| ef) =>
e ~> Eff eh ef
send (m () -> Eff eh ef ()) -> m () -> Eff eh ef ()
forall a b. (a -> b) -> a -> b
$ msg -> m ()
f msg
msg