def returns_proof

bolt@1.27.0.0 · src/rules/calls.bend:264

import bolt@1.27.0.0/src/rules/calls.bend as Calls
import Base
import bolt@1.27.0.0/src/syntax/tree.bend as Tree
import bolt@1.27.0.0/src/lazy/lazy.bend as Lazy

264# does the signature return a proof, `-> {a == b : T}`?
265def returns_proof(sig: Tree.Node) -> Bool:
266  match sig:
267    case Tree.NCons{h, +rest}:
268      match rest:
269        case Tree.NCons{+g, r2}:
270          Lazy.either(Bool, kind.leaf(~kind.arrow, h), _u => returns_proof.or(Tree.opens(g, "{"), returns_proof(r2)),
271            _v => returns_proof(rest))
272        case _r:
273          returns_proof(rest)
274    case other:
275      False{}

Uses (7)

Used by (1)