Separating IO and Ghc.
This commit is contained in:
@@ -17,8 +17,8 @@ import Var
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
browseModule :: Options -> String -> Ghc String
|
||||
browseModule opt mdlName = convert opt . format <$> browse opt mdlName
|
||||
browseModule :: Options -> String -> IO String
|
||||
browseModule opt mdlName = convert opt . format <$> withGHCDummyFile (browse opt mdlName)
|
||||
where
|
||||
format
|
||||
| operators opt = formatOps
|
||||
|
||||
@@ -12,12 +12,12 @@ import Prelude
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
checkSyntax :: Options -> Cradle -> String -> Ghc String
|
||||
checkSyntax opt cradle file = unlines <$> check opt cradle file
|
||||
checkSyntax :: Options -> Cradle -> FilePath -> IO String
|
||||
checkSyntax opt cradle file = unlines <$> withGHC file (check opt cradle file)
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
check :: Options -> Cradle -> String -> Ghc [String]
|
||||
check :: Options -> Cradle -> FilePath -> Ghc [String]
|
||||
check opt cradle fileName = checkIt `gcatch` handleErrMsg
|
||||
where
|
||||
checkIt = do
|
||||
|
||||
@@ -14,10 +14,10 @@ import Prelude
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
debugInfo :: Options -> Cradle -> String -> String -> Ghc String
|
||||
debugInfo opt cradle ver fileName = unlines <$> debug opt cradle ver fileName
|
||||
debugInfo :: Options -> Cradle -> String -> FilePath -> IO String
|
||||
debugInfo opt cradle ver fileName = unlines <$> withGHC fileName (debug opt cradle ver fileName)
|
||||
|
||||
debug :: Options -> Cradle -> String -> String -> Ghc [String]
|
||||
debug :: Options -> Cradle -> String -> FilePath -> Ghc [String]
|
||||
debug opt cradle ver fileName = do
|
||||
(gopts, incDir, pkgs) <-
|
||||
if cabal then
|
||||
|
||||
@@ -36,8 +36,8 @@ data Cmd = Info | Type deriving Eq
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
infoExpr :: Options -> Cradle -> ModuleString -> Expression -> FilePath -> Ghc String
|
||||
infoExpr opt cradle modstr expr file = (++ "\n") <$> info opt cradle file modstr expr
|
||||
infoExpr :: Options -> Cradle -> ModuleString -> Expression -> FilePath -> IO String
|
||||
infoExpr opt cradle modstr expr file = (++ "\n") <$> withGHCDummyFile (info opt cradle file modstr expr)
|
||||
|
||||
info :: Options -> Cradle -> FilePath -> ModuleString -> Expression -> Ghc String
|
||||
info opt cradle fileName modstr expr =
|
||||
@@ -67,8 +67,8 @@ instance HasType (LHsBind Id) where
|
||||
instance HasType (LPat Id) where
|
||||
getType _ (L spn pat) = return $ Just (spn, hsPatType pat)
|
||||
|
||||
typeExpr :: Options -> Cradle -> ModuleString -> Int -> Int -> FilePath -> Ghc String
|
||||
typeExpr opt cradle modstr lineNo colNo file = typeOf opt cradle file modstr lineNo colNo
|
||||
typeExpr :: Options -> Cradle -> ModuleString -> Int -> Int -> FilePath -> IO String
|
||||
typeExpr opt cradle modstr lineNo colNo file = withGHCDummyFile $ typeOf opt cradle file modstr lineNo colNo
|
||||
|
||||
typeOf :: Options -> Cradle -> FilePath -> ModuleString -> Int -> Int -> Ghc String
|
||||
typeOf opt cradle fileName modstr lineNo colNo =
|
||||
|
||||
@@ -10,8 +10,8 @@ import UniqFM
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
listModules :: Options -> Ghc String
|
||||
listModules opt = convert opt . nub . sort <$> list opt
|
||||
listModules :: Options -> IO String
|
||||
listModules opt = convert opt . nub . sort <$> withGHCDummyFile (list opt)
|
||||
|
||||
list :: Options -> Ghc [String]
|
||||
list opt = do
|
||||
|
||||
Reference in New Issue
Block a user