Skip to main content
Module

x/fun/decoder.ts>unwrap

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

A combinator over Decoded that maps a DecodeError into a printable tree.

Examples

Example 1

import * as D from "./decoder.ts";
import { pipe } from "./fn.ts";

const result1 = pipe(
  D.failure(1, "string"),
  D.unwrap,
); // Left("cannot decode 1, should be string")
const result2 = pipe(
  D.success(1),
  D.unwrap
); // Right(1)

Returns

Either<string, A>