Moving commands to Ghc monad

This commit is contained in:
mvoidex
2013-05-19 01:16:37 +04:00
parent bac4bbbcf3
commit f2f3b120af
7 changed files with 42 additions and 34 deletions

View File

@@ -6,6 +6,7 @@ import Control.Monad
import Data.List (intercalate)
import Data.Maybe
import GHC
import GhcMonad (liftIO)
import Language.Haskell.GhcMod.CabalApi
import Language.Haskell.GhcMod.GHCApi
import Language.Haskell.GhcMod.Types
@@ -13,17 +14,17 @@ import Prelude
----------------------------------------------------------------
debugInfo :: Options -> Cradle -> String -> String -> IO String
debugInfo :: Options -> Cradle -> String -> String -> Ghc String
debugInfo opt cradle ver fileName = unlines <$> debug opt cradle ver fileName
debug :: Options -> Cradle -> String -> String -> IO [String]
debug :: Options -> Cradle -> String -> String -> Ghc [String]
debug opt cradle ver fileName = do
(gopts, incDir, pkgs) <-
if cabal then
fromCabalFile (ghcOpts opt) cradle ||> return (ghcOpts opt, [], [])
liftIO $ fromCabalFile (ghcOpts opt) cradle ||> return (ghcOpts opt, [], [])
else
return (ghcOpts opt, [], [])
[fast] <- withGHC fileName $ do
[fast] <- do
void $ initializeFlagsWithCradle opt cradle gopts True
setTargetFile fileName
pure . canCheckFast <$> depanal [] False