Installation
Install @oofp/core
Section titled “Install @oofp/core”npm install @oofp/core# orpnpm add @oofp/core# oryarn add @oofp/coreOptional Packages
Section titled “Optional Packages”Install additional packages as needed:
# Functional HTTP clientpnpm add @oofp/http
# Query cachepnpm add @oofp/query
# Saga patternpnpm add @oofp/saga
# React hooks (experimental)pnpm add @oofp/reactRequirements
Section titled “Requirements”- TypeScript 5.0 or higher
- Node.js 18 or higher (for ESM support)
"strict": truein yourtsconfig.jsonis recommended
Import Style
Section titled “Import Style”OOFP uses sub-path exports for tree-shaking. Always import from specific modules:
// Correct — tree-shakeableimport * as M from "@oofp/core/maybe";import * as E from "@oofp/core/either";import * as TE from "@oofp/core/task-either";import * as RTE from "@oofp/core/reader-task-either";import { pipe } from "@oofp/core/pipe";import { flow } from "@oofp/core/flow";The convention is to use short namespace aliases:
| Module | Alias |
|---|---|
maybe | M |
either | E |
task | T |
task-either | TE |
reader | R |
reader-task-either | RTE |
io | IO |
state | S |
list | L |
object | O |
string | Str |