summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testsuite/tests/typecheck/should_compile/T10390.hs16
-rw-r--r--testsuite/tests/typecheck/should_compile/all.T1
2 files changed, 17 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T10390.hs b/testsuite/tests/typecheck/should_compile/T10390.hs
new file mode 100644
index 0000000000..e0648c9554
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T10390.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE RankNTypes #-}
+
+module T10390 where
+
+class ApPair r where
+ apPair :: (forall a . (ApPair a, Num a) => Maybe a) -> Maybe r
+
+instance (ApPair a, ApPair b) => ApPair (a,b) where
+ apPair = apPair'
+
+apPair' :: (ApPair b, ApPair c)
+ => (forall a . (Num a, ApPair a) => Maybe a) -> Maybe (b,c)
+ -- NB constraints in a different order to apPair
+apPair' f = let (Just a) = apPair f
+ (Just b) = apPair f
+ in Just $ (a, b)
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index bf0e0a0eca..33fff944a5 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -446,3 +446,4 @@ test('T10109', normal, compile, [''])
test('T10335', normal, compile, [''])
test('T10489', normal, compile, [''])
test('T10564', normal, compile, [''])
+test('T10390', normal, compile, [''])