def wf.go
emerging-ezjson@1.3.0.0 · src/value.bend:357
import emerging-ezjson@1.3.0.0/src/value.bend as Value
import Base
import emerging-ezjson@1.3.0.0/src/lazy.bend as Lazy
357
358
359
360def wf.go(val: Json, shape: Shape) -> Bool:
361 match val shape:
362 case JNull{} WVal{}:
363 True{}
364 case JBool{_} WVal{}:
365 True{}
366 case JNum{raw} WVal{}:
367 num.ok(raw)
368 case JStr{_} WVal{}:
369 True{}
370 case JSpan{_, _} WVal{}:
371 True{}
372 case JArr{items} WVal{}:
373 wf.go(items, WArr{})
374 case JObj{pairs} WVal{}:
375 wf.go(pairs, WObj{})
376 case JNil{} WArr{}:
377 True{}
378 case JCons{hd, tl} WArr{}:
379 Lazy.stop(Bool, Bool.not(wf.go(hd, WVal{})), False{}, _u => wf.go(tl, WArr{}))
380 case JNil{} WObj{}:
381 True{}
382 case JPair{_, vv, rr} WObj{}:
383 Lazy.stop(Bool, Bool.not(wf.go(vv, WVal{})), False{}, _u => wf.go(rr, WObj{}))
384 case JBind{_, _, vv, rr} WObj{}:
385 Lazy.stop(Bool, Bool.not(wf.go(vv, WVal{})), False{}, _u => wf.go(rr, WObj{}))
386 case _ _:
387 False{}