using-fpdart
Installation
SKILL.md
Functional Programming with fpdart
Goal
Implement robust, type-safe, and predictable business logic using functional programming principles. Replace side-effect-prone imperative code with pure functions and composable monads (Option, Either, Task), ensuring that error handling and null-safety are enforced at the type level rather than through runtime exceptions.
Process
Phase 1: Basic Data Containment
Use primitives to handle common edge cases without branching logic:
Option<T>: ReplacesT?. UseOption.of(val)orOption.none(). Access viamatchorgetOrElse.Either<L, R>: Replacestry-catch.L(Left) is for errors,R(Right) is for success.Unit: Replacesvoidto allow functional composition.
Phase 2: Execution & Async Flow
Manage side effects and asynchronous operations through wrappers that defer execution:
IO<T>: Synchronous wrapper for pure/safe side effects.Task<T>: Asynchronous wrapper forFuturethat never fails.TaskEither<L, R>: The standard for API requests. ComposesFutureandEitherinto a single monadic flow.