arrow-typed-errors
Arrow Typed Errors (Kotlin)
Quick start
- Classify the failure first: logical failure (typed error) vs exceptional failure (exception).
- Pick the surface type:
Raise<E>+ builder (either {}/option {}/nullable {}) for composable logic.- Wrapper type (
Either/Option/Ior/Result/nullable) for API boundaries.
- Read
references/typed-errors.mdfor API details and patterns before coding if unsure.
Workflow
- Model errors as sealed types.
- Implement happy-path logic with Raise DSL (prefer
either {}ornullable {}depending on output). - Guard invariants with
ensure/ensureNotNull. - Interop with external code:
- Use
catch/Either.catchOrThrowto convert expected exceptions into typed errors.
- Use
- Compose with
.bind()and transform errors withwithErrororrecover. - For validation across fields or lists, use accumulation (
zipOrAccumulate,mapOrAccumulate, oraccumulate). - Expose wrapper types at module boundaries; keep Raise internally when possible.
More from alexandru/skills
cats-effect-io
Scala functional programming with Cats Effect IO and typeclasses. Use for wrapping side effects, modeling purity, choosing Sync/Async/Temporal/Concurrent, handling blocking I/O, and composing resources, fibers, and concurrency safely.
40cats-effect-resource
Scala resource lifecycle management with Cats Effect `Resource` and `IO`. Use when defining safe acquisition/release, composing resources (including parallel acquisition), or designing resource-safe APIs and cancellation behavior for files, streams, pools, clients, and background fibers.
37cats-mtl-typed-errors
Scala typed errors with Cats MTL Raise/Handle and allow/rescue. Use for designing custom domain error types without EitherT, while keeping Cats Effect and ecosystem composition. Covers Scala 2/3 syntax and IO-only or F[_] usage.
24akka-streams
Scala reactive streaming with Akka Streams and Pekko Streams. Use for dataflow and reactive programming patterns, testing stream components, and understanding when NOT to use streams (prefer plain functions for transformations and I/O).
20kotlin-java-library
Kotlin design for Java libraries and Java consumers. Use when building Kotlin code intended for Java callers, aligning with Java interop, JVM annotations, records, and backward/binary compatibility rules.
14jspecify-nullness
JSpecify nullness annotations for Java APIs and tooling. Use when adopting or migrating JSpecify annotations, designing null-safe Java signatures and generics, or interpreting tool conformance and Kotlin interop.
13