ghc-mod debug does not need a file.

This commit is contained in:
Kazu Yamamoto
2014-04-21 11:31:15 +09:00
parent 12dac1f0a5
commit df4dd97e48
3 changed files with 4 additions and 17 deletions

View File

@@ -33,7 +33,6 @@ module Language.Haskell.GhcMod (
, info
, typeOf
, listMods
, debug
, lint
) where

View File

@@ -1,12 +1,10 @@
module Language.Haskell.GhcMod.Debug (debugInfo, debug, rootInfo) where
module Language.Haskell.GhcMod.Debug (debugInfo, rootInfo) where
import Control.Applicative ((<$>))
import Control.Exception.IOChoice ((||>))
import Control.Monad (void)
import CoreMonad (liftIO)
import Data.List (intercalate)
import Data.Maybe (fromMaybe, isJust, fromJust)
import GHC (Ghc)
import Language.Haskell.GhcMod.CabalApi
import Language.Haskell.GhcMod.GHCApi
import Language.Haskell.GhcMod.Types
@@ -16,23 +14,13 @@ import Language.Haskell.GhcMod.Types
-- | Obtaining debug information.
debugInfo :: Options
-> Cradle
-> FilePath -- ^ A target file.
-> IO String
debugInfo opt cradle fileName = unlines <$> withGHC fileName (debug opt cradle fileName)
-- | Obtaining debug information.
debug :: Options
-> Cradle
-> FilePath -- ^ A target file.
-> Ghc [String]
debug opt cradle fileName = do
debugInfo opt cradle = convert opt <$> do
CompilerOptions gopts incDir pkgs <-
if cabal then
liftIO (fromCabalFile ||> return simpleCompilerOption)
else
return simpleCompilerOption
void $ initializeFlagsWithCradle opt cradle gopts True
setTargetFiles [fileName]
mglibdir <- liftIO getSystemLibDir
return [
"Root directory: " ++ rootDir