futhark-0.25.32: An optimising compiler for a functional, array-oriented language.
Safe HaskellNone
LanguageGHC2021

Futhark.Util.Options

Description

Common code for parsing command line options based on getopt.

Synopsis

Documentation

type FunOptDescr cfg = OptDescr (Either (IO ()) (cfg -> cfg)) Source #

A command line option that either purely updates a configuration, or performs an IO action (and stops).

mainWithOptions :: cfg -> [FunOptDescr cfg] -> String -> ([String] -> cfg -> Maybe (IO ())) -> String -> [String] -> IO () Source #

Generate a main action that parses the given command line options (while always adding commonOptions).

commonOptions :: String -> String -> [FunOptDescr cfg] -> [FunOptDescr cfg] Source #

Common definitions for -v and -h, given the list of all other options.

optionsError :: String -> IO () Source #

Terminate the program with this error message (but don't report it as an ICE, as happens with error).

data OptDescr a #

Constructors

Option [Char] [String] (ArgDescr a) String 

Instances

Instances details
Functor OptDescr 
Instance details

Defined in System.Console.GetOpt

Methods

fmap :: (a -> b) -> OptDescr a -> OptDescr b

(<$) :: a -> OptDescr b -> OptDescr a

getOpt' :: ArgOrder a -> [OptDescr a] -> [String] -> ([a], [String], [String], [String]) #

data ArgOrder a #

Constructors

RequireOrder 
Permute 
ReturnInOrder (String -> a) 

Instances

Instances details
Functor ArgOrder 
Instance details

Defined in System.Console.GetOpt

Methods

fmap :: (a -> b) -> ArgOrder a -> ArgOrder b

(<$) :: a -> ArgOrder b -> ArgOrder a

usageInfo :: String -> [OptDescr a] -> String #

data ArgDescr a #

Constructors

NoArg a 
ReqArg (String -> a) String 
OptArg (Maybe String -> a) String 

Instances

Instances details
Functor ArgDescr 
Instance details

Defined in System.Console.GetOpt

Methods

fmap :: (a -> b) -> ArgDescr a -> ArgDescr b

(<$) :: a -> ArgDescr b -> ArgDescr a

getOpt :: ArgOrder a -> [OptDescr a] -> [String] -> ([a], [String], [String]) #