0.9.1 • Published 2 years ago
@xzhayon/fx v0.9.1
fx
Installation
The package is available via npm:
npm install @xzhayon/fxUsage
import { fx } from '@xzhayon/fx'
// Define effect interface.
interface Log {
readonly [fx.uri]?: unique symbol
(message: string): void
}
// Create effect tag.
const tag = fx.tag<Log>()
// Derive effector constructor.
const log = fx.function(tag)
// Perform effect in generator function.
function* main() {
yield* log('hello, world')
}
// Create layer with effect handler.
function ConsoleLog() {
return fx.layer().with(tag, (message) => console.log(message))
}
// Run program with provided layer.
fx.runPromise(main, ConsoleLog())License
0.9.0
2 years ago
0.9.1
2 years ago
0.8.0
2 years ago
0.7.3
2 years ago
0.7.2
2 years ago
0.7.1
2 years ago
0.7.0
2 years ago
0.6.0
2 years ago
0.5.0
2 years ago
0.4.0
2 years ago
0.3.0
2 years ago
0.2.3
2 years ago
0.3.1
2 years ago
0.2.1
2 years ago
0.1.2
2 years ago
0.2.0
2 years ago
0.1.1
2 years ago
0.1.3
2 years ago
0.1.0
2 years ago