Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/hyogwa/src/env.ts>Env

Natural 🌿 effect system that fits TypeScript
Latest
interface Env
import { type Env } from "https://deno.land/x/hyogwa@v0.1.0-rc.4/src/env.ts";

Effect spec template for environment setting referencing effects (a.k.a. 'Reader')

Examples

Reading userAgent

import { Effect, createPrimitives, Effectful } from 'hyogwa/core'
import { Env } from 'hyogwa/env'
import { unsafeRunSync } from 'hyogwa/runners'

type UA = Effect<'UA', Env<string>>
const UA = createPrimitives<UA>('UA')

function* main(): Effectful<UA, string> {
  return yield* UA.env
}

unsafeRunSync(main(), {
  UA: {
    env: navigator.userAgent
  }
})