diff --git a/testsuite/tests/typecheck/should_compile/T10390.hs b/testsuite/tests/typecheck/should_compile/T10390.hs new file mode 100644 index 0000000000000000000000000000000000000000..e0648c9554a770aca8a4f494f7eedf54eab11b18 --- /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 bf0e0a0ecac2692a9791d22182d82f4a676921e8..33fff944a5faba4c31697a4abcedf9925686faab 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, [''])