From be926f0366349a99a69424300cf96d093c2a6a6c Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Wed, 19 Mar 2014 10:23:32 +0900 Subject: [PATCH] new APIs. --- Language/Haskell/GhcMod/ErrMsg.hs | 2 +- Language/Haskell/GhcMod/GHCApi.hs | 7 +++++++ Language/Haskell/GhcMod/Internal.hs | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Language/Haskell/GhcMod/ErrMsg.hs b/Language/Haskell/GhcMod/ErrMsg.hs index 637e7ed..548ca22 100644 --- a/Language/Haskell/GhcMod/ErrMsg.hs +++ b/Language/Haskell/GhcMod/ErrMsg.hs @@ -81,7 +81,7 @@ ppMsg spn sev dflag ls@(LineSeparator lsep) msg = prefix ++ cts ++ lsep cts = showMsg dflag ls msg defaultPrefix | dopt Opt_D_dump_splices dflag = "" - | otherwise = "Dummy:0:0:" + | otherwise = "Dummy:0:0:Error:" prefix = fromMaybe defaultPrefix $ do (line,col,_,_) <- Gap.getSrcSpan spn file <- normalise <$> Gap.getSrcFile spn diff --git a/Language/Haskell/GhcMod/GHCApi.hs b/Language/Haskell/GhcMod/GHCApi.hs index 4415149..d43265b 100644 --- a/Language/Haskell/GhcMod/GHCApi.hs +++ b/Language/Haskell/GhcMod/GHCApi.hs @@ -6,6 +6,7 @@ module Language.Haskell.GhcMod.GHCApi ( , initializeFlags , initializeFlagsWithCradle , setTargetFiles + , addTargetFiles , getDynamicFlags ) where @@ -157,6 +158,12 @@ setTargetFiles files = do targets <- forM files $ \file -> guessTarget file Nothing setTargets targets +addTargetFiles :: (GhcMonad m) => [FilePath] -> m () +addTargetFiles [] = error "ghc-mod: addTargetFiles: No target files given" +addTargetFiles files = do + targets <- forM files $ \file -> guessTarget file Nothing + mapM_ addTarget targets + ---------------------------------------------------------------- -- | Return the 'DynFlags' currently in use in the GHC session. diff --git a/Language/Haskell/GhcMod/Internal.hs b/Language/Haskell/GhcMod/Internal.hs index fbeda09..9908fc4 100644 --- a/Language/Haskell/GhcMod/Internal.hs +++ b/Language/Haskell/GhcMod/Internal.hs @@ -21,6 +21,8 @@ module Language.Haskell.GhcMod.Internal ( , initializeFlagsWithCradle -- * 'GhcMonad' , setTargetFiles + , addTargetFiles + , handleErrMsg -- * 'Ghc' Choice , (||>) , goNext