ghc-9.8.3: The GHC API
Safe HaskellNone
LanguageHaskell2010

GHC.Driver.CmdLine

Description

Command-line parser

This is an abstract command-line parser used by DynFlags.

(c) The University of Glasgow 2005

Synopsis

Documentation

processArgs Source #

Arguments

:: Monad m 
=> [Flag m]

cmdline parser spec

-> [Located String]

args

-> (FilePath -> EwM m [Located String])

response file handler

-> m ([Located String], [Err], Warns) 

parseResponseFile :: forall (m :: Type -> Type). MonadIO m => FilePath -> EwM m [Located String] Source #

Parse a response file into arguments.

data OptKind (m :: Type -> Type) Source #

Constructors

NoArg (EwM m ()) 
HasArg (String -> EwM m ()) 
SepArg (String -> EwM m ()) 
Prefix (String -> EwM m ()) 
OptPrefix (String -> EwM m ()) 
OptIntSuffix (Maybe Int -> EwM m ()) 
IntSuffix (Int -> EwM m ()) 
WordSuffix (Word -> EwM m ()) 
FloatSuffix (Float -> EwM m ()) 
PassFlag (String -> EwM m ()) 
AnySuffix (String -> EwM m ()) 

data GhcFlagMode Source #

GHC flag modes describing when a flag has an effect.

Constructors

OnlyGhc

The flag only affects the non-interactive GHC

OnlyGhci

The flag only affects the interactive GHC

AllModes

The flag affects multiple ghc modes

HiddenFlag

This flag should not be seen in cli completion

data Flag (m :: Type -> Type) Source #

Constructors

Flag 

defFlag :: forall (m :: Type -> Type). String -> OptKind m -> Flag m Source #

defGhcFlag :: forall (m :: Type -> Type). String -> OptKind m -> Flag m Source #

defGhciFlag :: forall (m :: Type -> Type). String -> OptKind m -> Flag m Source #

defHiddenFlag :: forall (m :: Type -> Type). String -> OptKind m -> Flag m Source #

hoistFlag :: (forall a. m a -> n a) -> Flag m -> Flag n Source #

newtype Err Source #

A command-line error message

Constructors

Err 

Fields

type Warn = Located DriverMessage Source #

A command-line warning message and the reason it arose

This used to be own type, but now it's just MsgEnvelope DriverMessage.

data EwM (m :: Type -> Type) a Source #

Instances

Instances details
MonadIO m => MonadIO (EwM m) Source # 
Instance details

Defined in GHC.Driver.CmdLine

Methods

liftIO :: IO a -> EwM m a Source #

Monad m => Applicative (EwM m) Source # 
Instance details

Defined in GHC.Driver.CmdLine

Methods

pure :: a -> EwM m a Source #

(<*>) :: EwM m (a -> b) -> EwM m a -> EwM m b Source #

liftA2 :: (a -> b -> c) -> EwM m a -> EwM m b -> EwM m c Source #

(*>) :: EwM m a -> EwM m b -> EwM m b Source #

(<*) :: EwM m a -> EwM m b -> EwM m a Source #

Functor m => Functor (EwM m) Source # 
Instance details

Defined in GHC.Driver.CmdLine

Methods

fmap :: (a -> b) -> EwM m a -> EwM m b Source #

(<$) :: a -> EwM m b -> EwM m a Source #

Monad m => Monad (EwM m) Source # 
Instance details

Defined in GHC.Driver.CmdLine

Methods

(>>=) :: EwM m a -> (a -> EwM m b) -> EwM m b Source #

(>>) :: EwM m a -> EwM m b -> EwM m b Source #

return :: a -> EwM m a Source #

runEwM :: EwM m a -> m (Errs, Warns, a) Source #

addErr :: forall (m :: Type -> Type). Monad m => String -> EwM m () Source #

addWarn :: forall (m :: Type -> Type). Monad m => String -> EwM m () Source #

addFlagWarn :: forall (m :: Type -> Type). Monad m => DriverMessage -> EwM m () Source #

getArg :: forall (m :: Type -> Type). Monad m => EwM m String Source #

getCurLoc :: forall (m :: Type -> Type). Monad m => EwM m SrcSpan Source #

liftEwM :: Monad m => m a -> EwM m a Source #