Home › Haskell › Haskell project AGENTS.md

Haskell project AGENTS.md

AGENTS.md for Haskell projects: cabal or stack commands, -Wall clean builds, total functions, newtypes and Text, explicit effects, hlint, formatting, and tests.

AGENTS.mdHaskell

How to use

Save this as AGENTS.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

Note: Review and test before use. Provided as is, without warranty. See Terms.

AGENTS.mdDownload  
# AGENTS.md: Haskell

## Commands
- Detect the tool: `stack.yaml` → `stack build --fast`, `stack test`; otherwise cabal → `cabal build all`, `cabal test all`. Use the resolver/`index-state` and GHC version the repo pins.
- Lint: `hlint src test app` · Format: the configured formatter (`fourmolu -i` or `ormolu -i`) on changed files only.
- Fast feedback: `ghcid` or `cabal repl` if configured.

## Code
- Builds are warning-free under the project's flags (`-Wall` and friends). Fix warnings; don't add `{-# OPTIONS_GHC -Wno-... #-}` to silence them.
- Total functions only: no `head`, `tail`, `fromJust`, `!!`, `read` or incomplete pattern matches in library code. Use `NonEmpty`, `listToMaybe`, `readMaybe`, and handle every constructor.
- `Text` (strict) for text and `ByteString` for bytes; `String` only at legacy edges. Enable `OverloadedStrings` where the project does.
- Model the domain with newtypes and sum types; make invalid states unrepresentable. Smart constructors return `Either Error a`.
- Follow the project's effect style (plain `IO` with a `ReaderT Env IO` app monad, mtl classes, or an effects library). Don't introduce a second style.
- Errors: expected failures are values (`Either`, `ExceptT` or the effect library's error); exceptions are for truly exceptional IO. Use `bracket`/`withFile`/`ResourceT` so resources are always released.
- Strictness: strict fields (`!`) or `StrictData` for long-lived records; use `foldl'`, never lazy `foldl` on big lists.
- Explicit export lists on modules; qualified imports for containers (`import qualified Data.Map.Strict as Map`).
- Add dependencies to the `.cabal`/`package.yaml` with sensible version bounds; keep the lockfile/freeze file updated.

## Tests
hspec or tasty in `test/`, with QuickCheck/Hedgehog properties for pure functions and round-trips (e.g. encode/decode).

## Done when
Build and tests pass with no new warnings and hlint clean on changed modules.

More: all Haskell rules · all AGENTS.md rules

Related rules

REST API design AGENTS.md

AGENTS.md for designing consistent HTTP/JSON APIs: resource naming, status codes, errors, pagination, and versioning.

AGENTS.mdAPI design

Blazor (.NET 10) AGENTS.md

AGENTS.md for Blazor Web Apps on .NET 10: render modes, components, forms and validation, state, and bUnit tests.

AGENTS.md.NET / ASP.NET Core

Celery background jobs AGENTS.md

AGENTS.md for Celery 5 task queues in Python/Django: idempotent tasks, retries, time limits, and safe enqueueing.

AGENTS.mdPython

Deno 2 AGENTS.md

AGENTS.md for Deno 2 projects: deno.json tasks, JSR and npm imports, permissions, and built-in tooling.

AGENTS.mdDeno

Effect TypeScript AGENTS.md

AGENTS.md for TypeScript codebases built on Effect: typed errors, services and Layers, Schema validation, resource safety, and @effect/vitest tests.

AGENTS.mdEffect (TypeScript)

Express 5 API AGENTS.md

AGENTS.md for Express 5 REST APIs in TypeScript with zod validation, error middleware, and supertest.

AGENTS.mdNode.js / TypeScript

Get the best new AI prompts every week

One short email a week: the best new prompts and rules for ChatGPT, Claude, Gemini, Midjourney, Cursor and more, plus what changed in the tools. Free, unsubscribe anytime.

Finishes on our newsletter page at beehiiv (opens in a new tab). Or subscribe directly.