Idris2/tests/idris2/with/with010/NestedWith.idr

13 lines
354 B
Idris
Raw Normal View History

module NestedWith
%default total
interface DecEq a where
decEq : (x, y : a) -> Dec (x === y)
(DecEq a, DecEq b) => DecEq (a, b) where
decEq (x, y) (a, b) with (decEq x a) | (decEq y b)
_ | Yes eqL | Yes eqR = Yes (cong2 (,) eqL eqR)
2023-06-11 16:23:16 +03:00
_ | No neqL | _ = No $ \prf => neqL $ cong fst prf
_ | _ | No neqR = No $ \prf => neqR $ cong snd prf