(value: TimeZone): <A, E, R>(
self: Effect.Effect<A, E, R>
) => Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>
<A, E, R>(self: Effect.Effect<A, E, R>, value: TimeZone): Effect.Effect<
A,
E,
Exclude<R, CurrentTimeZone>
>Provides the CurrentTimeZone to an effect.
Example (Providing the current time zone)
import { DateTime, Effect } from "effect"
const zone = DateTime.zoneMakeNamedUnsafe("Europe/London")
Effect.gen(function*() {
const now = yield* DateTime.nowInCurrentZone
}).pipe(DateTime.withCurrentZone(zone))export const const withCurrentZone: {
(value: TimeZone): <A, E, R>(
self: Effect.Effect<A, E, R>
) => Effect.Effect<
A,
E,
Exclude<R, CurrentTimeZone>
>
<A, E, R>(
self: Effect.Effect<A, E, R>,
value: TimeZone
): Effect.Effect<
A,
E,
Exclude<R, CurrentTimeZone>
>
}
Provides the CurrentTimeZone to an effect.
Example (Providing the current time zone)
import { DateTime, Effect } from "effect"
const zone = DateTime.zoneMakeNamedUnsafe("Europe/London")
Effect.gen(function*() {
const now = yield* DateTime.nowInCurrentZone
}).pipe(DateTime.withCurrentZone(zone))
withCurrentZone: {
(value: TimeZonevalue: type TimeZone = TimeZone.Offset | TimeZone.NamedRepresents a time zone used by DateTime.Zoned.
Details
A TimeZone is either a fixed offset from UTC or a named IANA time zone.
Companion namespace containing the public variant and protocol types for
TimeZone.
TimeZone): <function (type parameter) A in <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>A, function (type parameter) E in <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>E, function (type parameter) R in <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>R>(self: Effect.Effect<A, E, R>(parameter) self: {
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
self: import EffectEffect.interface Effect<out A, out E = never, out R = never>The Effect interface defines a value that lazily describes a workflow or
job. The workflow requires some context R, and may fail with an error of
type E, or succeed with a value of type A.
When to use
Use when you need to represent a lazy, composable workflow that can require
services, fail with a typed error, or succeed with a typed value.
Details
Effect values model resourceful interaction with the outside world,
including synchronous, asynchronous, concurrent, and parallel interaction.
They use a fiber-based concurrency model, with built-in support for
scheduling, fine-grained interruption, structured concurrency, and high
scalability.
To run an Effect value, you need a Runtime, which is a type that is
capable of executing Effect values.
Effect<function (type parameter) A in <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>A, function (type parameter) E in <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>E, function (type parameter) R in <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>R>) => import EffectEffect.interface Effect<out A, out E = never, out R = never>The Effect interface defines a value that lazily describes a workflow or
job. The workflow requires some context R, and may fail with an error of
type E, or succeed with a value of type A.
When to use
Use when you need to represent a lazy, composable workflow that can require
services, fail with a typed error, or succeed with a typed value.
Details
Effect values model resourceful interaction with the outside world,
including synchronous, asynchronous, concurrent, and parallel interaction.
They use a fiber-based concurrency model, with built-in support for
scheduling, fine-grained interruption, structured concurrency, and high
scalability.
To run an Effect value, you need a Runtime, which is a type that is
capable of executing Effect values.
Effect<function (type parameter) A in <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>A, function (type parameter) E in <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>E, type Exclude<T, U> = T extends U
? never
: T
Exclude from T those types that are assignable to U
Exclude<function (type parameter) R in <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>R, class CurrentTimeZoneclass CurrentTimeZone {
Service: Service;
key: Identifier;
}
Context service that supplies the ambient TimeZone for APIs that work in
the current zone, such as DateTime.setZoneCurrent and
DateTime.nowInCurrentZone.
Details
Provide it with DateTime.withCurrentZone, one of the withCurrentZone*
helpers, or one of the layerCurrentZone* layers.
Example (Accessing the current time zone service)
import { DateTime, Effect } from "effect"
const program = Effect.gen(function*() {
// Access the current time zone service
const zone = yield* DateTime.CurrentTimeZone
console.log(DateTime.zoneToString(zone))
})
// Provide a time zone
const layer = DateTime.layerCurrentZoneNamed("Europe/London")
Effect.provide(program, layer)
CurrentTimeZone>>
<function (type parameter) A in <A, E, R>(self: Effect.Effect<A, E, R>, value: TimeZone): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>A, function (type parameter) E in <A, E, R>(self: Effect.Effect<A, E, R>, value: TimeZone): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>E, function (type parameter) R in <A, E, R>(self: Effect.Effect<A, E, R>, value: TimeZone): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>R>(self: Effect.Effect<A, E, R>(parameter) self: {
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
self: import EffectEffect.interface Effect<out A, out E = never, out R = never>The Effect interface defines a value that lazily describes a workflow or
job. The workflow requires some context R, and may fail with an error of
type E, or succeed with a value of type A.
When to use
Use when you need to represent a lazy, composable workflow that can require
services, fail with a typed error, or succeed with a typed value.
Details
Effect values model resourceful interaction with the outside world,
including synchronous, asynchronous, concurrent, and parallel interaction.
They use a fiber-based concurrency model, with built-in support for
scheduling, fine-grained interruption, structured concurrency, and high
scalability.
To run an Effect value, you need a Runtime, which is a type that is
capable of executing Effect values.
Effect<function (type parameter) A in <A, E, R>(self: Effect.Effect<A, E, R>, value: TimeZone): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>A, function (type parameter) E in <A, E, R>(self: Effect.Effect<A, E, R>, value: TimeZone): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>E, function (type parameter) R in <A, E, R>(self: Effect.Effect<A, E, R>, value: TimeZone): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>R>, value: TimeZonevalue: type TimeZone = TimeZone.Offset | TimeZone.NamedRepresents a time zone used by DateTime.Zoned.
Details
A TimeZone is either a fixed offset from UTC or a named IANA time zone.
Companion namespace containing the public variant and protocol types for
TimeZone.
TimeZone): import EffectEffect.interface Effect<out A, out E = never, out R = never>The Effect interface defines a value that lazily describes a workflow or
job. The workflow requires some context R, and may fail with an error of
type E, or succeed with a value of type A.
When to use
Use when you need to represent a lazy, composable workflow that can require
services, fail with a typed error, or succeed with a typed value.
Details
Effect values model resourceful interaction with the outside world,
including synchronous, asynchronous, concurrent, and parallel interaction.
They use a fiber-based concurrency model, with built-in support for
scheduling, fine-grained interruption, structured concurrency, and high
scalability.
To run an Effect value, you need a Runtime, which is a type that is
capable of executing Effect values.
Effect<function (type parameter) A in <A, E, R>(self: Effect.Effect<A, E, R>, value: TimeZone): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>A, function (type parameter) E in <A, E, R>(self: Effect.Effect<A, E, R>, value: TimeZone): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>E, type Exclude<T, U> = T extends U
? never
: T
Exclude from T those types that are assignable to U
Exclude<function (type parameter) R in <A, E, R>(self: Effect.Effect<A, E, R>, value: TimeZone): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>R, class CurrentTimeZoneclass CurrentTimeZone {
Service: Service;
key: Identifier;
}
Context service that supplies the ambient TimeZone for APIs that work in
the current zone, such as DateTime.setZoneCurrent and
DateTime.nowInCurrentZone.
Details
Provide it with DateTime.withCurrentZone, one of the withCurrentZone*
helpers, or one of the layerCurrentZone* layers.
Example (Accessing the current time zone service)
import { DateTime, Effect } from "effect"
const program = Effect.gen(function*() {
// Access the current time zone service
const zone = yield* DateTime.CurrentTimeZone
console.log(DateTime.zoneToString(zone))
})
// Provide a time zone
const layer = DateTime.layerCurrentZoneNamed("Europe/London")
Effect.provide(program, layer)
CurrentTimeZone>>
} = provideService<unknown, TimeZone>(service: Context.Key<unknown, TimeZone>): {
(implementation: TimeZone): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, unknown>>;
<A, E, R>(self: Effect.Effect<A, E, R>, implementation: TimeZone): Effect.Effect<A, E, Exclude<R, unknown>>;
} (+2 overloads)
provideService(class CurrentTimeZoneclass CurrentTimeZone {
key: Identifier;
of: (this: void, self: TimeZone) => TimeZone;
context: (self: TimeZone) => Context.Context<CurrentTimeZone>;
use: (f: (service: TimeZone) => Effect.Effect<A, E, R>) => Effect.Effect<A, E, CurrentTimeZone | R>;
useSync: (f: (service: TimeZone) => A) => Effect.Effect<A, never, CurrentTimeZone>;
Identifier: Identifier;
Service: Shape;
stack: string | undefined;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
Context service that supplies the ambient TimeZone for APIs that work in
the current zone, such as DateTime.setZoneCurrent and
DateTime.nowInCurrentZone.
Details
Provide it with DateTime.withCurrentZone, one of the withCurrentZone*
helpers, or one of the layerCurrentZone* layers.
Example (Accessing the current time zone service)
import { DateTime, Effect } from "effect"
const program = Effect.gen(function*() {
// Access the current time zone service
const zone = yield* DateTime.CurrentTimeZone
console.log(DateTime.zoneToString(zone))
})
// Provide a time zone
const layer = DateTime.layerCurrentZoneNamed("Europe/London")
Effect.provide(program, layer)
CurrentTimeZone)