CodeVetter · Repo Unpack · Data flow
gcanti/fp-ts
Values enter through constructors, conversion functions, or caller-supplied effect functions. Tagged branches determine whether transformations continue, while instance arguments determine how generic algorithms combine results. Effects execute at explicit function invocation boundaries, and environments or state remain caller-provided values. Persistent file output appears in package tooling; the inspected library state mechanisms operate through tuples or process-local references.
- Option constructors produce {_tag:'Some',value} or the shared None object; Either constructors produce {_tag:'Left',left} or {_tag:'Right',right}, and branch checks inspect _tag.
- pipe applies transformations to an initial value in order; flow builds a composed function and passes the original arguments and this context to its first function.
- Json.parse sends a string through JSON.parse inside Either.tryCatch; successful data becomes Right<Json>, and the original thrown value becomes Left<unknown> through identity.
- IO.flatMap creates a thunk that invokes ma(), feeds its value to f, then invokes the returned IO; Task.flatMap performs the corresponding sequence through Promise.then.
- TaskEither.flatMap delegates to EitherT.flatMap(Task.Monad): the underlying effect resolves first, Left is lifted unchanged, and only Right is passed to the continuation.
- ReaderTaskEither's continuation types intersect required environments and union errors; its underlying ReaderTask/ReaderT sequencing supplies the same environment to both computation stages.
- State.flatMap threads the returned state into the next function without a hidden store; IORef.write/modify instead update the reference's private field when their IO thunks execute.
- Package output flows from package.json through FileSystem.readFile, Json.parse, removal of development metadata, and FileSystem.writeFile; filesystem callback errors become Left through taskify and reach run's error logger/exit code.