<T>(value: T): Config<T>Creates a config that always succeeds with the given value, ignoring the provider entirely.
When to use
Use when you need a hardcoded config value, such as inside orElse or tests.
Example (Returning a constant fallback)
import { Config } from "effect"
const host = Config.string("HOST").pipe(
Config.orElse(() => Config.succeed("localhost"))
)constructorsorElse
Source effect/Config.ts:8723 lines
export function function succeed<T>(value: T): Config<T>Creates a config that always succeeds with the given value, ignoring the
provider entirely.
When to use
Use when you need a hardcoded config value, such as inside
orElse
or
tests.
Example (Returning a constant fallback)
import { Config } from "effect"
const host = Config.string("HOST").pipe(
Config.orElse(() => Config.succeed("localhost"))
)
succeed<function (type parameter) T in succeed<T>(value: T): Config<T>T>(value: Tvalue: function (type parameter) T in succeed<T>(value: T): Config<T>T) {
return function make<T>(
parse: (
provider: ConfigProvider.ConfigProvider,
pathPrefix: Path
) => Effect.Effect<T, ConfigError>
): Config<T>
make(() => import EffectEffect.const succeed: <A>(value: A) => Effect<A>Creates an Effect that always succeeds with a given value.
When to use
Use when an effect should complete successfully with a specific value without any errors
or external dependencies.
Example (Creating a successful effect)
import { Effect } from "effect"
// Creating an effect that represents a successful scenario
//
// ┌─── Effect<number, never, never>
// ▼
const success = Effect.succeed(42)
succeed(value: Tvalue))
}Referenced by 1 symbols