summaryrefslogtreecommitdiff
path: root/compiler/GHC/Core/Class.hs
diff options
context:
space:
mode:
authorApoorv Ingle <apoorv-ingle@uiowa.edu>2023-02-06 09:13:10 -0600
committerApoorv Ingle <apoorv-ingle@uiowa.edu>2023-03-06 08:40:40 -0600
commitf5c3ae02d74d94d3183f288fb70a076babf338b2 (patch)
tree0786841b680fbaa4e86c809d47145cb3c215d60b /compiler/GHC/Core/Class.hs
parentbf43ba9215a726039ace7bac37c0a223a912d998 (diff)
downloadhaskell-wip/T21909.tar.gz
Constraint simplification loop now depends on `ExpansionFuel`wip/T21909
instead of a boolean flag for `CDictCan.cc_pend_sc`. Pending givens get a fuel of 3 while Wanted and quantified constraints get a fuel of 1. This helps pending given constraints to keep up with pending wanted constraints in case of `UndecidableSuperClasses` and superclass expansions while simplifying the infered type. Adds 3 dynamic flags for controlling the fuels for each type of constraints `-fgivens-expansion-fuel` for givens `-fwanteds-expansion-fuel` for wanteds and `-fqcs-expansion-fuel` for quantified constraints Fixes #21909 Added Tests T21909, T21909b Added Note [Expanding Recursive Superclasses and ExpansionFuel]
Diffstat (limited to 'compiler/GHC/Core/Class.hs')
-rw-r--r--compiler/GHC/Core/Class.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/GHC/Core/Class.hs b/compiler/GHC/Core/Class.hs
index 9ad470e9da..1b46f66fca 100644
--- a/compiler/GHC/Core/Class.hs
+++ b/compiler/GHC/Core/Class.hs
@@ -17,8 +17,8 @@ module GHC.Core.Class (
mkClass, mkAbstractClass, classTyVars, classArity,
classKey, className, classATs, classATItems, classTyCon, classMethods,
classOpItems, classBigSig, classExtraBigSig, classTvsFds, classSCTheta,
- classAllSelIds, classSCSelId, classSCSelIds, classMinimalDef, classHasFds,
- isAbstractClass,
+ classHasSCs, classAllSelIds, classSCSelId, classSCSelIds, classMinimalDef,
+ classHasFds, isAbstractClass,
) where
import GHC.Prelude
@@ -295,6 +295,9 @@ classSCTheta (Class { classBody = ConcreteClass { cls_sc_theta = theta_stuff }})
= theta_stuff
classSCTheta _ = []
+classHasSCs :: Class -> Bool
+classHasSCs cls = not (null (classSCTheta cls))
+
classTvsFds :: Class -> ([TyVar], [FunDep TyVar])
classTvsFds c = (classTyVars c, classFunDeps c)