v0.4.1 (8 April 2026)
Effect Handlers, Spring Observability, and Monad Transformer Enhancements
This release introduces algebraic effect handlers with annotation-driven code generation, delivers a complete payment processing example with four interpretation modes, adds FreePath for-comprehension support, extends Spring Boot integration with VTask/VStream metrics and virtual thread health monitoring, adds mapT to all monad transformers, and includes significant bug fixes for stack safety, traverse performance, and resilience patterns.
@EffectAlgebra- Annotation processor generating five classes per sealed interface: Kind marker + Witness, KindHelper, Functor (auto-detectsmapKfor CPS vs cast-through), Ops (smart constructors +Boundinner class), and abstract interpreter skeleton with exhaustiveswitchdispatch@ComposeEffects- Annotation processor generating composition infrastructure for 2-4 effect algebras:Injectfactory methods via right-nestedEitherF, composedFunctor,BoundSetrecord, andinterpret()bridge method@Handles- Compile-time validation that interpreter classes handle all operations in an effect algebra; reports missing handlers as errors and extra handlers as warnings- EitherF - Sum type for composing effect algebras via right-nesting, with
Injectfor embedding operations,Free.translatefor program transformation, andInterpreters.combine()for 2-4 effect dispatch - HandleError:
Free.HandleErrorwraps sub-programs with typed error recovery; delegates toMonadError.handleErrorWithwhen available, silently ignored otherwise. Supports subclass matching viaClass<E>token - ErrorOp - Effect algebra for typed error raising within Free programs, with
ErrorOps.raise()smart constructor andBound<E, G>for composed effects - StateOp - Optics-native state effect algebra with 6 operations (
View,Over,Assign,Preview,TraverseOver,GetState), CPS for correct functor mapping, andStateOpInterpreter/IOStateOpInterpreterinterpreters - ProgramAnalyser - Static analysis of Free program trees: counts instructions (
Suspend), recovery points (HandleError), parallel scopes (Ap), and opaque regions (FlatMapped). All counts are lower bounds. - Payment Processing - Complete worked example with 4 effect algebras, 13 interpreters across production (
IO), testing (Id), quote (fee estimation), and audit (WriterT) modes; 12 tests and 6 tutorials - Effect Handlers Introduction - Motivational documentation covering the DI gap, programs-as-data, DOP connection, terminology bridge mapping FP concepts to Java equivalents, and when-to-use guidance
- FreePath For-Comprehensions - FreePath as the 10th path type in the
ForPathsystem, withfrom(),let(),focus(),par(),traverse(),sequence(),flatTraverse(), andyield()steps - FreePath.attempt() - Captures outcome as
Either<Throwable, A>, mapping success toRightand handling errors asLeft - mapT - New method on all 6 monad transformers (
EitherT,MaybeT,OptionalT,WriterT,ReaderT,StateT) for transforming the outer monad layer without unwrapping. Custom AssertJ assertions added forWriterT,ReaderT, andStateT - VTask/VStream Metrics -
HkjMetricsServicerecords success/error counts and execution duration forVTaskPathReturnValueHandlerand element counts forVStreamPathReturnValueHandler; metrics exposed via/actuator/hkjendpoint - Virtual Thread Health Indicator - Spring Boot health indicator monitoring virtual thread availability with configurable threshold
- OpenRewrite Recipes -
AddHandleErrorCaseRecipefor missingHandleError/Apswitch cases,ConvertRawFreeToFreePathRecipeforFreePathmigration,DetectInjectBoilerplateRecipefor@ComposeEffectsadoption - FList - Lightweight immutable cons-list replacing O(n^2)
LinkedListcopy inListTraverse,StreamTraverse, andVStreamTraversewith O(n) cons accumulation - Free.foldMap stack safety: added trampolining to prevent
StackOverflowErroron deep program chains - FreeAp.foldMap stack safety: added trampolining for deep applicative trees
- CircuitBreaker: reset failure count on success in
HALF_OPENstate - ConstBifunctor: fix NPE in
second()by applying function to second element - IO.raceIO: fix
ClassCastExceptioninfirstVTaskSuccessfor checked exceptions - Lazy: add reentrant-call detection to prevent infinite recursion
- Bulkhead: add permit-release guard to prevent negative permits
- VStreamPar.merge: join background producer thread on close to prevent thread leak
- VStreamThrottle: replace dual
AtomicLongwithAtomicReference<WindowState>CAS loop - Free
Fparameter tightened fromWitnessArity<?>toWitnessArity<TypeArity.Unary>across the entire hierarchy, eliminating raw type usage - Additional edge case tests for
NavigatorClassGenerator,FocusProcessor, andForPathStepGenerator - JMH Benchmarks: 7 new benchmarks for EitherF dispatch, Free.translate, HandleError overhead, ProgramAnalyser traversal, and program construction cost