Avoid making Either String an instance of Monad in the Haddock parser
[ghc-hetmet.git] / compiler / main / GHC.hs
index 85ecf58..dd92677 100644 (file)
@@ -74,6 +74,7 @@ module GHC (
        setContext, getContext, 
        getNamesInScope,
        getRdrNamesInScope,
+        getGRE,
        moduleIsInterpreted,
        getInfo,
        exprType,
@@ -92,7 +93,7 @@ module GHC (
         InteractiveEval.forward,
        showModule,
         isModuleInterpreted,
-       compileExpr, HValue, dynCompileExpr,
+       InteractiveEval.compileExpr, HValue, dynCompileExpr,
        lookupName,
         GHC.obtainTerm, GHC.obtainTerm1, GHC.obtainTermB, reconstructType,
         modInfoModBreaks,
@@ -235,7 +236,7 @@ import DriverPipeline
 import DriverPhases    ( HscSource(..), Phase(..), isHaskellSrcFilename, startPhase )
 import HeaderInfo      ( getImports, getOptions )
 import Finder
-import HscMain          hiding (compileExpr)
+import HscMain
 import HscTypes
 import DynFlags
 import StaticFlags
@@ -482,7 +483,10 @@ setGlobalTypeScope session ids
 -- Parsing Haddock comments
 
 parseHaddockComment :: String -> Either String (HsDoc RdrName)
-parseHaddockComment string = parseHaddockParagraphs (tokenise string)
+parseHaddockComment string = 
+  case parseHaddockParagraphs (tokenise string) of
+    MyLeft x  -> Left x
+    MyRight x -> Right x
 
 -- -----------------------------------------------------------------------------
 -- Loading the program
@@ -2049,6 +2053,12 @@ lookupGlobalName s name = withSession s $ \hsc_env -> do
    return $! lookupType (hsc_dflags hsc_env) 
                        (hsc_HPT hsc_env) (eps_PTE eps) name
 
+#ifdef GHCI
+-- | get the GlobalRdrEnv for a session
+getGRE :: Session -> IO GlobalRdrEnv
+getGRE s = withSession s $ \hsc_env-> return $ ic_rn_gbl_env (hsc_IC hsc_env)
+#endif
+
 -- -----------------------------------------------------------------------------
 -- Misc exported utils