import type { FreeSemigroup } from "../../FreeSemigroup"; import type { DecodeError, Kind } from "./model"; export const leaf = (actual: unknown, expected: string): DecodeError => ({ _tag: "Leaf", actual, expected }); export const key = (key: string, kind: Kind, errors: FreeSemigroup>): DecodeError => ({ _tag: "Key", key, kind, errors }); export const index = (index: number, kind: Kind, errors: FreeSemigroup>): DecodeError => ({ _tag: "Index", index, kind, errors }); export const member = (index: number, errors: FreeSemigroup>): DecodeError => ({ _tag: "Member", index, errors }); export const lazy = (id: string, errors: FreeSemigroup>): DecodeError => ({ _tag: "Lazy", id, errors }); export const wrap = (error: E, errors: FreeSemigroup>): DecodeError => ({ _tag: "Wrap", error, errors }); export const info = (error: E): DecodeError => ({ _tag: "Info", error });