Hyperlinkv0.8.0-beta.28

Context

Context.makeconsteffect/Context.ts:643
<I, S>(key: Key<I, S>, service: Types.NoInfer<S>): Context<I>

Creates a new Context with a single service associated to the key.

Example (Creating a context with one service)

import { Context } from "effect"
import * as assert from "node:assert"

const Port = Context.Service<{ PORT: number }>("Port")

const context = Context.make(Port, { PORT: 8080 })

assert.deepStrictEqual(Context.get(context, Port), { PORT: 8080 })
constructors
Source effect/Context.ts:6434 lines
export const make = <I, S>(
  key: Key<I, S>,
  service: Types.NoInfer<S>
): Context<I> => makeUnsafe(new Map([[key.key, service]]))
Referenced by 7 symbols