-
-
Notifications
You must be signed in to change notification settings - Fork 389
/
Copy pathCmdLine.hs
38 lines (35 loc) · 1.19 KB
/
CmdLine.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{-# LANGUAGE CPP #-}
-- | Compat module Interface file relevant code.
module Development.IDE.GHC.Compat.CmdLine (
processCmdLineP
, CmdLineP (..)
, getCmdLineState
, putCmdLineState
, Flag(..)
, OptKind(..)
, EwM
, defFlag
, liftEwM
) where
#if MIN_VERSION_ghc(9,3,0)
import GHC.Driver.CmdLine
import GHC.Driver.Session (CmdLineP (..), getCmdLineState,
processCmdLineP, putCmdLineState)
#else
import Control.Monad.IO.Class
import GHC (Located)
import GHC.Driver.CmdLine
#endif
#if !MIN_VERSION_ghc(9,3,0)
-- | A helper to parse a set of flags from a list of command-line arguments, handling
-- response files.
processCmdLineP
:: forall s m. MonadIO m
=> [Flag (CmdLineP s)] -- ^ valid flags to match against
-> s -- ^ current state
-> [Located String] -- ^ arguments to parse
-> m (([Located String], [Err], [Warn]), s)
-- ^ (leftovers, errors, warnings)
processCmdLineP activeFlags s0 args =
pure $ runCmdLine (processArgs activeFlags args) s0
#endif