Skip to main content
Module

x/fun/mod.ts>decoder.combine

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 decoder.combine
import { decoder } from "https://deno.land/x/fun@v2.0.0-alpha.12/mod.ts";
const { combine } = decoder;

Combine two DecodeErrors into one. If both DecodeErrors are Unions then they are merged into a Union, if they are both Intersections then are merged into an Intersection, otherwise they are wrapped in a Many.

Examples

Example 1

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

const result = pipe(
  D.leafErr(1, "string"),
  D.combine(D.leafErr("hello", "number")),
); // Many[Leaf, Leaf]