dhall-nix-lib/Function/splitAndCompare.dhall

18 lines
443 B
Text
Raw Permalink Normal View History

2022-09-08 18:49:47 +00:00
let splitAndCompare
: ∀(a : Type) →
(a → Bool) →
(a → a → Integer) →
(a → a → Integer) →
a →
a →
Integer
= λ(t : Type) →
λ(p : t → Bool) →
λ(yes : t → t → Integer) →
λ(no : t → t → Integer) →
λ(a : t) →
λ(b : t) →
if p a then if p b then yes a b else -1 else if p b then +1 else no a b
in splitAndCompare