import { comparable } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { thunk } = comparable;
Create a eq that tests the output of a thunk (IO). This assumes that the output of the thunk is always the same, which for true IO is not the case. This assumes that the context for the function is undefined, which means that it doesn't rely on "this" to execute.
Examples
Example 1
Example 1
import { struct, thunk, number } from "./comparable.ts";
const { compare } = struct({ asNumber: thunk(number) });
const one = { asNumber: () => 1 };
const two = { asNumber: () => 2 };
const result1 = compare(one)(two); // false
const result2 = compare(one)(one); // true
Parameters
unnamed 0: Comparable<A>
Returns
Comparable<() => A>