[Print type of expressions entered on command line
John Meacham <john@repetae.net>**20051208031053] hunk ./Interactive.hs 11
+import qualified Text.PrettyPrint.HughesPJ as P
hunk ./Interactive.hs 22
-import qualified FrontEnd.Infix
-import qualified HsPretty
-import TypeSyns
+import FrontEnd.SrcLoc
hunk ./Interactive.hs 27
-import Warning
hunk ./Interactive.hs 29
+import qualified FrontEnd.Infix
+import qualified HsPretty
hunk ./Interactive.hs 33
+import TIMain
hunk ./Interactive.hs 35
+import TypeSyns
hunk ./Interactive.hs 37
+import Warning
hunk ./Interactive.hs 141
+    tcStatement is stmt'''
hunk ./Interactive.hs 143
---executeStatement _ HsLetStmt {} = putStrLn "let statements not yet supported"
---executeStatement _ HsGenerator {} = putStrLn "generators not yet supported"
---executeStatement _ (HsQualifier e) = putStrLn (show e)
-
+tcStatement _ HsLetStmt {} = putStrLn "let statements not yet supported"
+tcStatement _ HsGenerator {} = putStrLn "generators not yet supported"
+tcStatement is@IS { stateHo = ho } (HsQualifier e) = do
+    let importVarEnv = Map.fromList [ (x,y) | (x,y) <- Map.toList $ hoAssumps ho, nameType x == Val ]
+        importDConsEnv = Map.fromList [ (x,y) | (x,y) <- Map.toList $ hoAssumps ho, nameType x ==  DataConstructor ]
+        ansName = Qual (stateModule is) (HsIdent "ans")
+        ansName' = toName Val ansName
+    localVarEnv <- tiProgram
+                (stateModule is)               -- name of the module
+                mempty                         -- environment of type signatures
+                (hoKinds ho)                   -- kind information about classes and type constructors
+                (hoClassHierarchy ho)        -- class hierarchy with instances
+                importDConsEnv                 -- data constructor type environment
+                importVarEnv                   -- type environment
+                [([],[HsPatBind bogusASrcLoc (HsPVar ansName) (HsUnGuardedRhs e) []])]                        -- binding groups
+    b <- printIOErrors
+    if b then return () else do
+    vv <- Map.lookup ansName' localVarEnv
+    putStrLn $ show (text "::" <+> pprint vv :: P.Doc)