Skip to content

Effect 3.4 (Release)

Effect 3.4.0 has been released! This release includes a number of new features and improvements. Here’s a summary of what’s new:

The HTTP modules in @effect/platform have been reorganized to have a flat structure, similar to the effect package.

Instead of a single import, you now import the specific modules you need:

1
import { HttpClient, HttpClientRequest, HttpClientResponse } from "@effect/platform"
2
3
HttpClientRequest.get("/").pipe(
4
HttpClient.fetchOk,
5
HttpClientResponse.json,
6
)

The Micro module provides a lightweight alternative to Effect, for when bundle size really matters.

At a minimum, Micro adds 5kb gzipped to your bundle, and scales with the amount of features you use.

Micro is still experimental, and we’re looking for feedback on how it can be improved.

Array.ensure is an api that can be used to normalize A | ReadonlyArray<A> to Array<A>.

1
import { ensure } from "effect/Array"
2
3
// lets say you are not 100% sure if it's a member or a collection
4
declare const someValue: {foo: string} | Array<{foo: string}>
5
6
// $ExpectType ({ foo: string })[]
7
const normalized = ensure(someValue)
  • Option.liftPredicate is now dual, so it can be use data-first or data-last.
  • Either.liftPredicate has been added.
  • Effect.liftPredicate has been added.
  • Stream type accessors for Success, Error and Context have been added.
  • ManagedRuntime type accessors for Success and Context have been added.

The Tuple.at api can be used to retrieve an element at a specified index from a tuple.

1
import { Tuple } from "effect"
2
3
assert.deepStrictEqual(Tuple.at([1, 'hello', true], 1), 'hello')

If you have a NonEmptyChunk, you can use lastNonEmpty to directly get the last element without having to do a runtime check.

1
import { Chunk } from "effect"
2
3
const last = Chunk.lastNonEmpty(Chunk.of(1))

There were several other smaller changes made. Take a look through the CHANGELOG to see them all: CHANGELOG.

Don’t forget to join our Discord Community to follow the last updates and discuss every tiny detail!