@typed/effects
Version:
Generator-powered Effect management
12 lines • 458 B
JavaScript
import { Resume } from '@typed/env';
import { Nothing, unpack } from '@typed/maybe';
export const Fail = (error) => Resume.of(Failure.of(error));
export class Failure {
constructor(error, value) {
this.error = error;
this.value = value;
this.unpack = (left, right) => unpack(right, () => left(this.error), this.value);
}
}
Failure.of = (error, value = Nothing) => new Failure(error, value);
//# sourceMappingURL=Failure.js.map