CodeVetter · Repo Unpack · Extension points
gcanti/fp-ts
Extension primarily happens through TypeScript interfaces and explicit instance arguments. New data types register with HKT dictionaries, then provide operations satisfying the relevant type classes. Existing factories accept caller-defined equality, ordering, error combination, and output accumulation policies. Maintainer tooling also exposes an injectable filesystem boundary and automatically derives packaged module entries from compiler output.
- A new data type can add a URI key through URItoKind module augmentation and supply Functor1-style instances; the HKT guide demonstrates this with Identity and explains the lookup mechanism.
- Type classes support multiple constructor arities and constrained variants; Functor2 keeps E generic, whereas Functor2C fixes E and includes an _E witness.
- getApplicativeTaskValidation accepts a Task Apply instance and Semigroup<E>, allowing callers to choose execution policy and error concatenation instead of default first-error application.
- Eq.fromEquals, Eq.struct, Eq.tuple, and Ord.fromCompare let consumers define domain comparison policies; ReadonlyMap.upsertAt then uses supplied key equality to preserve an existing equivalent key.
- ReadonlyArray.traverseWithIndex accepts an Applicative and combines results through of/map/ap; sequenceT and sequenceS similarly receive Apply instances, so their execution semantics come from the supplied dictionary.
- FromEither interfaces expose a lifting operation across HKT arities; chainOptionK combines that capability with Chain and an onNone callback to derive effect-specific Option sequencing.
- Writer.getMonad receives a Monoid<W> and assembles Applicative/Chain behavior; getChain combines output from both stages using the caller's Semigroup.concat.
- Build computations receive a FileSystem environment that can be replaced structurally; module packaging derives names from dist/lib/*.js, excludes index, and writes per-module main/module/typings manifests.