New Features
kyo-data
- Text: Optimized API for string manipulation that avoids copying the underlying char array.
- Schedule: A new data type for representing complex scheduling.
kyo-prelude
- Parse Effect: New effect with support for backtracking, lookahead, and cut operations. The Parse effect is implemented using
Var
to track parsing position andChoice
to evaluate multiple possible branches. The API is designed to provide a more intuitive experience by using an imperative-like approach for consuming inputs and evaluating alternatives, rather than composing parsers with special operators. The effect also supports incremental parsing through integration withStream
inParse.run
.
kyo-core
- Unsafe Queue and Channel: New protected
Unsafe
APIs added for both Queue and Channel. - Time Shift and Control: Clock introduces two new APIs:
Clock.withTimeControl
: Enables manual time controlClock.withTimeShift
: Allows speeding up or slowing down computation execution based on a factor Additionally,Timer
has been merged intoClock
, ensuring both time control methods work with scheduled execution. For example:Clock.withTimeShift(factor = 2)(Clock.repeatWithDelay(2.seconds)(computation))
will schedule the computation every 1 second of wall-clock time, as the shift doubles the time passage speed.
- Monotonic Clock: New
Clock.nowMonotonic
method provides results based onSystem.nanoTime
for improved precision in time measurement.Clock.stopwatch
has been updated to use this feature. - Isolated Locals: New functionality prevents Locals from being automatically inherited by forked fibers through
Local.initIsolated
. This mechanism provides fiber identity by ensuring isolated locals remain within a computationโs scope. - Reentrant Meters: Mutexes, semaphores, and rate limiters are now reentrant by default, with customization options to disable reentrancy. This feature uses isolated locals to track meters acquired by a fiber.
- Abort[Nothing] in Async: The
Async
effect now includesAbort[Nothing]
by default to handle unexpected failures (panics in Kyoโs terminology).
Other Changes
Timer
functionality has been moved toClock.repeat*
methods.- Added a new recommended compiler flag to ensure proper handling of Kyo computations.
- A bug was recently introduced in
Async.timeout
making interrupts not propagate correctly. This bug has been fixed and tests were added to ensure the feature works correctly withkyo-sttp
.