summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_run/tcrun032.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/typecheck/should_run/tcrun032.hs')
-rw-r--r--testsuite/tests/typecheck/should_run/tcrun032.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_run/tcrun032.hs b/testsuite/tests/typecheck/should_run/tcrun032.hs
new file mode 100644
index 0000000000..8aa43637ba
--- /dev/null
+++ b/testsuite/tests/typecheck/should_run/tcrun032.hs
@@ -0,0 +1,20 @@
+
+{-# LANGUAGE UndecidableInstances #-}
+
+-- This tests the recursive-dictionary stuff.
+
+module Main where
+
+data Fix f = In (f (Fix f))
+
+instance Show (f (Fix f)) => Show (Fix f) where
+ show (In x) = "In " ++ show x -- No parens, but never mind
+
+instance Eq (f (Fix f)) => Eq (Fix f) where
+ (In x) == (In y) = x==y
+
+data L x = Nil | Cons Int x deriving( Show, Eq )
+
+main = do { print (In Nil);
+ print (In Nil == In Nil) }
+