summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/tc118.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/typecheck/should_compile/tc118.hs')
-rw-r--r--testsuite/tests/typecheck/should_compile/tc118.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/tc118.hs b/testsuite/tests/typecheck/should_compile/tc118.hs
new file mode 100644
index 0000000000..5828a1287c
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/tc118.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies,
+ UndecidableInstances #-}
+
+-- !!! An instance decl with a context containing a free type variable
+-- The interest here is that there's a "b" in the instance decl
+-- context that isn't mentioned in the instance head.
+-- Hence UndecidableInstances
+
+module ShouldCompile where
+
+class HasConverter a b | a -> b where
+ convert :: a -> b
+
+data Foo a = MkFoo a
+
+instance (HasConverter a b,Show b) => Show (Foo a) where
+ show (MkFoo value) = show (convert value)
+