summaryrefslogtreecommitdiff
path: root/compiler/specialise
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2012-08-23 16:35:55 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2012-08-23 16:35:55 +0100
commit2f08f709cfdace23a4e32d80a57af349f7cc785a (patch)
treef31accb43c112f5c06ac8a9c23eb16453f8b40d1 /compiler/specialise
parentb04ff2fe83d8a5f9c176739559ac722521a7bdcc (diff)
downloadhaskell-2f08f709cfdace23a4e32d80a57af349f7cc785a.tar.gz
Don't specialise on implicit-parameter arguments in Specalise
This is a fix for Trac #7101
Diffstat (limited to 'compiler/specialise')
-rw-r--r--compiler/specialise/Specialise.lhs12
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/specialise/Specialise.lhs b/compiler/specialise/Specialise.lhs
index 6892c9c6ad..4307ff75df 100644
--- a/compiler/specialise/Specialise.lhs
+++ b/compiler/specialise/Specialise.lhs
@@ -1573,10 +1573,7 @@ mkCallUDs :: Id -> [CoreExpr] -> UsageDetails
mkCallUDs f args
| not (want_calls_for f) -- Imported from elsewhere
|| null theta -- Not overloaded
- || not (all isClassPred theta)
- -- Only specialise if all overloading is on class params.
- -- In ptic, with implicit params, the type args
- -- *don't* say what the value of the implicit param is!
+ || not (all type_determines_value theta)
|| not (spec_tys `lengthIs` n_tyvars)
|| not ( dicts `lengthIs` n_dicts)
|| not (any interestingDict dicts) -- Note [Interesting dictionary arguments]
@@ -1603,6 +1600,13 @@ mkCallUDs f args
| otherwise = Nothing
want_calls_for f = isLocalId f || isInlinablePragma (idInlinePragma f)
+
+ type_determines_value pred = isClassPred pred && not (isIPPred pred)
+ -- Only specialise if all overloading is on non-IP *class* params,
+ -- because these are the ones whose *type* determines their *value*.
+ -- In ptic, with implicit params, the type args
+ -- *don't* say what the value of the implicit param is!
+ -- See Trac #7101
\end{code}
Note [Interesting dictionary arguments]