practical-haskell

Installation
SKILL.md

Practical Haskell (GHC)

Use this skill when the task is Haskell code quality, performance, or reasoning about evaluation. Assume GHC with optimizations (-O / -O2) unless the user says otherwise.

Core ideas

  • Purity lets the compiler rewrite code safely; prefer explicit effects in IO or appropriate abstraction.
  • Lazy by default: values are evaluated when needed. That enables composition but can hide space leaks.
  • Types catch many bugs early; use them to encode intent (including newtype for domain distinctions).
  • Know what GHC emits: when performance matters, treat Core (-ddump-simpl) as ground truth after optimization.

Always

  • Be explicit about strict vs lazy data and bindings when modeling accumulators, parsers, or long-lived state.
  • Prefer foldl' from Data.List (or strict folds from the right library) for numeric accumulation over plain foldl on strict values.
  • Profile (profiling, eventlog, ghc-debug, etc.) before micro-optimizing.
  • Write small composable functions; rely on inlining and specialization rather than giant monoliths.
  • Use fusion-friendly pipelines (map, filter, foldr-based idioms) where appropriate; validate hot paths in Core if allocation matters.
Related skills

More from kaynetik/skills

Installs
7
Repository
kaynetik/skills
First Seen
Mar 24, 2026