summaryrefslogtreecommitdiff
path: root/testsuite/tests/polykinds
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2016-01-22 16:34:18 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2016-01-25 11:32:25 +0000
commitff21795a0b9253e811a45626d5686e981ed07f82 (patch)
tree62224ed16e322bd7fb13424d9331243decb96712 /testsuite/tests/polykinds
parentfd6dd41c67f3bd23bbf074357219cfd251eb53d6 (diff)
downloadhaskell-ff21795a0b9253e811a45626d5686e981ed07f82.tar.gz
Special-case implicit params in superclass expansion
This issue came up in Trac #11480, and is documented in Note [When superclasses help] in TcRnTypes. We were getting a spurious warning T11480.hs:1:1: warning: solveWanteds: too many iterations (limit = 4) The fix is easy. A bit of refactoring along the way. The original bug report in Trac #11480 appears to work fine in HEAD and the 8.0 branch but I added a regression test in this commit as well.
Diffstat (limited to 'testsuite/tests/polykinds')
-rw-r--r--testsuite/tests/polykinds/T11480a.hs26
-rw-r--r--testsuite/tests/polykinds/all.T1
2 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/tests/polykinds/T11480a.hs b/testsuite/tests/polykinds/T11480a.hs
new file mode 100644
index 0000000000..3d17168082
--- /dev/null
+++ b/testsuite/tests/polykinds/T11480a.hs
@@ -0,0 +1,26 @@
+{-# language KindSignatures, PolyKinds, TypeFamilies,
+ NoImplicitPrelude, FlexibleContexts,
+ MultiParamTypeClasses, GADTs,
+ ConstraintKinds, FlexibleInstances,
+ FunctionalDependencies, UndecidableSuperClasses #-}
+
+module T11480a where
+
+import GHC.Types (Constraint)
+import qualified Prelude
+
+data Nat (c :: i -> i -> *) (d :: j -> j -> *) (f :: i -> j) (g :: i -> j)
+
+class Functor p (Nat p (->)) p => Category (p :: i -> i -> *)
+
+class (Category dom, Category cod)
+ => Functor (dom :: i -> i -> *) (cod :: j -> j -> *) (f :: i -> j)
+ | f -> dom cod
+
+instance (Category c, Category d) => Category (Nat c d)
+instance (Category c, Category d) => Functor (Nat c d) (Nat (Nat c d) (->)) (Nat c d)
+instance (Category c, Category d) => Functor (Nat c d) (->) (Nat c d f)
+
+instance Category (->)
+instance Functor (->) (->) ((->) e)
+instance Functor (->) (Nat (->) (->)) (->)
diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T
index f1f25cecc4..69c5ba0790 100644
--- a/testsuite/tests/polykinds/all.T
+++ b/testsuite/tests/polykinds/all.T
@@ -134,3 +134,4 @@ test('T11278', normal, compile, [''])
test('T11255', normal, compile, [''])
test('T11459', normal, compile_fail, [''])
test('T11466', normal, compile_fail, [''])
+test('T11480a', normal, compile, [''])