import { type Log } from "https://deno.land/x/hyogwa@v0.1.0-rc.4/src/log.ts";
Effect spec template for logging effects (a.k.a. 'Writer')
Examples
Simple application logging in console
Simple application logging in console
import { Effect, createPrimitives, Effectful } from 'hyogwa/core'
import { Log } from 'hyogwa/log'
import { unsafeRunSync } from 'hyogwa/runners'
type Console = Effect<'Console', Log<string>>
const Console = createPrimitives<Console>('Console')
function* main(): Effectful<Console, void> {
yield* Console.log('HI!')
yield* Console.log('BYE!')
}
unsafeRunSync(main(), {
Console: {
log(text, { resume }) {
console.log(text)
resume()
}
}
})