def nat_ok

bolt@1.27.0.0 · src/rules/tokens.bend:57

import bolt@1.27.0.0/src/rules/tokens.bend as Tokens
import Base
import bolt@1.27.0.0/src/lazy/lazy.bend as Lazy

57# digits, then one final `n`: a Nat literal's chars
58def nat_ok(cs: List<&2, Char>) -> Bool:
59  match cs:
60    case Con{'n', Nil{}}:
61      True{}
62    case Con{+c, t}:
63      Lazy.and_then(Char.is_digit(c), _u => nat_ok(t))
64    case Nil{}:
65      False{}

Uses (8)

Used by (2)