# Behavior traces — gcanti/fp-ts

> Canonical page: https://codevetter.com/unpack/fp-ts/behavior-traces

# Behavior traces — gcanti/fp-ts

Scanned commit c0a6472121c67a2b083e62fcff13e7d022e39d8f (2026-04-20). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

Eight source walks describe consumer and maintainer behavior without executing it. The primary consumer paths cover optional-value extraction, JSON decoding, asynchronous failures, concurrent and sequential traversal, cleanup, and mutable references. The package path follows compilation through generated artifact assembly. Each trace identifies execution order and the branch that changes subsequent work.
- Getting-started flow: inverse(2) constructs Some(0.5), pipe invokes Option.map to construct Some(50), then getOrElse extracts 50; inverse(0) produces None, skips map's callback, and evaluates the fallback. — [docs/guides/getting-started.md#L43-L59](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/docs/guides/getting-started.md#L43-L59) [src/Option.ts#L336-L337](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/src/Option.ts#L336-L337) [src/Option.ts#L871-L874](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/src/Option.ts#L871-L874) [src/function.ts#L665-L668](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/src/function.ts#L665-L668)
- JSON flow: Json.parse → Either.tryCatch → JSON.parse → right on success or left(identity(error)) on throw; a subsequent Either.map runs only for Right. — [src/Json.ts#L37-L37](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/src/Json.ts#L37-L37) [src/Either.ts#L1393-L1399](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/src/Either.ts#L1393-L1399) [src/Either.ts#L470-L471](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/src/Either.ts#L470-L471) [test/Json.ts#L7-L13](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/test/Json.ts#L7-L13)
- Promise flow: tryCatchK captures arguments and constructs tryCatch; invoking the returned TaskEither calls f, awaits its Promise, and converts rejection or synchronous throw to Left; flatMap then preserves Left or invokes the Right continuation. — [src/TaskEither.ts#L249-L271](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/src/TaskEither.ts#L249-L271) [src/TaskEither.ts#L535-L538](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/src/TaskEither.ts#L535-L538) [src/EitherT.ts#L336-L339](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/src/EitherT.ts#L336-L339) [test/TaskEither.ts#L551-L568](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/test/TaskEither.ts#L551-L568)
- Parallel traversal: TaskEither.traverseReadonlyArrayWithIndex chooses ApT for empty input; otherwise Task traversal starts every indexed thunk through Promise.all, then Either traversal collects Rights or selects the first Left in input order. — [src/TaskEither.ts#L1600-L1616](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/src/TaskEither.ts#L1600-L1616) [src/Task.ts#L526-L530](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/src/Task.ts#L526-L530) [src/Either.ts#L1581-L1597](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/src/Either.ts#L1581-L1597) [test/TaskEither.ts#L758-L774](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/test/TaskEither.ts#L758-L774)
- Sequential traversal: the Seq helper invokes f(0,head) first, chains each remaining element through a Promise reduction, appends successful values, and skips later f invocations once the accumulated result is Left. — [src/TaskEither.ts#L1624-L1655](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/src/TaskEither.ts#L1624-L1655) [test/TaskEither.ts#L776-L792](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/test/TaskEither.ts#L776-L792)
- Resource flow: bracket delegates to bracketW; failed acquisition skips use/release, successful acquisition executes use, then release receives its resolved Either; release Left overrides the use result, while successful release restores that result. — [src/TaskEither.ts#L1501-L1519](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/src/TaskEither.ts#L1501-L1519) [src/EitherT.ts#L336-L339](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/src/EitherT.ts#L336-L339) [test/TaskEither.ts#L356-L402](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/test/TaskEither.ts#L356-L402)
- Reference flow: newIORef(1) returns an allocation thunk; IO.flatMap invokes it, ref.write(2) returns a mutation thunk, the next IO.flatMap executes that write, and ref.read observes the updated private value. — [src/IORef.ts#L18-L51](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/src/IORef.ts#L18-L51) [src/IO.ts#L78-L86](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/src/IO.ts#L78-L86) [test/IORef.ts#L12-L20](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/test/IORef.ts#L12-L20)
- Build flow: npm's prebuild cleans dist, two tsc configurations emit JavaScript/declarations, then main runs copyPackageJson → copyFiles → makeModules → fixHKT('es6') → fixHKT('lib'); run invokes the assembled effect and sets the process exit code. — [package.json#L15-L18](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/package.json#L15-L18) [scripts/build.ts#L79-L111](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/scripts/build.ts#L79-L111) [scripts/run.ts#L4-L20](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/scripts/run.ts#L4-L20) [tsconfig.build-es6.json#L1-L7](https://github.com/gcanti/fp-ts/blob/c0a6472121c67a2b083e62fcff13e7d022e39d8f/tsconfig.build-es6.json#L1-L7)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
