[commit: ghc] wip/tc-plugins: Change plugin interface: allow solving and improvement in the same step. (9aff205)
git at git.haskell.org
git at git.haskell.org
Fri Oct 10 00:29:43 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/tc-plugins
Link : http://ghc.haskell.org/trac/ghc/changeset/9aff20599ccbebd3f4077d8f1091be041241ee16/ghc
>---------------------------------------------------------------
commit 9aff20599ccbebd3f4077d8f1091be041241ee16
Author: Iavor S. Diatchki <diatchki at galois.com>
Date: Thu Oct 9 17:29:43 2014 -0700
Change plugin interface: allow solving and improvement in the same step.
>---------------------------------------------------------------
9aff20599ccbebd3f4077d8f1091be041241ee16
compiler/typecheck/TcInteract.lhs | 17 ++++++++---------
compiler/typecheck/TcRnTypes.lhs | 16 +++-------------
2 files changed, 11 insertions(+), 22 deletions(-)
diff --git a/compiler/typecheck/TcInteract.lhs b/compiler/typecheck/TcInteract.lhs
index dc599e5..6d0bfcf 100644
--- a/compiler/typecheck/TcInteract.lhs
+++ b/compiler/typecheck/TcInteract.lhs
@@ -166,15 +166,14 @@ runTcPlugin solver =
do restoreICans ok_cts
mapM_ emitInsoluble bad_cts
- TcPluginNewWork new_cts ->
- updWorkListTcS (extendWorkListCts new_cts)
-
- TcPluginSolved solved_cts other_cts ->
- case solved_cts of
- [] -> return () -- Fast common case
- _ -> do restoreICans other_cts
- let setEv (ev,ct) = setEvBind (ctev_evar (cc_ev ct)) ev
- mapM_ setEv solved_cts
+ -- other_cts should include both givens and wanteds.
+ TcPluginOk solved_cts other_cts new_cts ->
+ do case solved_cts of
+ [] -> return () -- Fast common case
+ _ -> do restoreICans other_cts
+ let setEv (ev,ct) = setEvBind (ctev_evar (cc_ev ct)) ev
+ mapM_ setEv solved_cts
+ updWorkListTcS (extendWorkListCts new_cts)
type WorkItem = Ct
diff --git a/compiler/typecheck/TcRnTypes.lhs b/compiler/typecheck/TcRnTypes.lhs
index 4bc12f6..aa54941 100644
--- a/compiler/typecheck/TcRnTypes.lhs
+++ b/compiler/typecheck/TcRnTypes.lhs
@@ -1938,20 +1938,10 @@ data TcPlugin = forall s. TcPlugin
data TcPluginResult
= TcPluginContradiction {- inconsistent -} [Ct]
{- all others -} [Ct]
- {- ^ There is no model for the constraints.
- The two lists partition the original constraints,
- with the first one being the conflicting constraints,
- and the second the other constraints. -}
-
- | TcPluginNewWork [Ct]
- -- ^ New work (facts that will hold in all models)
-
- | TcPluginSolved {- solved -} [(EvTerm,Ct)]
- {- not solved -} [Ct]
- -- ^ We managed to solve some of the constrints.
- -- The solved constraints (with evidence) are in the first list.
- -- The unsolved constraints are in the second one.
+ | TcPluginOk {- solved, non-empty -} [(EvTerm,Ct)]
+ {- not solved -} [Ct]
+ {- new work -} [Ct]
\end{code}
More information about the ghc-commits
mailing list