summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types/should_fail/SimpleFail9.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2016-04-18 15:14:40 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2016-04-19 08:38:47 +0100
commit8136a5cbfcd24647f897a2fae9fcbda0b1624035 (patch)
tree8c5c8100cbe1b6552d5fbdd6819c9d4417fac48f /testsuite/tests/indexed-types/should_fail/SimpleFail9.hs
parent17eb2419c42c70d7436b6b8cff0cef705353bb4e (diff)
downloadhaskell-8136a5cbfcd24647f897a2fae9fcbda0b1624035.tar.gz
Tighten checking for associated type instances
This patch finishes off Trac #11450. Following debate on that ticket, the patch tightens up the rules for what the instances of an associated type can look like. Now they must match the instance header exactly. Eg class C a b where type T a x b With this class decl, if we have an instance decl instance C ty1 ty2 where ... then the type instance must look like type T ty1 v ty2 = ... with exactly - 'ty1' for 'a' - 'ty2' for 'b', and - a variable for 'x' For example: instance C [p] Int type T [p] y Int = (p,y,y) Previously we allowed multiple instance equations and now, in effect, we don't since they would all overlap. If you want multiple cases, use an auxiliary type family. This is consistent with the treatment of generic-default instances, and the user manual always said "WARNING: this facility (multiple instance equations may be withdrawn in the future". I also improved error messages, and did other minor refactoring.
Diffstat (limited to 'testsuite/tests/indexed-types/should_fail/SimpleFail9.hs')
-rw-r--r--testsuite/tests/indexed-types/should_fail/SimpleFail9.hs5
1 files changed, 2 insertions, 3 deletions
diff --git a/testsuite/tests/indexed-types/should_fail/SimpleFail9.hs b/testsuite/tests/indexed-types/should_fail/SimpleFail9.hs
index 927c60caf0..9c1c4a82d2 100644
--- a/testsuite/tests/indexed-types/should_fail/SimpleFail9.hs
+++ b/testsuite/tests/indexed-types/should_fail/SimpleFail9.hs
@@ -8,8 +8,7 @@ class C7 a b where
instance C7 Char (a, Bool) where
data S7 (a, Bool) = S7_1
--- Used to fail, but now passes:
--- type indexes don't match the instance types by name
--- but do by structure
+-- Fails because the arg to S7 should be the
+-- same as that to C7
instance C7 Char (a, Int) where
data S7 (b, Int) = S7_2