import Effectful import Effectful.Dispatch.Static import qualified Katip as K -- | A Effect you can use to run logging actions. there is only one effect as we can't have duplicated instances. type KatipE :: Effect data KatipE m a type instance DispatchOf KatipE = Static WithSideEffects data instance StaticRep KatipE = MkKatipE !LogEnv !LogContexts !Namespace -- | Run a KatipE Effect without a 'Namespace' or a 'LogContexts'. This also calls closeScribes runKatipE ::forall es a. (IOE :> es) => LogEnv -> Eff (KatipE : es) a -> Eff es a runKatipE l act = evalStaticRep (MkKatipE l mempty mempty) act <* raise (liftIO (K.closeScribes l))