Skip to main content
Module

x/fun/mod.ts>decoder.draw

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function decoder.draw
import { decoder } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { draw } = decoder;

Given a DecodeError, this function will produce a printable tree of errors.

Examples

Example 1

import * as D from "./decoder.ts";

const result1 = D.draw(D.leafErr(1, "string"));
// "cannot decode 1, should be string"

const result2 = D.draw(D.wrapErr(
  "decoding password",
  D.leafErr(1, "string"),
));
// decoding password
// └─ cannot decode 1, should be string

Returns

string