module /** */ import { FailureInfo , ResultKind } from "../result" ; import { ParsingState } from "../state" ; import { ParjserBase } from "../parser" ; import { Parjser } from "../parjser" ; import defaults from "lodash/defaults" ; const defaultFailure = { kind : "Hard" , reason : "The primitive fail parser has been applied." } ; param pFailure export function fail < T = never > ( pFailure ? ) { let failure = defaults ( pFailure , defaultFailure ) ; return new class Fail extends ParjserBase { type = "fail" ; expecting = failure . reason ; _apply ( ps ) { ps . kind = failure . kind ; ps . reason = this . expecting ; } } ( ) ; }