Minor Changes
-
#4280
8baef83
Thanks @tim-smart! - add Promise based apis to Fiber{Handle,Set,Map} modules -
#4280
655bfe2
Thanks @gcanti! - AddEffect.transposeOption
, closes #3142.Converts an
Option
of anEffect
into anEffect
of anOption
.Details
This function transforms an
Option<Effect<A, E, R>>
into an
Effect<Option<A>, E, R>
. If theOption
isNone
, the resultingEffect
will immediately succeed with aNone
value. If theOption
isSome
, the
innerEffect
will be executed, and its result wrapped in aSome
.Example
import { Effect, Option } from "effect" // ┌─── Option<Effect<number, never, never>> // ▼ const maybe = Option.some(Effect.succeed(42)) // ┌─── Effect<Option<number>, never, never> // ▼ const result = Effect.transposeOption(maybe) console.log(Effect.runSync(result)) // Output: { _id: 'Option', _tag: 'Some', value: 42 }
-
#4280
d90cbc2
Thanks @indietyp! - AddEffect.whenLogLevel
, which conditionally executes an effect if the specified log level is enabled -
#4280
75632bd
Thanks @tim-smart! - add RcMap.touch, for reseting the idle timeout for an item -
#4280
bf865e5
Thanks @tim-smart! - allow accessing args in Effect.fn pipe -
#4280
f98b2b7
Thanks @tim-smart! - add RcMap.invalidate api, for removing a resource from an RcMap -
#4280
de8ce92
Thanks @mikearnaldi! - Add Layer.updateService mirroring Effect.updateService -
#4280
db426a5
Thanks @KhraksMamtsov! -Differ
implementsPipeable
-
#4280
6862444
Thanks @thewilkybarkid! - Make it easy to convert a DateTime.Zoned to a DateTime.Utc -
#4280
5fc8a90
Thanks @gcanti! - Add missingEither.void
constructor. -
#4280
546a492
Thanks @vinassefranche! - AddHashMap.toValues
andHashSet.toValues
getters -
#4280
65c4796
Thanks @tim-smart! - add {FiberHandle,FiberSet,FiberMap}.awaitEmpty apis -
#4280
9760fdc
Thanks @gcanti! - Schema: AddstandardSchemaV1
API to Generate a Standard Schema v1.Example
import { Schema } from "effect" const schema = Schema.Struct({ name: Schema.String }) // ┌─── StandardSchemaV1<{ readonly name: string; }> // ▼ const standardSchema = Schema.standardSchemaV1(schema)
-
#4280
5b471e7
Thanks @fubhy! - AddedDuration.formatIso
andDuration.fromIso
for formatting and parsing ISO8601 durations. -
#4280
4f810cc
Thanks @tim-smart! - add Effect.filterEffect* apisEffect.filterEffectOrElse
Filters an effect with an effectful predicate, falling back to an alternative
effect if the predicate fails.import { Effect, pipe } from "effect" // Define a user interface interface User { readonly name: string } // Simulate an asynchronous authentication function declare const auth: () => Promise<User | null> const program = pipe( Effect.promise(() => auth()), // Use filterEffectOrElse with an effectful predicate Effect.filterEffectOrElse({ predicate: (user) => Effect.succeed(user !== null), orElse: (user) => Effect.fail(new Error(`Unauthorized user: ${user}`)) }) )
Effect.filterEffectOrFail
Filters an effect with an effectful predicate, failing with a custom error if the predicate fails.
import { Effect, pipe } from "effect" // Define a user interface interface User { readonly name: string } // Simulate an asynchronous authentication function declare const auth: () => Promise<User | null> const program = pipe( Effect.promise(() => auth()), // Use filterEffectOrFail with an effectful predicate Effect.filterEffectOrFail({ predicate: (user) => Effect.succeed(user !== null), orFailWith: (user) => Effect.fail(new Error(`Unauthorized user: ${user}`)) }) )
Patch Changes
- #4280
cf8b2dd
Thanks @KhraksMamtsov! -Trie<out A>
type annotations have been aligned. The type parameter was made covariant because the structure is immutable.