summaryrefslogtreecommitdiff
path: root/testsuite/tests/polykinds
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/polykinds
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/polykinds')
-rw-r--r--testsuite/tests/polykinds/T10570.stderr14
1 files changed, 7 insertions, 7 deletions
diff --git a/testsuite/tests/polykinds/T10570.stderr b/testsuite/tests/polykinds/T10570.stderr
index f40ed10ce4..3c91db5cfb 100644
--- a/testsuite/tests/polykinds/T10570.stderr
+++ b/testsuite/tests/polykinds/T10570.stderr
@@ -1,9 +1,9 @@
T10570.hs:10:10: error:
- Illegal instance declaration for ‘ConsByIdx2 Int a Proxy cls’
- The coverage condition fails in class ‘ConsByIdx2’
- for functional dependency: ‘x -> m’
- Reason: lhs type ‘Int’ does not determine rhs type ‘Proxy’
- Un-determined variable: k
- (Use -fprint-explicit-kinds to see the kind variables in the types)
- In the instance declaration for ‘ConsByIdx2 Int a Proxy cls’
+ • Illegal instance declaration for ‘ConsByIdx2 Int a Proxy cls’
+ The coverage condition fails in class ‘ConsByIdx2’
+ for functional dependency: ‘x -> m’
+ Reason: lhs type ‘Int’ does not determine rhs type ‘Proxy’
+ Un-determined variable: k
+ Use -fprint-explicit-kinds to see the kind arguments
+ • In the instance declaration for ‘ConsByIdx2 Int a Proxy cls’