Core.dec: def of bend-schema-lib@0.4.1.0 Import: import bend-schema-lib@0.4.1.0/core.bend as Core Lines 1603-1658 of bend-schema-lib@0.4.1.0/core.bend: https://jend.leeeet.dev/read.txt?path=bend-schema-lib@0.4.1.0/core.bend&start_line=1603&end_line=1658 import Base def dec(s: Schema, r: Raw) -> Maybe<&2, Meaning(s)>: match s r: case SNat{} RNum{n}: Some{n} case SNatIn{lo_, hi_} RNum{n}: Some{n} case SStr{} RStr{x}: Some{x} case SStrLen{lo_, hi_, s2} x: dec(s2, x) case SListLen{lo_, hi_, s2} x: dec(s2, x) case SOpt{+i} +x: pick_m(Maybe<&2, Maybe<&2, Meaning(i)>>, nullish(x), Some{None{}}, opt_some(Meaning(i), dec(i, x))) case SOptional{+i} +x: pick_m(Maybe<&2, Maybe<&2, Meaning(i)>>, is_missing(x), Some{None{}}, opt_some(Meaning(i), dec(i, x))) case SList{e} RNil{}: Some{Nil{}} case SList{+e} RCons{h, t}: lcons(Meaning(e), dec(e, h), dec(SList{e}, t)) case SField{+n, +fs, +rest} +x: both(Meaning(fs), Meaning(rest), dec(fs, lookup(n, x)), dec(rest, x)) case SEnd{} x: Some{Unit{}} case SRule{s2, tag} x: dec(s2, x) case SStrict{s2} x: dec(s2, x) case STagged{+k, +n, +cs, +rest} +x: pick_m(Maybe<&2, Either<&2, &2, Meaning(cs), Meaning(rest)>>, is_tag(k, n, x), map_inl(Meaning(cs), Meaning(rest), dec(cs, drop_key(k, x))), map_inr(Meaning(cs), Meaning(rest), dec(rest, x))) case STrue{} RBool{b}: true_unit(b) case SBool{} RBool{b}: Some{b} case SEnum{names} RStr{x}: Some{x} case SVariant{+n, +vs, +rest} +x: pick_m(Maybe<&2, Either<&2, &2, Meaning(vs), Meaning(rest)>>, is_missing(lookup(n, x)), map_inr(Meaning(vs), Meaning(rest), dec(rest, x)), map_inl(Meaning(vs), Meaning(rest), dec(vs, lookup(n, x)))) case STuple{+ts, +rest} RCons{h, t}: both(Meaning(ts), Meaning(rest), dec(ts, h), dec(rest, t)) case STEnd{} RNil{}: Some{Unit{}} case SJson{} RJson{value}: Some{value} case SInt{} RNum{n}: Some{IPos{n}} case SInt{} RNeg{n}: Some{INeg{n}} case SIntIn{lo_, hi_} RNum{n}: Some{IPos{n}} case SIntIn{lo_, hi_} RNeg{n}: Some{INeg{n}} case SEither{+l, +r} +x: pick_m(Maybe<&2, Either<&2, &2, Meaning(l), Meaning(r)>>, has_kind(l, kind_of(x)), map_inl(Meaning(l), Meaning(r), dec(l, x)), pick_m(Maybe<&2, Either<&2, &2, Meaning(l), Meaning(r)>>, has_kind(r, kind_of(x)), map_inr(Meaning(l), Meaning(r), dec(r, x)), None{})) case _ _: None{} Uses (22): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Either https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Unit https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=Int https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=Meaning https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=Raw https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=Schema https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=both https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=drop_key https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=has_kind https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=is_missing https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=is_tag https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=kind_of https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=lcons https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=lookup https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=map_inl https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=map_inr https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=nullish https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=opt_some https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=pick_m https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=true_unit