一键导入
haskell-effectful
Effectful library conventions and decision rules. Use when writing effectful code, designing effects, or migrating from mtl.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Effectful library conventions and decision rules. Use when writing effectful code, designing effects, or migrating from mtl.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Build a Haskell project, interpret GHC errors, and apply safe fixes. Use when the user asks Codex to build Haskell code, fix compilation errors, or run cabal/stack build workflows.
Expert Haskell code review for idiomatic patterns, type safety, purity, error handling, and performance. Use when reviewing Haskell source files or PR changes.
Run and interpret Haskell test suites. Use when the user asks Codex to run HSpec, QuickCheck, Tasty, cabal test, stack test, or diagnose failing Haskell tests.
Servant client API wrapper conventions with two-layer error handling. Use when generating HTTP clients from Servant APIs, wrapping external service APIs, or integrating servant-client with effectful.
Servant web framework conventions using NamedRoutes record pattern. Use when building REST APIs, defining endpoints, writing handlers, or structuring Servant applications.
Idiomatic Haskell conventions and decision rules. Use when writing Haskell code, designing data types, or handling errors.
| name | haskell-effectful |
| description | Effectful library conventions and decision rules. Use when writing effectful code, designing effects, or migrating from mtl. |
Effectful.Reader.Static, Effectful.State.Static.Local)Always consistent: Reader -> State -> Error -> IOE
runApp :: Config -> AppState -> App a -> IO (Either (CallStack, AppError) (a, AppState))
runApp cfg st = runEff . runError . runStateLocal st . runReader cfg
makeEffect from Effectful.TH to auto-generate smart constructors and DispatchOf instancesError e :> es) or custom namingm parameter): use interpret_m parameter): use interpret + localSeqUnliftError constraints on GADT constructors, not on handler signatures -- caller decides error scopeliftEither helperrunErrorNoCallStack or runErrorWith at boundariesException on error newtypes for IO interopadapt helper pattern: liftIO + C.catch + localSeqUnlift for IO error conversionreinterpret + evalState with Map for testable filesystem-like effects-- CORRECT: Error constraint on GADT constructor
data FileSystem :: Effect where
ReadFile :: Error FsReadError :> es => FilePath -> FileSystem (Eff es) String
WriteFile :: Error FsWriteError :> es => FilePath -> String -> FileSystem (Eff es) ()
-- WRONG: Error constraint on handler
runFileSystemIO :: (IOE :> es, Error FsReadError :> es) => ...
ALWAYS use Effectful.Concurrent.*, NEVER Control.Concurrent.* with liftIO.
Error constraint to interpreter instead of effect definitionEither when errors should propagate via effectControl.Concurrent.* with liftIO instead of Effectful.Concurrent.*makeEffect on GADTs with effect constraints (manual definition required)For detailed code examples (dependency injection, testing, MTL migration, concurrency):
references/effectful-examples.md