Minor Changes
-
#2938
c0ce180
Thanks @LaureRC! - Make Option.liftPredicate dual -
#2938
61707b6
Thanks @LaureRC! - Add Effect.liftPredicateEffect.liftPredicate
transforms aPredicate
function into anEffect
returning the input value if the predicate returnstrue
or failing with specified error if the predicate fails.import { Effect } from "effect"; const isPositive = (n: number): boolean => n > 0; // succeeds with `1` Effect.liftPredicate(1, isPositive, (n) => `${n} is not positive`); // fails with `"0 is not positive"` Effect.liftPredicate(0, isPositive, (n) => `${n} is not positive`);
-
#2938
9c1b5b3
Thanks @tim-smart! - add EventListener type to Stream to avoid use of dom lib -
#2938
a35faf8
Thanks @gcanti! - AddlastNonEmpty
function toChunk
module, closes #2946 -
#2938
ff73c0c
Thanks @dilame! - feat(Stream): implement Success, Error, Context type accessors -
#2938
984d516
Thanks @tim-smart! - add Micro moduleA 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. -
#2938
8c3b8a2
Thanks @gcanti! - addManagedRuntime
type utils (Context
, andError
) -
#2938
91bf8a2
Thanks @msensys! - AddTuple.at
api, to retrieve an element at a specified index from a tuple.import { Tuple } from "effect"; assert.deepStrictEqual(Tuple.at([1, "hello", true], 1), "hello");
-
#2938
c6a4a26
Thanks @datner! - addensure
util for Array, used to normalizeA | ReadonlyArray<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);