check + expand: Allow passing in multiple files

This commit is contained in:
Niklas Hambüchen
2013-08-21 17:21:49 +09:00
parent e7d746f115
commit 4758a6043c
7 changed files with 30 additions and 22 deletions

View File

@@ -5,7 +5,7 @@ module Language.Haskell.GhcMod.GHCApi (
, withGHCDummyFile
, initializeFlags
, initializeFlagsWithCradle
, setTargetFile
, setTargetFiles
, getDynamicFlags
, setSlowDynFlags
, checkSlowAndSet
@@ -154,11 +154,12 @@ modifyFlagsWithOpts dflags cmdOpts =
----------------------------------------------------------------
-- | Set the file that GHC will load / compile
setTargetFile :: (GhcMonad m) => String -> m ()
setTargetFile file = do
target <- guessTarget file Nothing
setTargets [target]
-- | Set the files that GHC will load / compile
setTargetFiles :: (GhcMonad m) => [String] -> m ()
setTargetFiles [] = error "ghc-mod: setTargetFiles: No target files given"
setTargetFiles files = do
targets <- forM files $ \file -> guessTarget file Nothing
setTargets targets
----------------------------------------------------------------