ghc-mod debug does not need a file.
This commit is contained in:
parent
12dac1f0a5
commit
df4dd97e48
@ -33,7 +33,6 @@ module Language.Haskell.GhcMod (
|
|||||||
, info
|
, info
|
||||||
, typeOf
|
, typeOf
|
||||||
, listMods
|
, listMods
|
||||||
, debug
|
|
||||||
, lint
|
, lint
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
@ -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.Applicative ((<$>))
|
||||||
import Control.Exception.IOChoice ((||>))
|
import Control.Exception.IOChoice ((||>))
|
||||||
import Control.Monad (void)
|
|
||||||
import CoreMonad (liftIO)
|
import CoreMonad (liftIO)
|
||||||
import Data.List (intercalate)
|
import Data.List (intercalate)
|
||||||
import Data.Maybe (fromMaybe, isJust, fromJust)
|
import Data.Maybe (fromMaybe, isJust, fromJust)
|
||||||
import GHC (Ghc)
|
|
||||||
import Language.Haskell.GhcMod.CabalApi
|
import Language.Haskell.GhcMod.CabalApi
|
||||||
import Language.Haskell.GhcMod.GHCApi
|
import Language.Haskell.GhcMod.GHCApi
|
||||||
import Language.Haskell.GhcMod.Types
|
import Language.Haskell.GhcMod.Types
|
||||||
@ -16,23 +14,13 @@ import Language.Haskell.GhcMod.Types
|
|||||||
-- | Obtaining debug information.
|
-- | Obtaining debug information.
|
||||||
debugInfo :: Options
|
debugInfo :: Options
|
||||||
-> Cradle
|
-> Cradle
|
||||||
-> FilePath -- ^ A target file.
|
|
||||||
-> IO String
|
-> IO String
|
||||||
debugInfo opt cradle fileName = unlines <$> withGHC fileName (debug opt cradle fileName)
|
debugInfo opt cradle = convert opt <$> do
|
||||||
|
|
||||||
-- | Obtaining debug information.
|
|
||||||
debug :: Options
|
|
||||||
-> Cradle
|
|
||||||
-> FilePath -- ^ A target file.
|
|
||||||
-> Ghc [String]
|
|
||||||
debug opt cradle fileName = do
|
|
||||||
CompilerOptions gopts incDir pkgs <-
|
CompilerOptions gopts incDir pkgs <-
|
||||||
if cabal then
|
if cabal then
|
||||||
liftIO (fromCabalFile ||> return simpleCompilerOption)
|
liftIO (fromCabalFile ||> return simpleCompilerOption)
|
||||||
else
|
else
|
||||||
return simpleCompilerOption
|
return simpleCompilerOption
|
||||||
void $ initializeFlagsWithCradle opt cradle gopts True
|
|
||||||
setTargetFiles [fileName]
|
|
||||||
mglibdir <- liftIO getSystemLibDir
|
mglibdir <- liftIO getSystemLibDir
|
||||||
return [
|
return [
|
||||||
"Root directory: " ++ rootDir
|
"Root directory: " ++ rootDir
|
||||||
|
@ -30,7 +30,7 @@ usage = "ghc-mod version " ++ showVersion version ++ "\n"
|
|||||||
++ "\t ghc-mod browse" ++ ghcOptHelp ++ "[-l] [-o] [-d] [-q] [-p package] <module> [<module> ...]\n"
|
++ "\t ghc-mod browse" ++ ghcOptHelp ++ "[-l] [-o] [-d] [-q] [-p package] <module> [<module> ...]\n"
|
||||||
++ "\t ghc-mod check" ++ ghcOptHelp ++ "<HaskellFiles...>\n"
|
++ "\t ghc-mod check" ++ ghcOptHelp ++ "<HaskellFiles...>\n"
|
||||||
++ "\t ghc-mod expand" ++ ghcOptHelp ++ "<HaskellFiles...>\n"
|
++ "\t ghc-mod expand" ++ ghcOptHelp ++ "<HaskellFiles...>\n"
|
||||||
++ "\t ghc-mod debug" ++ ghcOptHelp ++ "<HaskellFile>\n"
|
++ "\t ghc-mod debug" ++ ghcOptHelp ++ "\n"
|
||||||
++ "\t ghc-mod info" ++ ghcOptHelp ++ "<HaskellFile> <module> <expression>\n"
|
++ "\t ghc-mod info" ++ ghcOptHelp ++ "<HaskellFile> <module> <expression>\n"
|
||||||
++ "\t ghc-mod type" ++ ghcOptHelp ++ "<HaskellFile> <module> <line-no> <column-no>\n"
|
++ "\t ghc-mod type" ++ ghcOptHelp ++ "<HaskellFile> <module> <line-no> <column-no>\n"
|
||||||
++ "\t ghc-mod lint [-h opt] <HaskellFile>\n"
|
++ "\t ghc-mod lint [-h opt] <HaskellFile>\n"
|
||||||
@ -112,7 +112,7 @@ main = flip E.catches handlers $ do
|
|||||||
"browse" -> concat <$> mapM (browseModule opt cradle) remainingArgs
|
"browse" -> concat <$> mapM (browseModule opt cradle) remainingArgs
|
||||||
"check" -> checkSyntax opt cradle remainingArgs
|
"check" -> checkSyntax opt cradle remainingArgs
|
||||||
"expand" -> checkSyntax opt { expandSplice = True } cradle remainingArgs
|
"expand" -> checkSyntax opt { expandSplice = True } cradle remainingArgs
|
||||||
"debug" -> nArgs 1 $ debugInfo opt cradle cmdArg1
|
"debug" -> debugInfo opt cradle
|
||||||
"info" -> nArgs 3 infoExpr opt cradle cmdArg1 cmdArg3
|
"info" -> nArgs 3 infoExpr opt cradle cmdArg1 cmdArg3
|
||||||
"type" -> nArgs 4 $ typeExpr opt cradle cmdArg1 (read cmdArg3) (read cmdArg4)
|
"type" -> nArgs 4 $ typeExpr opt cradle cmdArg1 (read cmdArg3) (read cmdArg4)
|
||||||
"lint" -> nArgs 1 withFile (lintSyntax opt) cmdArg1
|
"lint" -> nArgs 1 withFile (lintSyntax opt) cmdArg1
|
||||||
|
Loading…
Reference in New Issue
Block a user