Skip to main content
Module

x/fun/decoder.ts>draw

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

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