Add nice getComplete' function
authorJoachim Breitner <mail@joachim-breitner.de>
Wed, 15 Oct 2008 12:52:22 +0000 (12:52 +0000)
committerJoachim Breitner <mail@joachim-breitner.de>
Wed, 15 Oct 2008 12:52:22 +0000 (12:52 +0000)
ExFindExtended.hs

index 5f01799..3b295ed 100644 (file)
@@ -1,6 +1,7 @@
-module ExFindExtended (TypVar(..),Typ(..),TermVar(..),Term,AbsTerm(..),testTerm,getTerm,getComplete,getWithDebug,getIt) where
+module ExFindExtended (TypVar(..),Typ(..),TermVar(..),Term,AbsTerm(..),testTerm,getTerm,getComplete,getComplete',getWithDebug,getIt) where
 
 import Prelude hiding (Either(..))
+import qualified Prelude as E (Either(..))
 import List
 import qualified Data.Map as Map
 import Control.Monad
@@ -997,6 +998,12 @@ getComplete tau = do {printTyp tau;
                                                }
                     }
 
+getComplete' :: Typ -> E.Either String (String, String)
+getComplete' tau = case runM $ alg emptyCont tau emptyTermCont of
+                     Nothing             -> E.Left "No Term."
+                     Just (result,debug) -> E.Right (showTerm (fst result),
+                                                      uncurry showUsedTermCont result)
+
 getWithDebug tau = do {printTyp tau;
                      putStr "\n";
                      case runM $ alg emptyCont tau emptyTermCont of