fp-either-ref
Installation
SKILL.md
Either Quick Reference
Either = success or failure. Right(value) or Left(error).
When to Use
- You need a quick fp-ts reference for typed synchronous error handling.
- The task involves validation, fallible operations, or converting throwing code to
Either. - You want a compact cheat sheet rather than a long tutorial.
Create
import * as E from 'fp-ts/Either'
E.right(value) // Success
E.left(error) // Failure
E.fromNullable(err)(x) // null → Left(err), else Right(x)
E.tryCatch(fn, toError) // try/catch → Either