Last active
April 21, 2026 14:53
-
-
Save OlaoluwaM/ac545f6f3b2092b4ef3b46704dcb1c9d to your computer and use it in GitHub Desktop.
Setting up Blammo to be used with effectful
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# OPTIONS_GHC -Wno-missing-export-lists #-} | |
| module Redis.Effect.Logging where | |
| import Blammo.Logging.Simple qualified as Blammo | |
| import Effectful.Dispatch.Dynamic qualified as Eff | |
| import Effectful.TH qualified as Eff | |
| import Effectful (Eff, Effect, IOE, (:>)) | |
| data Logging :: Effect where | |
| LogInfo :: Blammo.Message -> Logging m () | |
| LogDebug :: Blammo.Message -> Logging m () | |
| LogWarn :: Blammo.Message -> Logging m () | |
| LogError :: Blammo.Message -> Logging m () | |
| Eff.makeEffect ''Logging | |
| runLoggingWithLogger :: (IOE :> es) => Blammo.Logger -> Eff (Logging ': es) a -> Eff es a | |
| runLoggingWithLogger logger = Eff.interpret_ $ \case | |
| LogInfo msg -> Blammo.runLoggerLoggingT logger $ Blammo.logInfo msg | |
| LogDebug msg -> Blammo.runLoggerLoggingT logger $ Blammo.logDebug msg | |
| LogWarn msg -> Blammo.runLoggerLoggingT logger $ Blammo.logWarn msg | |
| LogError msg -> Blammo.runLoggerLoggingT logger $ Blammo.logError msg | |
| -- Include other log functions here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment