effect-ts-laws
Version:
effect-ts law testing using fast-check.
26 lines • 700 B
JavaScript
import { flow } from 'effect';
/**
* Flip the encode/decode direction: encode becomes decode and decode becomes
* encode.
* @category typeclass
*/
export const reverse = ({ to, from, }) => ({ from: to, to: from });
/**
* Compose two isomorphisms of `A⇒B` and `B⇒C` into an isomorphism of `a⇒C`.
* @category typeclass
*/
export const compose = (F) => (G) => ({
to: flow(F.to, G.to),
from: flow(G.from, F.from),
});
/**
* Run the `to` transform of the isomorphism.
* @category typeclass
*/
export const encode = (iso) => iso.to,
/**
* Run the `from` transform of the isomorphism.
* @category type lambda
*/
decode = (iso) => iso.from;
//# sourceMappingURL=Isomorphism.js.map