Idris2/tests/idris2/interface027/params.idr
Edwin Brady 86c75bae2c Add test for interfaces in parameter blocks
I thought these didn't work. Apparently they do. I should find out when
that happened because it might have been a side effect of something
else!
2021-07-10 20:15:50 +01:00

24 lines
482 B
Idris

parameters (n : Nat)
data X : Type -> Type where
A : t -> X t
B : t -> X t
Eq t => Eq (X t) where
A x == A y = x == y
B x == B y = x == y
_ == _ = False
test : Char -> Char -> Bool
test x y = A x == A y
mkEq : (approx : Bool) -> Eq Nat
mkEq True = withinOne
where
[withinOne] Eq Nat where
Z == Z = True
Z == S Z = True
S Z == Z = True
S x == S y = x == y
_ == _ = False
mkEq False = %search