Haskell Coding Practices
Application skill for Haskell style learning (from the archived awesome-guidelines style capsules). For GHC internals or specific linters (fourmolu vs stylish-haskell), follow project config first.
Core Principle
Haskell quality is explicit equational modules, typed total functions in pure core, strict data by default, IO pushed to the rim.
When to Use / NOT
- Haskell libraries, applications, and GHC-adjacent tools using Cabal/Stack.
- Setting up stylish-haskell/fourmolu, HLint,
-Wall -Werror, Haddock in CI.
NOT when:
- Pure FFI C fragments, use C practice skills for foreign code.
- TH/splice-generated-only modules, validate generators.
Workflow
- Layout, indent, cols, case (
haskell-style-formatting-layout.md).
- Modules, names, imports, Haddock (
haskell-style-naming-imports.md).
- Functions, sigs, totality, guards (
haskell-style-functions-control.md).
- Types/IO, strict data, boundaries (
haskell-style-types-io.md).
- Verify, formatter, HLint,
cabal build/stack test, Haddock on changed modules.
Red Flags
- Tabs or trailing whitespace
- Lines >80 without strong reason
- Missing Haddock on exports
- Unqualified Map/Set imports
- Blanket imports without explicit list
- Missing top-level type signatures on exports
head, tail, fromJust on untrusted input
- Brace-semicolon case layout
- Type synonyms for domain types
- Lazy record fields by default
- Pure/IO mixed without module seam
<- return instead of let
- Lazy read+write same file
- Over-point-free unreadable code
-Wall warnings ignored
String in new public API
- Commented-out dead code
- Debug
trace as user output
Verification
- stylish-haskell / fourmolu (project config)
- HLint with project rules
cabal build --ghc-options=-Wall or -Werror policy
- Haddock build for libraries
- Capsule checklist on export list + signatures
References
awesome-guidelines/references/haskell-style-learning-note.md
awesome-guidelines/references/haskell-style-formatting-layout.md
awesome-guidelines/references/haskell-style-naming-imports.md
awesome-guidelines/references/haskell-style-functions-control.md
awesome-guidelines/references/haskell-style-types-io.md
1---2name: haskell-coding-practices3description: Use when authoring or reviewing Haskell, 4-space/80-col layout, Haddock, explicit imports, type signatures, avoid partial functions, strict data, IO separation, and stylish-haskell/HLint/cabal test in CI.4---56# Haskell Coding Practices78Application skill for Haskell style learning (from the archived `awesome-guidelines` style capsules). For GHC internals or specific linters (fourmolu vs stylish-haskell), follow project config first.910## Core Principle1112Haskell quality is **explicit equational modules**, typed total functions in pure core, strict data by default, IO pushed to the rim.1314## When to Use / NOT1516- Haskell libraries, applications, and GHC-adjacent tools using Cabal/Stack.17- Setting up stylish-haskell/fourmolu, HLint, `-Wall -Werror`, Haddock in CI.1819**NOT when:**2021- Pure FFI C fragments, use C practice skills for foreign code.22- TH/splice-generated-only modules, validate generators.2324## Workflow25261. **Layout**, indent, cols, case (`haskell-style-formatting-layout.md`).272. **Modules**, names, imports, Haddock (`haskell-style-naming-imports.md`).283. **Functions**, sigs, totality, guards (`haskell-style-functions-control.md`).294. **Types/IO**, strict data, boundaries (`haskell-style-types-io.md`).305. **Verify**, formatter, HLint, `cabal build`/`stack test`, Haddock on changed modules.3132## Red Flags3334- Tabs or trailing whitespace35- Lines >80 without strong reason36- Missing Haddock on exports37- Unqualified Map/Set imports38- Blanket imports without explicit list39- Missing top-level type signatures on exports40- `head`, `tail`, `fromJust` on untrusted input41- Brace-semicolon case layout42- Type synonyms for domain types43- Lazy record fields by default44- Pure/IO mixed without module seam45- `<- return` instead of `let`46- Lazy read+write same file47- Over-point-free unreadable code48- `-Wall` warnings ignored49- `String` in new public API50- Commented-out dead code51- Debug `trace` as user output5253## Verification5455- stylish-haskell / fourmolu (project config)56- HLint with project rules57- `cabal build --ghc-options=-Wall` or `-Werror` policy58- Haddock build for libraries59- Capsule checklist on export list + signatures606162## References6364- `awesome-guidelines/references/haskell-style-learning-note.md`65- `awesome-guidelines/references/haskell-style-formatting-layout.md`66- `awesome-guidelines/references/haskell-style-naming-imports.md`67- `awesome-guidelines/references/haskell-style-functions-control.md`68- `awesome-guidelines/references/haskell-style-types-io.md`