summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonpj <unknown>2002-09-02 16:31:34 +0000
committersimonpj <unknown>2002-09-02 16:31:34 +0000
commit80e363e77af6001acda87813c128362e746b8a4b (patch)
tree34fc11bcbedcf60971d08d62d9f185738a00bf3f
parentcba61de44344d8c9d7403d0d945eff1e10b8a9b1 (diff)
downloadhaskell-80e363e77af6001acda87813c128362e746b8a4b.tar.gz
[project @ 2002-09-02 16:31:34 by simonpj]
Do not specialise functions that take implicit parameters. The specialisation mechanism doesn't work for them, because their implicit args are not driven by their type args (unlike the implicit dictionary parameters) MERGE TO STABLE
-rw-r--r--ghc/compiler/specialise/Specialise.lhs6
1 files changed, 5 insertions, 1 deletions
diff --git a/ghc/compiler/specialise/Specialise.lhs b/ghc/compiler/specialise/Specialise.lhs
index c9ffa0b1fa..56aa6387d2 100644
--- a/ghc/compiler/specialise/Specialise.lhs
+++ b/ghc/compiler/specialise/Specialise.lhs
@@ -11,7 +11,7 @@ module Specialise ( specProgram ) where
import CmdLineOpts ( DynFlags, DynFlag(..) )
import Id ( Id, idName, idType, mkUserLocal, idSpecialisation, isDataConWrapId )
import TcType ( Type, mkTyVarTy, tcSplitSigmaTy,
- tyVarsOfTypes, tyVarsOfTheta,
+ tyVarsOfTypes, tyVarsOfTheta, isClassPred,
mkForAllTys, tcCmpType
)
import Subst ( Subst, mkSubst, substTy, mkSubst, extendSubstList, mkInScopeSet,
@@ -1003,6 +1003,10 @@ callDetailsToList calls = [ (id,tys,dicts)
mkCallUDs subst f args
| null theta
+ || 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 (spec_tys `lengthIs` n_tyvars)
|| not ( dicts `lengthIs` n_dicts)
|| maybeToBool (lookupRule (\act -> True) (substInScope subst) f args)