Effect 3.11 has been released! This release includes a number of new features
and improvements. Here’s a summary of what’s new:
Effect.fn
The Effect.fn API allows you to create a function that is automatically traced, and also
attaches the location where the function was called to any error traces, helping you track the source of failures.
Example (Creating a traced function)
Let’s see it in action by exporting the traces to the console:
Example (Exporting traces to the console)
In the output below, you can see the location where the function was called.
Effect.fn with a pipeline
The Effect.fn API also acts as a pipe function, allowing you to create a pipeline after the function definition.
Example (Creating a traced function with a pipeline)
In this example, Effect.fn is used not only to define the traced function but also to create a pipeline by chaining Effect.delay after the function, adding a delay of “1 second” to the execution.
Context.Reference
You can now create a tag with a default value.
Example (Declaring a Tag with a default value)
In this example, you don’t have to explicitly provide the SpecialNumber implementation.
The default value is automatically used when the service is accessed.
Example (Overriding the default value)
In this example, the default value is overridden by providing a different implementation for the SpecialNumber service.
Effect.scopedWith
Effect.scopedWith allows you to create and use a Scope without adding it to the Effect’s requirements.
Time zone support in Cron
Cron expressions using the Cron module now support time zones. You can specify a time zone
when creating a cron instance when using Cron.make or Cron.parse.
BigDecimal updates
BigDecimal.toExponential added - format a BigDecimal as a string in exponential notation.
BigDecimal.fromNumber has been deprecated in favour of BigDecimal.unsafeFromNumber.
Micro runtime changes
Micro execution is now using a fiber-runtime based model. This results in the following benefits: