haskell-effectfullisted
Install: claude install-skill ivelten/claude-haskell-skills
# Effect Management with `effectful`
Default to [`effectful`](https://hackage.haskell.org/package/effectful) for any non-trivial application. Don't use `mtl`, `polysemy`, or `fused-effects` unless the user asks — `effectful` is modern, fast, and avoids the `n²` instances problem of mtl-style stacks.
An effect declares an abstract capability (operations the program needs) without committing to an implementation; an interpreter binds those operations to concrete code. Production and tests use different interpreters of the same effect, which is how the same business logic runs against Postgres in production and against an in-memory map in tests.
## The pattern
```haskell
import Effectful
import Effectful.Reader.Static (Reader, runReader, ask)
import Effectful.Error.Static (Error, runError, throwError)
-- Domain effect, defined as a data type (needs GADTs + TypeFamilies)
data UserStore :: Effect where
GetUser :: UserId -> UserStore m (Maybe User)
SaveUser :: User -> UserStore m ()
type instance DispatchOf UserStore = Dynamic
-- Smart constructors
getUser :: UserStore :> es => UserId -> Eff es (Maybe User)
getUser uid = send (GetUser uid)
saveUser :: UserStore :> es => User -> Eff es ()
saveUser u = send (SaveUser u)
-- Business logic is polymorphic over the effect set
registerUser
:: (UserStore :> es, Error AppError :> es)
=> Email -> Eff es User
registerUser email = ...
-- Interpreter for production
runUserStorePostgres
:: (IOE :> es, Reader DbPool :> e