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:

import { HttpClient, HttpClientRequest, HttpClientResponse } from "@effect/platform"
HttpClientRequest.get("/").pipe(
HttpClient.fetchOk,
HttpClientResponse.json,
)

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>.

import { ensure } from "effect/Array"
// lets say you are not 100% sure if it's a member or a collection
declare const someValue: {foo: string} | Array<{foo: string}>
// $ExpectType ({ foo: string })[]
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.

import { Tuple } from "effect"
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.

import { Chunk } from "effect"
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!