retrie-1.2.1: A powerful, easy-to-use codemodding tool for Haskell.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Retrie.Options

Synopsis

Options

type Options = Options_ [Rewrite Universe] AnnotatedImports Source #

Command-line options.

data Options_ rewrites imports Source #

Constructors

Options 

Fields

data ExecutionMode Source #

Controls the ultimate action taken by apply. The default action is ExecRewrite.

Constructors

ExecDryRun

Pretend to do rewrites, show diff.

ExecRewrite

Perform rewrites.

ExecExtract

Print the resulting expression for each match.

ExecSearch

Print the matched expressions.

Instances

Instances details
Show ExecutionMode Source # 
Instance details

Defined in Retrie.Options

defaultOptions :: (Default rewrites, Default imports) => FilePath -> Options_ rewrites imports Source #

Construct default options for the given target directory.

parseOptions :: LibDir -> FixityEnv -> IO Options Source #

Parse options using the given FixityEnv.

Internal

buildGrepChain :: FilePath -> HashSet String -> [FilePath] -> GrepCommands Source #

Return a chain of grep commands to find files with relevant groundTerms If filesGiven is empty, use all *.hs files under targetDir

forFn :: Options_ x y -> [a] -> (a -> IO b) -> IO [b] Source #

forM, but concurrency and input order controled by Options.

getOptionsParser :: FixityEnv -> IO (Parser ProtoOptions) Source #

Get the options parser. The returned ProtoOptions should be passed to resolveOptions to get final Options.

getTargetFiles :: Options_ a b -> [GroundTerms] -> IO [FilePath] Source #

Find all files to target for rewriting.

parseRewritesInternal :: LibDir -> Options_ a b -> [RewriteSpec] -> IO [Rewrite Universe] Source #

Create Rewrites from string specifications of rewrites. We expose this from Retrie with a nicer type signature as parseRewrites. We have it here so we can use it with ProtoOptions.

type ProtoOptions = Options_ [RewriteSpec] [String] Source #

Options that have been parsed, but not fully resolved.

resolveOptions :: LibDir -> ProtoOptions -> IO Options Source #

Resolve ProtoOptions into Options. Parses rewrites into Rewrites, parses imports, validates options, and extends fixityEnv with any declared fixities in the target directory.

data GrepCommands Source #

Constructors

GrepCommands 

Fields

Instances

Instances details
Show GrepCommands Source # 
Instance details

Defined in Retrie.Options

Eq GrepCommands Source # 
Instance details

Defined in Retrie.Options