haskell-logginglisted
Install: claude install-skill ivelten/claude-haskell-skills
# Logging with `log-effectful`
Use [`log-effectful`](https://hackage.haskell.org/package/log-effectful) (with `log-base` as the underlying primitives). It's maintained alongside `effectful` and integrates as a native effect — no `MonadLogger` adapters, no instance gymnastics.
Other logging libraries (Katip, Blammo, monad-logger, co-log) are designed for mtl-style stacks; using them with `effectful` means writing or depending on adapter packages, which is friction this skill deliberately avoids.
## Dependencies
```cabal
build-depends:
, log-effectful ^>=1.0
, log-base ^>=0.12
```
## The pattern
Logging is just another effect in your effect list. Add `Log :> es` wherever you want to emit logs:
```haskell
{-# LANGUAGE OverloadedStrings #-}
import Effectful
import Effectful.Log
import Log (logAttention_, logInfo, logTrace_)
import Data.Aeson (object, (.=))
registerUser
:: ( UserStore :> es
, Log :> es
, Error RegistrationError :> es
)
=> Email -> Eff es User
registerUser email = do
logTrace_ "Starting registration"
existing <- getUser (emailToUserId email)
case existing of
Just _ -> do
logAttention_ ("Duplicate registration attempt: " <> coerce email)
throwError (EmailAlreadyExists email)
Nothing -> do
let user = newUser email
saveUser user
logInfo "User registered" $ object
[ "user_id" .= userId user
, "email" .= userEmail user
]
pure user
```
Two important convent