blob: fe28a330916f912d8e7dcd0f9bbc97f17a49b965 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
{-# LANGUAGE UndecidableInstances #-}
-- Test recursive dictionaries
module Main where
data D r = ZeroD | SuccD (r (D r));
instance (Eq (r (D r))) => Eq (D r) where
ZeroD == ZeroD = True
(SuccD a) == (SuccD b) = a == b
_ == _ = False;
equalDC :: D [] -> D [] -> Bool;
equalDC = (==);
foo :: D []
foo = SuccD [SuccD [ZeroD], ZeroD]
main = print (foo == foo)
|