mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-14 05:46:47 +03:00
86c75bae2c
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!
24 lines
482 B
Idris
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
|