... |
... |
@@ -767,11 +767,10 @@ and Given/instance fundeps entirely. |
767
|
767
|
tryInertDicts :: DictCt -> SolverStage ()
|
768
|
768
|
tryInertDicts dict_ct
|
769
|
769
|
= Stage $ do { inerts <- getInertCans
|
770
|
|
- ; mode <- getTcSMode
|
771
|
|
- ; try_inert_dicts mode inerts dict_ct }
|
|
770
|
+ ; try_inert_dicts inerts dict_ct }
|
772
|
771
|
|
773
|
|
-try_inert_dicts :: TcSMode -> InertCans -> DictCt -> TcS (StopOrContinue ())
|
774
|
|
-try_inert_dicts mode inerts dict_w@(DictCt { di_ev = ev_w, di_cls = cls, di_tys = tys })
|
|
772
|
+try_inert_dicts :: InertCans -> DictCt -> TcS (StopOrContinue ())
|
|
773
|
+try_inert_dicts inerts dict_w@(DictCt { di_ev = ev_w, di_cls = cls, di_tys = tys })
|
775
|
774
|
| Just dict_i <- lookupInertDict inerts cls tys
|
776
|
775
|
, let ev_i = dictCtEvidence dict_i
|
777
|
776
|
loc_i = ctEvLoc ev_i
|
... |
... |
@@ -866,8 +865,7 @@ try_instances inerts work_item@(DictCt { di_ev = ev, di_cls = cls |
866
|
865
|
|
867
|
866
|
| otherwise -- Wanted, but not cached
|
868
|
867
|
= do { dflags <- getDynFlags
|
869
|
|
- ; mode <- getTcSMode
|
870
|
|
- ; lkup_res <- matchClassInst dflags mode inerts cls xis dict_loc
|
|
868
|
+ ; lkup_res <- matchClassInst dflags inerts cls xis dict_loc
|
871
|
869
|
; case lkup_res of
|
872
|
870
|
OneInst { cir_what = what }
|
873
|
871
|
-> do { let is_local_given = case what of { LocalInstance -> True; _ -> False }
|
... |
... |
@@ -925,10 +923,10 @@ checkInstanceOK loc what pred |
925
|
923
|
| otherwise
|
926
|
924
|
= loc
|
927
|
925
|
|
928
|
|
-matchClassInst :: DynFlags -> TcSMode -> InertSet
|
|
926
|
+matchClassInst :: DynFlags -> InertSet
|
929
|
927
|
-> Class -> [Type]
|
930
|
928
|
-> CtLoc -> TcS ClsInstResult
|
931
|
|
-matchClassInst dflags mode inerts clas tys loc
|
|
929
|
+matchClassInst dflags inerts clas tys loc
|
932
|
930
|
-- First check whether there is an in-scope Given that could
|
933
|
931
|
-- match this constraint. In that case, do not use any instance
|
934
|
932
|
-- whether top level, or local quantified constraints.
|
... |
... |
@@ -939,7 +937,7 @@ matchClassInst dflags mode inerts clas tys loc |
939
|
937
|
-- It is always safe to unpack constraint tuples
|
940
|
938
|
-- And if we don't do so, we may never solve it at all
|
941
|
939
|
-- See Note [Solving tuple constraints]
|
942
|
|
- , not (noMatchableGivenDicts mode inerts loc clas tys)
|
|
940
|
+ , not (noMatchableGivenDicts inerts loc clas tys)
|
943
|
941
|
= do { traceTcS "Delaying instance application" $
|
944
|
942
|
vcat [ text "Work item:" <+> pprClassPred clas tys ]
|
945
|
943
|
; return NotSure }
|
... |
... |
@@ -970,8 +968,8 @@ matchClassInst dflags mode inerts clas tys loc |
970
|
968
|
-- potentially, match the given class constraint. This is used when checking to see if a
|
971
|
969
|
-- Given might overlap with an instance. See Note [Instance and Given overlap]
|
972
|
970
|
-- in GHC.Tc.Solver.Dict
|
973
|
|
-noMatchableGivenDicts :: TcSMode -> InertSet -> CtLoc -> Class -> [TcType] -> Bool
|
974
|
|
-noMatchableGivenDicts mode inerts@(IS { inert_cans = inert_cans }) loc_w clas tys
|
|
971
|
+noMatchableGivenDicts :: InertSet -> CtLoc -> Class -> [TcType] -> Bool
|
|
972
|
+noMatchableGivenDicts inerts@(IS { inert_cans = inert_cans }) loc_w clas tys
|
975
|
973
|
= not $ anyBag matchable_given $
|
976
|
974
|
findDictsByClass (inert_dicts inert_cans) clas
|
977
|
975
|
where
|