Source/Packages

Std.Foundation

packages/foundation/standard/src/Std/Foundation.alpha

329 lines52 declarations12.3 KiBSHA-256 7818c29d5c7c

def · lines 158–165

stdBoolToNatural

Full file
A decision as a natural: zero is false, one is true. The conversion is explicit, so a count is never treated as a decision by accident.
158def stdBoolToNatural =
159  (lambda unrestricted value : (family StdBool) .
160    (eliminate
161      StdBool
162      (lambda unrestricted current : (family StdBool) . Nat)
163      value
164      (branch StdTrue . (succ zero))
165      (branch StdFalse . zero)))

The compiler supplied declaration spans and resolved links from this source snapshot. This page does not assert that this file belongs to a checked closure.