def Cmp.case
import bend-kit-collections@0.1.4.1/omap.bend as Omapimport Base
23# The recursion on cmp's result: a match cannot scrutinize cmp(k, key), and
24# a template cannot call a law filled below it, so each branch is a closure.
25def Cmp.case(
26 -A: Type, c: Cmp, lt: Unit -> A, eq: Unit -> A, gt: Unit -> A
27) -> A:
28 match c:
29 case LT{}:
30 lt(Unit{})
31 case EQ{}:
32 eq(Unit{})
33 case GT{}:
34 gt(Unit{})