[commit: ghc] wip/tc-plugins: Redo the methods of `TcPlugin`. (1dcdde1)

git at git.haskell.org git at git.haskell.org
Wed Oct 8 20:14:27 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/tc-plugins
Link       : http://ghc.haskell.org/trac/ghc/changeset/1dcdde11f6a697d4c528a8adbe11fac65a8982e2/ghc

>---------------------------------------------------------------

commit 1dcdde11f6a697d4c528a8adbe11fac65a8982e2
Author: Iavor S. Diatchki <diatchki at galois.com>
Date:   Wed Oct 8 13:13:35 2014 -0700

    Redo the methods of `TcPlugin`.


>---------------------------------------------------------------

1dcdde11f6a697d4c528a8adbe11fac65a8982e2
 compiler/typecheck/TcRnTypes.lhs | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/compiler/typecheck/TcRnTypes.lhs b/compiler/typecheck/TcRnTypes.lhs
index 95efad9..4e85ba3 100644
--- a/compiler/typecheck/TcRnTypes.lhs
+++ b/compiler/typecheck/TcRnTypes.lhs
@@ -75,7 +75,7 @@ module TcRnTypes(
         canRewrite, canRewriteOrSame,
 
         -- Constraint solver plugins
-        TcPlugin(..), TcSolveResult(..),
+        TcPlugin(..), TcPluginResult(..),
 
         -- Pretty printing
         pprEvVarTheta, pprWantedsWithLocs,
@@ -1935,11 +1935,30 @@ Constraint Solver Plugins
 \begin{code}
 
 data TcPlugin = TcPlugin
-  { tcPluginSolve :: [Ct] -> [Ct] -> IO ([TcSolveResult], [Ct])
+  { tcPluginSolve :: [Ct] -> [Ct] -> IO TcPluginResult
   , tcPluginStop  :: IO ()
+    -- ^ Exit the solver.
+    -- The solver should not be used after this is called.
   }
 
-data TcSolveResult = Stuck | Impossible | Simplified EvTerm
+
+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.
+
 
 \end{code}
 



More information about the ghc-commits mailing list