fp-go

Installation
SKILL.md

fp-go v2 — Functional Programming for Go

Critical Rules for Code Generation

  1. Import path is v2: always github.com/IBM/fp-go/v2/..., never github.com/IBM/fp-go/... (that is v1).
  2. Data-last: all operations return a function waiting for data. Write option.Map(f)(value), never option.Map(value, f).
  3. Non-inferrable type parameters come first: Map[B, A], Ap[B, A], Chain[B, A]. The compiler infers trailing params from arguments; leading params often need explicit annotation.
  4. Prefer Result over Either when the error type is Go's error. Result[A] is Either[error, A]. Same for ioresult over ioeither, readerioresult over readerioeither.
  5. IO values are lazy: IO[A] is func() A. They describe a computation — you must call () to execute. Don't forget the trailing ().
  6. Prefer point-free style: compose with F.Flow and F.Pipe instead of writing inline anonymous functions. If a transformation can be expressed as a composition of named functions, it should be. Point-free pipelines are idiomatic fp-go.

Generation Workflow

Two habits that matter more for fp-go than for idiomatic Go, because the library is low-frequency in training data and easy to misremember:

  1. Retrieve before generating. For any pattern not fully covered below — optics beyond simple lenses, traversals, concurrent combinators, the less-common monads — query the fp-go MCP server's search_examples / get_example tools (see the fp-go-mcp skill) for a real signature instead of recalling names like Chain / FlatMap / Bind from memory. Retrieve-then-generate beats generate-then-fix here.
  2. Compile before presenting. After writing fp-go code, run go build ./... and go vet ./..., then fix any import, type-parameter, or argument-order error and re-run until clean. The compiler is precise, low-ambiguity feedback, and most fp-go mistakes (wrong leading type param, data-first vs data-last) surface immediately.

Overview

Installs
2
Repository
ibm/fp-go
GitHub Stars
2.0K
First Seen
Jun 23, 2026
fp-go — ibm/fp-go