% The Compilation Manager
%
\begin{code}
-{-# OPTIONS -fvia-C #-}
module CompManager (
ModuleGraph, ModSummary(..),
cmSetContext, -- :: CmState -> DynFlags -> [String] -> [String] -> IO CmState
cmGetContext, -- :: CmState -> IO ([String],[String])
- cmInfoThing, -- :: CmState -> DynFlags -> String
- -- -> IO (CmState, [(TyThing,Fixity)])
-
+ cmInfoThing, -- :: CmState -> String -> IO (CmState, [(TyThing,Fixity)])
cmBrowseModule, -- :: CmState -> IO [TyThing]
CmRunResult(..),
import Linker ( HValue, unload, extendLinkEnv )
import GHC.Exts ( unsafeCoerce# )
import Foreign
+import SrcLoc ( SrcLoc )
import Control.Exception as Exception ( Exception, try )
#endif
-- A string may refer to more than one TyThing (eg. a constructor,
-- and type constructor), so we return a list of all the possible TyThings.
-cmInfoThing :: CmState -> String -> IO [(IfaceDecl,Fixity)]
+cmInfoThing :: CmState -> String -> IO [(IfaceDecl,Fixity,SrcLoc)]
cmInfoThing cmstate id
= hscThing (cm_hsc cmstate) (cm_ic cmstate) id
case maybe_stuff of
Nothing -> return Nothing
- Just ty -> return (Just str)
+ Just ty -> return (Just res_str)
where
- str = showSDocForUser unqual (text expr <+> dcolon <+> ppr tidy_ty)
+ res_str = showSDocForUser unqual (text expr <+> dcolon <+> ppr tidy_ty)
unqual = icPrintUnqual (cm_ic cmstate)
tidy_ty = tidyType emptyTidyEnv ty
= do maybe_stuff <- hscKcType (cm_hsc cmstate) (cm_ic cmstate) str
case maybe_stuff of
Nothing -> return Nothing
- Just kind -> return (Just str)
+ Just kind -> return (Just res_str)
where
- str = showSDocForUser unqual (text str <+> dcolon <+> ppr kind)
+ res_str = showSDocForUser unqual (text str <+> dcolon <+> ppr kind)
unqual = icPrintUnqual (cm_ic cmstate)
-----------------------------------------------------------------------------
| otherwise = False
compresult <- compile hsc_env_strictDC this_mod location
- source_unchanged have_object mb_old_iface
+ (ms_hs_date summary1)
+ source_unchanged have_object mb_old_iface
case compresult of