import { apply } from "https://deno.land/x/fun@v2.0.0/decoder.ts";
Given a Decoder returning a function A => I and a Decoder returning a value A, combine them into a Decoder returning I.
Examples
Example 1
Example 1
import * as D from "./decoder.ts";
import { pipe } from "./fn.ts";
type Person = { name: string; age: number };
const person = (name: string) => (age: number): Person => ({ name, age });
const result = pipe(
D.wrap(person),
D.apply(D.wrap("Brandon")),
D.apply(D.wrap(37)),
); // Decoder<unknown, Person>