g      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~2 SafeN             Safe  Safe DTemplate Engine. Perform the following replacements on a line basis: script src="foo" /script ==>  script[[foo]] /script link-href="foo" rel="stylesheet" type="text/css" / ==>  styletype="text/css"[[foo]] /style None357 !"#$%&'()*+!,-./0123456789:;< =>?@ !"#  !"#$%&'()*+ SafeACRun with some cleanup scope. Regardless of exceptions/threads, all B2 actions will be run by the time it exits. The B& actions will be run in reverse order.BAdd a cleanup action to a C7 scope. If the return action is not run by the time A3 terminates then it will be run then. The argument D is E to say run the action, F- to say ignore the action (and never run it).CGHIJKABCABCGHIJKABSafeL&Like a barrier, but based on callbacksLMNOPQRLNOPQLMNOPQRNoneSTUVWXSTUVWXSTUVWXNoneCY!Run and then call a continuation.ZStrict version[AApply a modification, run an action, then undo the changes after.\Capture a continuation. The continuation should be called at most once. Calling the same continuation, multiple times, in parallel, results in incorrect behaviour.]^_`abcdefYghijZklmnopq[\]^YghijZlmnopq[\]^_`abcdefYghijZklmnopq[\Noner;Print all withTiming information and clear the information.sturvwxurvsturvwxNoney~Given a pool, and a function that breaks the S invariants, restore them They are only allowed to touch threadsLimit or todozGAdd a new task to the pool, may be cancelled by sending it an exception{pAdd a new task to the pool, may be cancelled by sending it an exception. Takes priority over everything else.|Temporarily increase the pool by 1 thread. Call the cleanup action to restore the value. After calling cleanup you should requeue onto a new thread.}Run all the tasks in the pool on the given number of works. If any thread throws an exception, the exception will be reraised.~yz{|}z{|}~yz{|}None &Some number of resources are availableWSome users are blocked (non-empty), plus an action to call once we go back to Available'number of currently available resourcesSqueue of people with how much they want and the action when it is allocated to thempA type representing an external resource which the build system should respect. There are two ways to create  s in Shake:P creates a finite resource, stopping too many actions running simultaneously.] creates a throttled resource, stopping too many actions running over a short time period.These resources are used with A when defining rules. Typically only system commands (such as ) should be run inside , not commands such as .'Be careful that the actions run within  do not themselves require further resources, or you may get a "thread blocked indefinitely in an MVar operation" exception. If an action requires multiple resources, use  to avoid deadlock.dKey used for Eq/Ord operations. To make withResources work, we require newResourceIO < newThrottleIOString used for Show+Acquire the resource and call the function.LYou should only ever releaseResource that you obtained with acquireResource. A version of 3 that runs in IO, and can be called before calling . Most people should use  instead. A version of 3 that runs in IO, and can be called before calling . Most people should use  instead. Safe  None;Generates an report given some build system profiling data. Safe This is a hot-spot, so optimisedEquivalent to toStandard . normaliseEx from Development.Shake.FilePath.SafeSafeF!  None-      !"#$% $      !"#$%!NoneF&'()*+&&'()*+Safe Drop the first directory from a ,+. Should only be used on relative paths. pdropDirectory1 "aaa/bbb" == "bbb" dropDirectory1 "aaa/" == "" dropDirectory1 "aaa" == "" dropDirectory1 "" == ""Take the first component of a ,+. Should only be used on relative paths. ^takeDirectory1 "aaa/bbb" == "aaa" takeDirectory1 "aaa/" == "aaa" takeDirectory1 "aaa" == "aaa" Normalise a ,, applying the rules:All - become . (/ on Linux, \ on Windows)foo/bar/../baz becomes foo/baz3 (not universally true in the presence of symlinks) foo/./bar becomes foo/barfoo//bar becomes foo/bar"This function is not based on the / function from the filepath. library, as that function is quite broken.*Convert to native path separators, namely \ on Windows. Convert all path separators to /, even on Windows.The extension of executables, "exe" on Windows and "" otherwise.8,0/123456789:;<=>?@ABCDEFGHIJKLMNOPQR-.STUVWXYZ[\]"Safe+Options passed to command or cmd' to control how processes are executed.fChange the current directory in the spawned process. By default uses this processes current directory.dChange the environment variables in the spawned process. By default uses this processes environment.1Add an environment variable in the child process.6Remove an environment variable from the child process. /Add some items to the prefix and suffix of the $PATH variable.! Given as the stdin( of the spawned process. By default the stdin is inherited." Given as the stdin of the spawned process.# Take the stdin from a file.$Pass the command to the shell without escaping - any arguments will be joined with spaces. By default arguments are escaped properly.% Treat the stdin/stdout/stderr messages as binary. By default ^ results use text encoding and  ByteString results use binary encoding.&Name to use with traced, or ""D for no tracing. By default traces using the name of the executable.'MAbort the computation after N seconds, will raise a failure exit code. Calls interruptProcessGroupOf and terminateProcess>, but may sometimes fail to abort the process and not timeout.(Should I include the stdout4 in the exception if the command fails? Defaults to F.)Should I include the stderr4 in the exception if the command fails? Defaults to E.*Should I echo the stdout? Defaults to E unless a Stdout result is required or you use ,.+Should I echo the stderr? Defaults to E unless a Stderr result is required or you use -.,Should I put the stdout to a file.-Should I put the stderr to a file..#Compute dependencies automatically. !"#$%&'()*+,-. !"#$%&'()*+,-. !"#$%&'()*+,-.#None_TIf two buffers can be replaced by one and a copy, do that (only if they start empty)'`abcdefghijklmnopqrstuvwxy_z{|}~`abcdefghijklmnopqrsuw` abcdefghijklmnopqrstuvwxy_z{|}~Safe   $NoneCUTF8 ByteStringASCII ByteString %None357C   &None +0A machine that takes inputs and produces outputs/gInformation about the current state of the build, obtained by either passing a callback function to ' (asynchronous output) or (= (synchronous output). Typically a build system will pass : to '<, which will poll this value and produce status messages.1 Starts out  , becomes  a target name if a rule fails.2GNumber of rules which were required, but were already in a valid state.37Number of rules which were have been built in this run.4WNumber of rules which have been built previously, but are not yet known to be required.5gNumber of rules which are currently required (ignoring dependencies that do not change), but not built.6Time spent building 2 rules in previous runs.7Time spent building 3 rules.8Time spent building 4 rules in previous runs.9Time spent building 5a rules in previous runs, plus the number which have no known time (have never been built before).3return (number of seconds, percentage, explanation):|Given a sampling interval (in seconds) and a way to display the status message, produce a function suitable for using as '8. This function polls the progress information every nR seconds, produces a status message and displays it using the display function..Typical status messages will take the form of  1m25s (15%), indicating that the build is predicted to complete in 1 minute 25 seconds (85 seconds total), and 15% of the necessary build time has elapsed. This function uses past observations to predict future behaviour, and as such, is only guessing. The time is likely to go up as well as down, and will be less accurate from a clean build (as the system has fewer past observations).FThe current implementation is to predict the time remaining (based on 9 ) and the work already done (7(). The percentage is then calculated as remaining / (done + remaining)., while time left is calculated by scaling  remaining5 by the observed work rate in this build, roughly done / time_elapsed.TGiven a list of progress inputs, what would you have suggested (seconds, percentage)8Given a trace, display information about how well we did;^Set the title of the current console window to the given text. If the environment variable $TERM is set to xtermf this uses xterm escape sequences. On Windows, if not detected as an xterm, this function uses the SetConsoleTitle API.<Call the program shake-progress if it is on the $PATH8. The program is called with the following arguments:--title=string - the string passed to progressProgram.--state=Normal , or one of  NoProgress, Normal, or Error9 to indicate what state the progress bar should be in. --value=25: - the percent of the build that has completed, if not in  NoProgress state.;The program will not be called consecutively with the same --state and --value options.nWindows 7 or higher users can get taskbar progress notifications by placing the following program in their $PATH:  ,https://github.com/ndmitchell/shake/releases.=HA simple method for displaying progress messages, suitable for using as 'X. This function writes the current progress to the titlebar every five seconds using ;, and calls any shake-progress program on the $PATH using <.0/0123456789:;<=/0123456789:;<=/ 0123456789:;<=)Safe+>Error representing all expected exceptions thrown by Shake. Problems when executing rules will be raising using this exception type.@;The target that was being built when the exception occured.A The stack of targets, where the @ is last.B)The underlying exception that was raised.>?@AB>?@AB>?@AB*Safe Given a list of files, return a list of things I can match in this directory plus a list of subdirectories and walks that apply to them. Use WalkTo when the list can be predicted in advancefoo*//"//, but must be at least 1 elementTfoo*, prefix (fixed), infix floaters, suffix e.g. *foo*bar = Stars "" ["foo"] "bar"C-A type synonym for file patterns, containing // and *%. For the syntax and semantics of C see E.Most  normaliseExd , values are suitable as C; values which match only that specific file. On Windows \ is treated as equivalent to /.You can write CE values as a literal string, or build them up using the operators +, , and -. However, beware that:On Windows, use + from Development.Shake.FilePath instead of from System.FilePath - otherwise  "//*" <.> exe results in  "//*\\.exe".If the second argument of ,& has a leading path separator (namely //) then the second argument will be returned.D Join two C values by inserting two / characters between them. Will first remove any trailing path separators on the first argument, and any leading separators on the second. "dir" <//> "*" == "dir//*"pParse a FilePattern. All optimisations I can think of are invalid because they change the extracted expressions.5Optimisations that may change the matched expressionsA C that will only match  values.A non-absolute ,.Given a pattern, and a list of path components, return a list of all matches (for each wildcard in order, what the wildcard matched).EMatch a C against a , , There are three special forms:*< matches an entire path component, excluding any separators.//U matches an arbitrary number of path components, including absolute path prefixes.** as a path component matches an arbitrary number of path components, but not absolute path prefixes. Currently considered experimental.Some examples:test.c matches test.c and nothing else.*.c matches all .c$ files in the current directory, so file.c matches, but file.h and  dir/file.c don't.//*.c matches all .c) files anywhere on the filesystem, so file.c,  dir/file.c, dir1/dir2/file.c and /path/to/file.c all match, but file.h and  dir/file.h don't.dir/*/*# matches all files one level below dir, so dir/one/file.c and dir/two/file.h match, but file.c, one/dir/file.c,  dir/file.h and dir/one/two/file.c don't.!Patterns with constructs such as  foo/../bar will never match normalised ,' values, so are unlikely to be correct.&Is the pattern free from any * and //.7Do they have the same * and // counts in the same orderEExtract the items that match the wildcards. The pair must match with E.Given the result of , substitute it back in to a  pattern. -p '?==' x ==> substitute (extract p x) p == x%CDECDECDED.None&7;CNFODefine an alias for the six type classes required for things involved in Shake /$s. Using this alias requires the ConstraintKinds extension.fTo define your own values meeting the necessary constraints it is convenient to use the extensions GeneralizedNewtypeDeriving and DeriveDataTypeable to write: ^newtype MyType = MyType (String, Bool) deriving (Show, Typeable, Eq, Hashable, Binary, NFData)BShake needs these instances on keys and values. They are used for:V is used to print out keys in errors, profiling, progress messages and diagnostics. is used because Shake indexes its database by the type of the key and value involved in the rule (overlap is not allowed for type classes and not allowed in Shake either). and G are used on keys in order to build hash maps from keys to values.  is used on values to test if the value has changed or not (this is used to support unchanging rebuilds, where Shake can avoid rerunning rules if it runs a dependency, but it turns out that no changes occurred.) The  instances are only use at runtime (never serialised to disk), so they do not have to be stable across runs. Hashable on values is not used, and only required for a consistent interface.  is used to serialize keys and values into Shake's build database; this lets Shake cache values across runs and implement unchanging rebuilds. R is used to avoid space and thunk leaks, especially when Shake is parallelized.F      F F     0None1None+C !"#$%&'()*+,-  !#%& !"#$%&'()*+,-2None+3GAn equality check and a cost.HThe equality check was cheap.IIThe equality check was expensive, as the results are not trivially equal.JThe values are not equal.K!The verbosity data type, used by W.LDon't print any messages.M0Only print essential messages, typically errors.NPrint errors and #  command-name (for  file-name) when running a 3 command.O3Print errors and full command lines when running a 4 or  command.PIPrint errors, full command line and status messages when starting a rule.Q?Print messages for virtually everything (mostly for debugging)..+Internal type, copied from Hide in UniplateRXOptions to control the execution of Shake, usually specified by overriding fields in y:  y{U=4, Y=["report.html"]}The /$ instance for this type reports the i and j$ fields as having the abstract type . , because /$ cannot be defined for functions or 0s.T Defaults to .shake[. The directory used for storing Shake metadata files. All metadata files will be named T/.shake. file-name , for some  file-name . If the T- directory does not exist it will be created.U Defaults to 19. Maximum number of rules to run in parallel, similar to  make --jobs=Nz. For many build systems, a number equal to or slightly less than the number of physical processors works well. Use 02 to match the detected number of processors (when 0, getShakeOptions, will return the number of threads used).V Defaults to "1" . The version number of your build rules. Change the version number to force a complete rebuild, such as when making significant changes to the rules that require a wipe. The version number should be set in the source code, and not passed on the command line.W Defaults to N/. What level of messages should be printed out.X Defaults to FU. Operate in staunch mode, where building continues even after errors, similar to make --keep-going.Y Defaults to []. Write a profiling report to a file, showing which rules rebuilt, why, and how much time they took. Useful for improving the speed of your build systems. If the file extension is .json it will write JSON data; if .js! it will write Javascript; if .trace' it will write trace events (load into about://tracing- in Chrome); otherwise it will write HTML.Z Defaults to -. Perform sanity checks during building, see r for details.[=Directories in which the files will be tracked by the linter.\IFile patterns which are ignored from linter tracking, a bit like calling 5 in every rule.] Defaults to []=. Additional options to be passed to all command invocations.^ Defaults to  109. How often to flush Shake metadata files in seconds, or  to never flush explicitly. It is possible that on abnormal termination (not Haskell exceptions) any rules that completed in the last ^ seconds will be lost._ Defaults to 0. Assume all build objects are clean/dirty, see u* for details. Can be used to implement  make --touch.` Defaults to []. A list of substrings that should be abbreviated in status messages, and their corresponding abbreviation. Commonly used to replace the long paths (e.g. .make/i586-linux-gcc/output) with an abbreviation (e.g. $OUT).a Defaults to F. Write a message to T/.shake.storage.log whenever a storage event happens which may impact on the current stored progress. Examples include database version number changes, database compaction or corrupt files.b Defaults to E . Change stdout and stderr' to line buffering while running Shake.c Defaults to F5. Print timing information for each stage at the end.d Default to E.. Should you run command line actions, set to F to skip actions whose output streams and exit code are not used. Useful for profiling the non-command portion of the build system.e Default to m*. How to check if a file has changed, see l for details.f Default to Ew. After running a rule to create a file, is it an error if the file does not exist. Provided for compatibility with make and ninja+ (which have ugly file creation semantics).g Default to []I. After the build system completes, write a list of all files which were liveq in that run, i.e. those which Shake checked were valid or rebuilt. Produces best answers if nothing rebuilds.h Defaults to F. Ignore any differences in V.iDefaults to no action. A function called when the build starts, allowing progress to be reported. The function is called on a separate thread, and that thread is killed when the build completes. For applications that want to display progress messages, =D is often sufficient, but more advanced users should look at the / data type.jDefaults to writing using 1B. A function called to output messages from Shake, along with the Kd at which that message should be printed. This function will be called atomically from all other j functions. The K, will always be greater than or higher than W.kgThis a map which can be used to store arbitrary extra information that a user may need when writing Rulevs. The correct way to use this is to define a (hidden) newtype to use as a key, so that conflicts cannot occur.l8How should you determine if a file has changed, used by e . The most common values are m (very fast, touch causes files to rebuild) and p (a bit slower, touch( does not cause input files to rebuild).mhCompare equality of modification timestamps, a file has changed if its last modified time changes. A touch^ will force a rebuild. This mode is fast and usually sufficiently accurate, so is the default.nZCompare equality of file contents digests, a file has changed if its digest changes. A touchb will not force a rebuild. Use this mode if modification times on your file system are unreliable.oA file is rebuilt if both its modification time and digest have changed. For efficiency reasons, the modification time is checked first, and if that has changed, the digest is checked.pUse o for input/source files and m for output files.qOA file is rebuilt if either its modification time or its digest has changed. A touchw will force a rebuild, but even if a files modification time is reset afterwards, changes will also cause a rebuild.r&Which lint checks to perform, used by Z.sThe most basic form of linting. Checks that the current directory does not change and that results do not change after they are first written. Any calls to needed9 will assert that they do not cause a rule to be rebuilt.t?Track which files are accessed by command line programs using  $https://github.com/jacereda/fsatracefsatrace.u:The current assumptions made by the build system, used by _. These options allow the end user to specify that any rules run are either to be treated as clean, or as dirty, regardless of what the build system thinks.?These assumptions only operate on files reached by the current 6A commands. Any other files in the database are left unchanged.vNAssume that all rules reached are dirty and require rebuilding, equivalent to 7 always returning  . Useful to undo the results of w, for benchmarking rebuild speed and for rebuilding if untracked dependencies have changed. This assumption is safe, but may cause more rebuilding than necessary.wbThis assumption is unsafe, and may lead to incorrect build results in this run, and in future runsr. Assume and record that all rules reached are clean and do not require rebuilding, provided the rule has a 7 and has been built before. Useful if you have modified a file in some inconsequential way, such as only the comments or whitespace, and wish to avoid a rebuild.xNThis assumption is unsafe, and may lead to incorrect build results in this run. Assume that all rules reached are clean in this run. Only useful for benchmarking, to remove any overhead from running 7 operations.yThe default set of R.?GHIJKLMNOPQ.23RSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy456789:;<>/0123456789GHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyGHIJKLMNOPQ.23RSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy456789:;<8None357N=IIs the exception asyncronous, not a "coding error" that should be ignored>?@AStorage optionsLogging functionWitnessExecuteBCD=A>?@ABCD=9None +7CE*Given a Key, find the value stored on diskFIGiven both Values, see if they are equal and how expensive that check wasGKGiven a stack and a key, either raise an exception or successfully build itH"the result associated with the KeyIwhen it was actually runJ#the step for deciding if it's validK#dependencies (don't run them early)L/how long it took when it was last run (seconds)MQa trace of the expensive operations (start/end in seconds since beginning of run)NI have a valueO#I have been run and raised an errorPLoaded from the databaseQ,Currently checking if I am valid or buildingR2I am only here because I got into the Intern tableSNInvariant: The database does not have any cycles where a Key depends on itselfTlogging functionU(message, start, end)VWait for a set of actions to complete. If the action returns True, the function will not be called again. If the first argument is True, the thing is ended.WSReturn either an exception (crash), or (how much time you spent waiting, the value)XGiven a map of representing a dependency order (with a show for error messages), find an ordering for the items such that no item points to an item before itself. Raise an error if you end up with a cycle.YCEliminate all errors from the database, pretending they don't existSZ[\]EFG^_`abcdeHIJKLMfNOPQRSghijklTmnopUqrstuvwxyz{|}~VWXY\]EFG^SpUqwyz|W4Z[\]EFG^_`abcdeHIJKLMfNOPQRSghijklTmnopUqrstuvwxyz{|}~VWXY:None&7;CN%zThe z monad, use  to raise  actions into it, and 0 to execute files. Action values are used by  and . The z$ monad tracks the dependencies of a |.{LDefine a set of rules. Rules can be created with calls to functions such as ; or (. Rules are combined with either the " instance, or (more commonly) the  instance and do; notation. To define your own custom types of rule, see Development.Shake.Rule.|gDefine a pair of types that can be used by Shake rules. To import all the type classes required see Development.Shake.Classes.A |) instance for a class of artifacts (e.g. files ) provides:3How to identify individual artifacts, given by the key type, e.g. with file names.7How to describe the state of an artifact, given by the value' type, e.g. the file modification time.BA way to compare two states of the same individual artifact, with ~ returning either H or J.6A way to query the current state of an artifact, with }$ returning the current state, or = if there is no current state (e.g. the file does not exist).DChecking if an artifact needs to be built consists of comparing two values of the same key with ~-. The first value is obtained by applying } to the key] and the second is the value stored in the build database after the last successful build.aAs an example, below is a simplified rule for building files, where files are identified by a ,U and their state is identified by a hash of their contents (the builtin functions  and ; provide a similar rule). newtype File = File FilePath deriving (Show, Typeable, Eq, Hashable, Binary, NFData) newtype Modtime = Modtime Double deriving (Show, Typeable, Eq, Hashable, Binary, NFData) getFileModtime file = ... instance Rule File Modtime where storedValue _ (File x) = do exists <- System.Directory.doesFileExist x if exists then Just <$> getFileModtime x else return Nothing equalValue _ _ t1 t2 = if t1 == t2 then EqualCheap else NotEqual This example instance means:A value of type File& uniquely identifies a generated file.A value of type Modtime/ will be used to check if a file is up-to-date.It is important to distinguish | instances from actual rules. |N instances are one component required for the creation of rules. Actual rules are functions from a key to an z; they are added to { using the  function.2A rule can be created for the instance above with: y-- Compile foo files; for every foo output file there must be a -- single input file named "filename.foo". compileFoo :: { () compileFoo = 7 (Just . compile) where compile :: File -> z Modtime compile (File outputFile) = do -- figure out the name of the input file let inputFile = outputFile <.> "foo"   $  "fooCC" inputFile outputFile -- return the (new) file modtime of the output file: getFileModtime outputFile Note: In this example, the timestamps of the input files are never used, let alone compared to the timestamps of the ouput files. Dependencies between output and input files are not expressed by |6 instances. Dependencies are created automatically by .5For rules whose values are not stored externally, } should return  with a sentinel value and ~ should always return H for that sentinel.} [Required] Retrieve the value associated with a key, if available.MAs an example for filenames/timestamps, if the file exists you should return ( the timestamp, but otherwise return .~ [Optional]> Equality check, with a notion of how expensive the check was.4Add a rule to build a key, returning an appropriate z if the key matches, or J otherwise. All rules at a given priority must be disjoint on all used keya values, with at most one match. Rules have priority 1 by default, which can be modified with .Change the priority of a given set of rules, where higher priorities take precedence. All matching rules at a given priority must be disjoint, or an error is raised. All builtin Shake rules have priority between 0 and 1. Excessive use of  is discouraged. As an example:  4 $ "hello.*" %> \out ->  writeFile' out "hello.*"  8 $ "*.txt" %> \out ->  writeFile' out "*.txt" In this example  hello.txtI will match the second rule, instead of raising an error about ambiguity.The  function obeys the invariants:  p1 ( p2 r1) ===  p1 r1  p1 (r1 >> r2) ===  p1 r1 >>  p1 r2 Change the matching behaviour of rules so rules do not have to be disjoint, but are instead matched in order. Only recommended for small blocks containing a handful of rules.  $ do "hello.*" %> \out ->  writeFile'& out "hello.*" "*.txt" %> \out ->  writeFile' out "*.txt" In this example  hello.txtS will match the first rule, instead of raising an error about ambiguity. Inside  the  of each rule is not used to determine which rule matches, but the resulting match uses that priority compared to the rules outside the  block.BRun an action, usually used for specifying top-level requirements. main =  y $ do  $ do b <- < "file.src" when b $  ["file.out"] This  builds file.out, but only if file.src exists. The 1 will be run in every build execution (unless M is used), so only cheap operations should be performed. All arguments to & may be run in parallel, in any order.%For the standard requirement of only !ing a fixed list of files in the  , see =.}Remove all actions specified in a set of rules, usually used for implementing command line specification of what to build.!If an exception is raised by the z, perform some . After an z, perform some  , even if there is an exception..Internal main function (not exported publicly)Execute a rule, returning the associated values. If possible, the rules will be run in parallel. This function requires that appropriate rules have been added with  . All key values passed to  become dependencies of the z.Turn a normal exception into a ShakeException, giving it a stack and printing it out if in staunch mode. If the exception is already a ShakeException (e.g. it's a child of ours who failed and we are rethrowing) then do nothing with it.+Apply a single rule, equivalent to calling / with a singleton list. Where possible, use  to allow parallelism.Get the initial R1, these will not change during the build process.Get the current /$ structure, as would be returned by i.bWrite an action to the trace list, along with the start/end time of running the IO action. The  and 4 functions automatically call 5. The trace list is used for profile reports (see Y). By default H prints some useful extra context about what Shake is building, e.g.: !# traced message (for myobject.o)To suppress the output of > (for example you want more control over the message using  ), use the  combinator.<Write an unimportant message to the output, only shown when W is higher than normal (O or above). The output will not be interleaved with any other Shake messages (other than those generated by system commands).CWrite a normal priority message to the output, only supressed when W is M or Lv. The output will not be interleaved with any other Shake messages (other than those generated by system commands).>Write an important message to the output, only supressed when W is Lv. The output will not be interleaved with any other Shake messages (other than those generated by system commands).3Get the current verbosity level, originally set by WU. If you want to output information to the console, you are recommended to use  /  / c, which ensures multiple messages are not interleaved. The verbosity can be modified locally by .HRun an action with a particular verbosity level. Will not update the W returned by $ and will not have any impact on Q tracing.Run an action with M/ verbosity, in particular messages produced by  (including from  or 4<) will not be printed to the screen. Will not update the W returned by  and will not turn off any Q tracing.;Track that a key has been used by the action preceeding it.>Track that a key has been changed by the action preceeding it.5Allow any matching key to violate the tracking rules.ZCreate a finite resource, given a name (for error messages) and a quantity of the resource that exists. Shake will ensure that actions using the same finite resource do not execute in parallel. As an example, only one set of calls to the Excel API can occur at one time, therefore Excel is a finite resource of quantity 1. You can write:  >{? =2} $ do = ["a.xls","b.xls"] excel <-  "Excel" 1 "*.xls" ; \out ->  excel 1 $  "excel" out ... Now the two calls to excel will not happen in parallel.As another example, calls to compilers are usually CPU bound but calls to linkers are usually disk bound. Running 8 linkers will often cause an 8 CPU system to grid to a halt. We can limit ourselves to 4 linkers with: disk <-  "Disk" 4 = [show i + "exe" | i <- [1..100]] "*.exe" ; \out ->  disk 1 $  "ld -o" [out] ... "*.o" ; \out ->  "cl -o" [out] ... ^Create a throttled resource, given a name (for error messages) and a number of resources (the +) that can be used per time period (the  in seconds). Shake will ensure that actions using the same throttled resource do not exceed the limits. As an example, let us assume that making more than 1 request every 5 seconds to Google results in our client being blacklisted, we can write:  google <-  "Google" 1 5 "*.url" ; \out -> do  google 1 $ # "wget" ["http://google.com?q=" ++ @ out] "-O" [out] Now we will wait at least 5 seconds after querying Google before performing another query. If Google change the rules to allow 12 requests per minute we can instead use  "Google" 12 60, which would allow greater parallelisation, and avoid throttling entirely if only a small number of requests are necessary.eIn the original example we never make a fresh request until 5 seconds after the previous request has  completedH. If we instead want to throttle requests since the previous request started we can write:  google <-  "Google" 1 5 "*.url" ; \out -> do  google 1 $ return () # "wget" ["http://google.com?q=" ++ @ out] "-O" [out] =However, the rule may not continue running immediately after  completes, so while we will never exceed an average of 1 request every 5 seconds, we may end up running an unbounded number of requests simultaneously. If this limitation causes a problem in practice it can be fixed.IRun an action which uses part of a finite resource. For more details see '. You cannot depend on a rule (e.g. need) while a resource is held.Run an action which uses part of several finite resources. Acquires the resources in a stable order, to prevent deadlock. If all rules requiring more than one resource acquire those resources with a single call to , resources will not deadlock. A version of 3 that runs in IO, and can be called before calling . Most people should use  instead.Given an action on a key, produce a cached version that will execute the action at most once per key. Using the cached result will still result include any dependencies that the action requires. Each call to D creates a separate cache that is independent of all other calls to .This function is useful when creating files that store intermediate values, to avoid the overhead of repeatedly reading from disk, particularly if the file requires expensive parsing. As an example:  digits <- ] $ \file -> do src <- readFile' file return $ length $ filter isDigit src "*.digits" ; \x -> do v1 <- digits ( dropExtension x) v2 <- digits ( dropExtension x) A x $ show (v1,v2) To create the result MyFile.txt.digits the file  MyFile.txtB will be read and counted, but only at most once per execution.Run an action without counting to the thread limit, typically used for actions that execute on remote machines using barely any local CPU resources. Unsafe as it allows the U< limit to be exceeded. You cannot depend on a rule (e.g. needI) while the extra thread is executing. If the rule blocks (e.g. calls ^) then the extra thread may be used by some other action. Only really suitable for calling 'cmd'/'command'.5Execute a list of actions in parallel. In most cases need6 will be more appropriate to benefit from parallelism.ZRun an action but do not depend on anything the action uses. A more general version of  orderOnly.ez{|}~*Fz{|}~Az  {|}~BNone+47CN LThis function is not actually exported, but Haddock is buggy. Please ignore.Returns E if the file exists. The existence of the file is tracked as a dependency, and if the file is created or deleted the rule will rerun in subsequent builds.You should not call 3 on files which can be created by the build system.Returns E if the directory exists. The existence of the directory is tracked as a dependency, and if the directory is created or delete the rule will rerun in subsequent builds.You should not call 9 on directories which can be created by the build system.Return + the value of the environment variable, or  if the variable is not set. The environment variable is tracked as a dependency, and if it changes the rule will rerun in subsequent builds. This function is a tracked version of 'getEnv'/'lookupEnv' from the base library. flags <- getEnv "CFLAGS" cmd' "gcc -c" [out] (maybe [] words flags) Return the value of the environment variable (second argument), or the default value (first argument) if it is not set. Similar to . ,flags <- getEnvWithDefault "-Wall" "CFLAGS" cmd "gcc -c" [out] flags `Get the contents of a directory. The result will be sorted, and will not contain the entries . or .. (unlike the standard Haskell version). The resulting paths will be relative to the first argument. The result is tracked as a dependency, and if it changes the rule will rerun in subsequent builds.%It is usually simpler to call either  or .|Get the files anywhere under a directory that match any of a set of patterns. For the interpretation of the patterns see E. All results will be relative to the directory argument. The result is tracked as a dependency, and if it changes the rule will rerun in subsequent builds. Some examples: XgetDirectoryFiles "Config" ["//*.xml"] -- All .xml files anywhere under the Config directory -- If Config/foo/bar.xml exists it will return ["foo/bar.xml"] getDirectoryFiles "Modules" ["*.hs","*.lhs"] -- All .hs or .lhs in the Modules directory -- If Modules/foo.hs and Modules/foo.lhs exist, it will return ["foo.hs","foo.lhs"]?If you require a qualified file name it is often easier to use "" as the ,G argument, for example the following two expressions are equivalent: ifmap (map ("Config" </>)) (getDirectoryFiles "Config" ["//*.xml"]) getDirectoryFiles "" ["Config//*.xml"]MIf the first argument directory does not exist it will raise an error. If fooH does not exist, then the first of these error, but the second will not. VgetDirectoryFiles "foo" ["//*"] -- error getDirectoryFiles "" ["foo//*"] -- returns []HThis function is tracked and serves as a dependency. If a rule calls getDirectoryFiles "" ["*.c"] and someone adds foo.cL to the directory, that rule will rebuild. If someone changes one of the .c files, but the list of .c files doesn't change, then it will not rebuild. As a consequence of being tracked, if the contents change during the build (e.g. you are generating .cs files in this directory) then the build not reach a stable point, which is an error - detected by running with --lint?. You should only call this function returning source files.For an untracked variant see .2Get the directories in a directory, not including . or ... All directories are relative to the argument directory. The result is tracked as a dependency, and if it changes the rule will rerun in subsequent builds. The rules about creating entries described in  also apply here. rgetDirectoryDirs "/Users" -- Return all directories in the /Users directory -- e.g. ["Emily","Henry","Neil"] A version of # that is in IO, and thus untracked.eRemove all files and directories that match any of the patterns within a directory. Some examples: > "output" ["//*"] -- delete everything inside 'output' 3 "output" ["//"] -- delete 'output' itself ; "." ["//*.hi","//*.o"] -- delete all '.hi' and '.o' files |If the argument directory is missing no error is raised. This function will follow symlinks, so should be used with care.-This function is often useful when writing a clean- action for your build system, often as a phony rule.Remove files, like R, but executed after the build completes successfully. Useful for implementing clean< actions that delete files Shake may have open for building.2 &CNone +7CNdArguments: options; is the file an input; a message for failure if the file does not exist; filenameLThis function is not actually exported, but Haddock is buggy. Please ignore.Add a dependency on the file arguments, ensuring they are built before continuing. The file arguments may be built in parallel, in any order. This function is particularly necessary when calling  or 4. As an example:  "//*.rot13"  \out -> do let src = D out  [src]  "rot13" [src] "-o" [out] Usually need [foo,bar] is preferable to need [foo] >> need [bar]H as the former allows greater parallelism, while the latter requires foo- to finish building before starting to build bar.8This function should not be called with wildcards (e.g. *.txt - use getDirectoryFiles1 to expand them), environment variables (e.g. $HOME - use getEnvw to expand them) or directories (directories cannot be tracked directly - track files within the directory instead).Like  , but if Z is set, check that the file does not rebuild. Used for adding dependencies on files that have already been used in this rule.;Track that a file was read by the action preceeding it. If ZN is activated then these files must be dependencies of this rule. Calls to " are automatically inserted in t mode.>Track that a file was written by the action preceeding it. If Z is activated then these files must either be the target of this rule, or never referred to by the build system. Calls to  are automatically inserted in t mode.2Allow accessing a file in this rule, ignoring any 'trackRead'\/'trackWrite' calls matching the pattern.SRequire that the argument files are built by the rules, used to specify the target. main =  y $ do  ["Main.exe"] ... This program will build Main.exe/, given sufficient rules. All arguments to all 1 calls may be built in parallel, in any order.%This function is defined in terms of  and , use * if you need more complex targets than  allows.Declare a Make-style phony action. A phony target does not name a file (despite living in the same namespace as file rules); rather, it names some action to be executed when explicitly requested. You can demand  rules using . (And &, although that's not recommended.)YPhony actions are intended to define recipes that can be executed by the user. If you  a phony action in a rule then every execution where that rule is required will rerun both the rule and the phony action. However, note that phony actions are never executed more than once in a single build run. In make, the .PHONYx attribute on non-file-producing rules has a similar effect. However, while in make it is acceptable to omit the .PHONY attribute as long as you don't create the file in question, a Shake rule which behaves this way will fail lint. Use a phony rule! For file-producing rules which should be rerun every execution of Shake, see E.A predicate version of  , return  with the z for the matching rules.Infix operator alias for /, for sake of consistency with normal rules.<Define a rule to build files. If the first argument returns EL for a given file, the second argument will be used to build it. Usually  is sufficient, but _ gives additional power. For any file used by the build system, only one rule should return EO. This function will create the directory for the result file, if necessary. (all isUpper . @)  \out -> do let src = F* out $ map toLower $ takeBaseName out A out . map toUpper =<< G src If the z_ completes successfully the file is considered up-to-date, even if the file has not changed.aDefine a set of patterns, and if any of them match, run the associated rule. Defined in terms of . Think of it as the OR (||) equivalent of .Define a rule that matches a C, see E for the pattern rules. Patterns with no wildcards have higher priority than those with wildcards, and no file required by the system may be matched by more than one pattern at the same priority (see  and i to modify this behaviour). This function will create the directory for the result file, if necessary.  "*.asm.o"  \out -> do let src = D out  [src]  "as" [src] "-o" [out] MTo define a build system for multiple compiled languages, we recommend using .asm.o, .cpp.o, .hs.oH, to indicate which language produces an object file. I.e., the file foo.cpp produces object file  foo.cpp.o.6Note that matching is case-sensitive, even on Windows.If the z_ completes successfully the file is considered up-to-date, even if the file has not changed.              HNone9Get a checksum of a list of files, suitable for using as Vn. This will trigger a rebuild when the Shake rules defined in any of the files are changed. For example: main = do ver <-  ["Shakefile.hs"]  shakeArgs y{V = ver} ... BTo automatically detect the name of the current file, turn on the TemplateHaskell extension and write -$(LitE . StringL . loc_filename <$> location).IThis feature can be turned off during development by passing the flag --no-rule-version or setting h to E. Deprecated: Please use command or cmd? instead. This function will be removed in a future version.lExecute a system command. This function will raise an error if the exit code is non-zero. Before running  make sure you  any required files. Deprecated: Please use command or cmd instead, with Cwd7. This function will be removed in a future version.Execute a system command with a specified current working directory (first argument). This function will raise an error if the exit code is non-zero. Before running  make sure you  any required files.  "/usr/MyDirectory" "pwd" []  Deprecated: Please use command or cmd instead, with Stdout or Stderr7. This function will be removed in a future version.$Execute a system command, returning (stdout,stderr)W. This function will raise an error if the exit code is non-zero. Before running  make sure you  any required files.copyFile' old new copies the existing file from old to new . The old& file will be tracked as a dependency.copyFileChanged old new copies the existing file from old to new', if the contents have changed. The old& file will be tracked as a dependency.Read a file, after calling 4. The argument file will be tracked as a dependency.Write a file, lifted to the z monad. A version of _ which also splits the result into lines. The argument file will be tracked as a dependency. A version of " which writes out a list of lines.4Write a file, but only if the contents would change.Create a temporary file in the temporary directory. The file will be deleted after the action completes (provided the file is not still open). The , will not have any file extension, will exist, and will be zero bytes long. If you require a file with a specific name, use .Create a temporary directory inside the system temporary directory. The directory will be deleted after the action completes.A  version of .-Execute two operations in parallel, based on .None35KLNThe arguments to  - see  for examples and semantics.A type annotation, equivalent to the first argument, but in variable argument contexts, gives a clue as to what return type is expected (not actually enforced).`A class for specifying what results you want to collect from a process. Values are formed of , ,  and tuples of those.The allowable ^"-like values that can be captured.Collect the command line used for the process. This command line will be approximate - suitable for user diagnostics, but not for direct execution.OCollect the time taken to execute the process. Can be used in conjunction with B to write helper functions that print out the time of a result.  timer :: ( r, MonadIO m) => (forall r . & r => m r) -> m r timer act = do ( t,  x, r) <- act liftIO $ putStrLn $ "Command " ++ x ++ " took " ++ show t ++ " seconds" return r run :: IO () run = timer $  "ghc --version"  Collect the m of the process. If you do collect the process handle, the command will run asyncronously and the call to 'cmd'/'command'7 will return as soon as the process is spawned. Any 'Stdout'\/'Stderr'$ captures will return empty strings. Collect the = of the process. If you do not collect the exit code, any  will cause an exception. Collect the stdout and stderr! of the process. If used, the stderr and stdout8 will not be echoed to the terminal, unless you include * and +". The value type may be either ^, or either lazy or strict  ByteString. Collect the stderr! of the process. If used, the stderr8 will not be echoed to the terminal, unless you include +". The value type may be either ^, or either lazy or strict  ByteString. Collect the stdout! of the process. If used, the stdout8 will not be echoed to the terminal, unless you include *". The value type may be either ^, or either lazy or strict  ByteString.Parse the FSATrace structure Deprecated: Use  4. This function will be removed in a future version.Add a prefix and suffix to the $PATH# environment variable. For example: opt <-  ["/usr/special"] []  opt "userbinary --version" Would prepend  /usr/special to the current $PATH , and the command would pick /usr/special/userbinary+, if it exists. To add other variables see . Deprecated: Use 4. This function will be removed in a future version.6Add a single variable to the environment. For example: opt <-  [("CFLAGS","-O2")]  opt "gcc -c main.c" #Would add the environment variable $CFLAGS with value -O2. If the variable $CFLAGSG was already defined it would be overwritten. If you wish to modify $PATH see . <Given explicit operations, apply the advance ones, like skiptrace track/autodep!TGiven a shell command, call the continuation with the sanitised exec-style arguments" Parse the 1 entries, ignoring anything you don't understand.#UGiven a very explicit set of CmdOption, translate them to a General.Process structure$FApply all environment operations, to produce a new environment to use.%If the user specifies a custom $PATH, and not Shell, then try and resolve their exe ourselves. Tricky, because on Windows it doesn't look in the $PATH first.&Given a list of directories, and a file name, return the complete path if you can find it. Like findExecutable, but with a custom PATH.)Execute a system command. Before running  make sure you + any files that are used by the command.2This function takes a list of options (often just [], see d for the available options), the name of the executable (either a full name, or a program on the $PATH2) and a list of arguments. The result is often ()%, but can be a tuple containg any of ,  and . Some examples: i [] "gcc" ["-c","myfile.c"] -- compile a file, throwing an exception on failure  c <- W [] "gcc" ["-c",myfile] -- run a command, recording the exit code ( c,  err) <- Y [] "gcc" ["-c","myfile.c"] -- run a command, recording the exit code and error output  out <- O [] "gcc" ["-MM","myfile.c"] -- run a command, recording the output  [P "generated"] "gcc" ["-c",myfile] -- run a command in a directory Unless you retrieve the  using , any ' will throw an error, including the . in the exception message. If you capture the  or N, that stream will not be echoed to the console, unless you use the option * or +. If you use  inside a doc block and do not use the result, you may get a compile-time error about being unable to deduce . To avoid this error, use .By default the stderrZ stream will be captured for use in error messages, and also echoed. To only echo pass ) FN, which causes no streams to be captured by Shake, and certain programs (e.g. gcc.) to detect they are running in a terminal. A version of \ where you do not require any results, used to avoid errors about being unable to deduce .)Execute a system command. Before running  make sure you + any files that are used by the command.String9 arguments are treated as whitespace separated arguments.[String], arguments are treated as literal arguments. arguments are used as options.HAs some examples, here are some calls, and the resulting command string:   $ F "git log --pretty=" "oneline" -- git log --pretty= oneline   $ F "git log --pretty=" ["oneline"] -- git log --pretty= oneline   $ E "git log" ("--pretty=" ++ "oneline") -- git log --pretty=oneline   $ F "git log" ("--pretty=" ++ "one line") -- git log --pretty=one line   $ H "git log" ["--pretty=" ++ "one line"] -- git log "--pretty=one line" [More examples, including return values, see this translation of the examples given for the  function: () <- h "gcc -c myfile.c" -- compile a file, throwing an exception on failure   $ T "gcc -c myfile.c" -- alternative to () <- binding.  c <- [ "gcc -c" [myfile] -- run a command, recording the exit code ( c,  err) <- ] "gcc -c myfile.c" -- run a command, recording the exit code and error output  out <- S "gcc -MM myfile.c" -- run a command, recording the output  (# "generated") "gcc -c" [myfile] :: z, () -- run a command in a directory #When passing file arguments we use [myfile] so that if the myfile4 variable contains spaces they are properly escaped. If you use  inside a doc block and do not use the result, you may get a compile-time error about being unable to deduce *. To avoid this error, bind the result to ()-, or include a type signature, or use the   function.The ! function can also be run in the  monad, but then &? is ignored and command lines are not echoed. As an example:  ( "generated") $ "gcc -c myfile.c" :: IO () ]'()*+,-./0123456789:;<=>? !"#$%&@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]3  !"#$%&'()*+,-.3  !"#$%&'()*+,-.:'()*+,-./0123456789:;<=>? !"#$%&@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]INone^Require the user to press y before continuing._Replace exceptions with F.`7Require a condition to be true, or exit with a message.a^b_`aa^b_`JNone+7CNWDefine a rule for building multiple files at the same time. Think of it as the AND (&&) equivalent of =. As an example, a single invocation of GHC produces both .hi and .o files: ["*.o","*.hi"]  \[o,hi] -> do let hs = o [ "hs" % ... -- all files the .hs import  "ghc -c" [hs] ?However, in practice, it's usually easier to define rules with  and make the .hi depend on the .o9. When defining rules that build multiple files, all the C* values must have the same sequence of // and *j wildcards in the same order. This function will create directories for the result files, if necessary.mDefine a rule for building multiple files at the same time, a more powerful and more dangerous version of . Think of it as the AND (&&) equivalent of .Given an application  test &?> ..., test should return Just^ if the rule applies, and should return the list of files that will be produced. This list mustI include the file passed as an argument and should obey the invariant: SforAll $ \x ys -> test x == Just ys ==> x `elem` ys && all ((== Just ys) . test) ys6As an example of a function satisfying the invariaint:  test x | \& x `elem` [".hi",".o"] = Just [X x Y "hi", X x Y "o"] test _ = Nothing Regardless of whether Foo.hi or Foo.o( is passed, the function always returns [Foo.hi, Foo.o]. cdefghijcdefghijKNone&+7CNaAdd extra information which rules can depend on. An oracle is a function from a question type q, to an answer type aa. As an example, we can define an oracle allowing you to depend on the current version of GHC: enewtype GhcVersion = GhcVersion () deriving (Show,Typeable,Eq,Hashable,Binary,NFData) rules = do  $ \(GhcVersion _) -> fmap L $ < "ghc --numeric-version" :: Action String ... rules ... If a rule calls  (GhcVersion ())J, that rule will be rerun whenever the GHC version changes. Some notes: We define  GhcVersion with a newtype around (), allowing the use of GeneralizedNewtypeDeriving6. All the necessary type classes are exported from Development.Shake.Classes. Each call to ' must use a different type of question.Actions passed to  will be run in every build they are required, even if nothing else changes, so be careful of slow actions. If the result of an oracle does not change it will not invalidate any rules depending on it. To always rerun files rules see E.If the value returned by  is ignored then M may help avoid ambiguous type messages. Alternatively, use the result of  , which is  restricted to the correct type.FAs a more complex example, consider tracking Haskell package versions: newtype GhcPkgList = GhcPkgList () deriving (Show,Typeable,Eq,Hashable,Binary,NFData) newtype GhcPkgVersion = GhcPkgVersion String deriving (Show,Typeable,Eq,Hashable,Binary,NFData) rules = do getPkgList <- - $ \GhcPkgList{} -> do Stdout out <-  "ghc-pkg list --simple-output" return [(reverse b, reverse a) | x <- words out, let (a,_:b) = break (== '-') $ reverse x] getPkgVersion <-  $ \(GhcPkgVersion pkg) -> do pkgs <- getPkgList $ GhcPkgList () return $ lookup pkg pkgs "myrule" %> \_ -> do getPkgVersion $ GhcPkgVersion "shake" ... rule using the shake version ... >Using these definitions, any rule depending on the version of shake should call %getPkgVersion $ GhcPkgVersion "shake" to rebuild when shake is upgraded.&Get information previously added with <. The question/answer types must match those provided to .&Get information previously added with w. The second argument is not used, but can be useful to fix the answer type, avoiding ambiguous type error messages.klmnoklmnoMNoneNDefine order-only dependencies, these are dependencies that will always be built before continuing, but which aren't dependencies of this action. Mostly useful for defining generated dependencies you think might be real dependencies. If they turn out to be real dependencies, you should add an explicit dependency afterwards. "source.o" %> \out -> do  ["header.h"] () <- cmd5 "gcc -c source.c -o source.o -MMD -MF source.m" neededMakefileDependencies "source.m" If header.h is included by source.c then the call to needMakefileDependenciesk will cause it to be added as a real dependency. If it isn't, then the rule won't rebuild if it changes.pppNNone+7CNiAlways rerun the associated action. Useful for defining rules that query the environment. For example: "ghcVersion.txt" ; \out -> do  O stdout <-  "ghc --numeric-version" P out stdout  In make, the .PHONY8 attribute on file-producing rules has a similar effect. Note that M is applied when a rule is executed. Modifying an existing rule to insert  will not$ cause that rule to rerun next time. qrstuvwxyuqrstuvwxyQNone[Main entry point for running Shake build systems. For an example see the top of the module Development.Shake . Use R% to specify how the system runs, and {V to specify what to build. The function will throw an exception if the build fails.$To use command line flags to modify R see R.SNoneiRun a build system using command line arguments for configuration. The available flags are those from !, along with a few additional make. compatible flags that are not represented in R , such as --print-directory-. If there are no file arguments then the {8 are used directly, otherwise the file arguments are ed (after calling ). As an example: main =  y{T = "_make", i = = } $ do  "clean" $ T "_make" ["//*"] 8 ["_make/neil.txt","_make/emily.txt"] "_make/*.txt" + \out -> ... build action here ... +This build system will default to building neil.txt and  emily.txtW, while showing progress messages, and putting the Shake files in locations such as _make/.database". Some example command line flags:main --no-progress! will turn off progress messages.main -j6 will build on 6 threads. main --help( will display a list of supported flags. main clean. will not build anything, but will remove the _make! directory, including the any T.main _make/henry.txt will not build neil.txt or  emily.txt, but will instead build  henry.txt. A version of I with more flexible handling of command line arguments. The caller of  can add additional flags (the second argument) and chose how to convert the flags/arguments into rules (the third argument). Given: . opts flags (\flagValues argValues -> result) opts is the initial R` value, which may have some fields overriden by command line flags. This argument is usually y&, perhaps with a few fields overriden.flags8 is a list of flag descriptions, which either produce a ^S containing an error message (typically for flags with invalid arguments, .e.g. z "could not parse as int"#), or a value that is passed as  flagValues$. If you have no custom flags, pass []. flagValues6 is a list of custom flags that the user supplied. If  flags == [] then this list will be []. argValuesQ is a list of non-flag arguments, which are often treated as files and passed to .result should produce a 8 to indicate that no building needs to take place, or a , providing the rules that should be used.4As an example of a build system that can use either gcc or distcc for compiling: import System.Console.GetOpt data Flags = DistCC deriving Eq flags = [Option "" ["distcc"] (NoArg $ Right DistCC) "Run distributed."] main =  yG flags $ \flags targets -> return $ Just $ do if null targets then  ["result.exe"] else V targets let compiler = if DistCC `elem` flags then "distcc" else "gcc" "*.o"  \out -> do  ... cmd compiler ... ... Now you can pass --distcc to use the distcc compiler.:A list of command line options that can be used to modify R}. Each option returns either an error message (invalid argument to the flag) or a function that changes some fields in R. The command line flags are makei compatible where possbile, but additional flags have been added for the extra options Shake supports.{1True if it has a potential effect on ShakeOptions|}~{ |}~{None=A deprecated way of defining a low priority rule. Defined as: defaultRule =  0 .  GHIJ|}~|}~GHIJNone Deprecated: Alias for . Deprecated: Alias for . Deprecated: Alias for . Deprecated: Alias for  . Note that *>- clashes with a Prelude operator in GHC 7.10. Deprecated: Alias for . Deprecated: Alias for .  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{y{z>?@ABRSTUVWXYZ[\]^_`abcdefghijkuvwxrstlmnopq/0123456789=:;<KLMNOPQ  !"#$%&'()*+,-.CEDFNone+C{Read a config file, returning a list of the variables and their bindings. Config files use the Ninja lexical syntax: 3https://ninja-build.org/manual.html#_lexical_syntaxRead a config file with an initial environment, returning a list of the variables and their bindings. Config files use the Ninja lexical syntax: 3https://ninja-build.org/manual.html#_lexical_syntaxSpecify the file to use with .Specify the values to use with , generally prefer C unless you also need access to the values of variables outside z.6Obtain the value of a configuration variable, returns D to indicate the variable has no binding. Any build system using  must call either  or . The  function will introduce a dependency on the configuration variable (but not the whole configuration file), and if the configuration variable changes, the rule will be rerun. As an example:  "myconfiguration.cfg" "*.o"  \out -> do cflags <-  "CFLAGS"  "gcc" [out -<.> "c"] (fromMaybe "" cflags) 9Obtain the configuration keys. Any build system using  must call either  or  . The  function will introduce a dependency on the configuration keys (but not the whole configuration file), and if the configuration keys change, the rule will be rerun. Usually use as part of an action. As an example:  "myconfiguration.cfg"  $ need =<< getConfigKeys None+7CIN#Run a forward-defined build system.IRun a forward-defined build system, interpretting command-line arguments. Given an z, turn it into a {& structure which runs in forward mode.Given a R7, set the options necessary to execute in forward mode.QCache an action. The name of the action must be unique for all different actions.%Apply caching to an external command.  NoneGiven the text of a Makefile, extract the list of targets and dependencies. Assumes a small subset of Makefile syntax, mostly that generated by gcc -MM. >parseMakefile "a: b c\nd : e" == [("a",["b","c"]),("d",["e"])]XDepend on the dependencies listed in a Makefile. Does not depend on the Makefile itself. _needMakefileDependencies file = need . concatMap snd . parseMakefile =<< liftIO (readFile file)Depend on the dependencies listed in a Makefile. Does not depend on the Makefile itself. Use this function to indicate that you have already used the files in question. cneededMakefileDependencies file = needed . concatMap snd . parseMakefile =<< liftIO (readFile file)Like , but instead of accumulating a list of flags, apply functions to a default value. Usually used to populate a record structure. As an example of a build system that can use either gcc or distcc for compiling: import System.Console.GetOpt data Flags = Flags {distCC :: Bool} deriving Eq flags = [Option "" ["distcc"] (NoArg $ Right $ \x -> x{distCC=True}) "Run distributed."] main =  yU flags (Flags False) $ \flags targets -> return $ Just $ do if null targets then  ["result.exe"] else O targets let compiler = if distCC flags then "distcc" else "gcc" "*.o"  \out -> do  ...  compiler ... ... Now you can pass --distcc to use the distcc compiler.Like ' but also takes a pruning function. If --prune is passed, then after the build has completed, the second argument is called with a list of the files that the build checked were up-to-date. A version of 0 that also takes a list of extra options to use.UVWUVXYZ[Y\]YZ^YZ_YZ`UVabcdbcebcfghighjklmnopnoqnorstuvwxyz{|}~""""""""""""""""""""&&&&&&&&&&&&&&&)))))**-*.222222222222222?22222222222222222222'2222222222222222>:::/:7:::::6:::::::(:3:::::::::5:::::::::B<BBBBBBBBBTCCCCC5C=CCCCCC;HHHHHHHGHAHHHPHH H H   OOL4JJ K!K"K#M$NEQSRS%S&'()*+,-./0123456789:;<=>? @ A B C D E F G H I J K K L M N O P Q R S T U V V W X X Y Z [ \ ] ^ _ ` a b c dUefYghYgiYgjYgkYglYgmYgnbopboqborbosbotboubcvbcwbcxbyzby{b|}b~   UeUeUe     v://       ! " # $ % & ' (  ) ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J!K!L!M!N!O!PYQRSTUSTVSTWSTXSTYSTZST[ST\ST]ST^ST_ST`ST,STaSTbSTcSTdSTeSTfSTFST@STgSThSTiSTjSTkSTlSTmSTnSToSTpSTqSTrSTsSTtSTuSTvSTwSxySxzSx{Sx|Sx}SxDSx+Sx~SxSxSxY#######################################$$$$$$$$$$$$$$$$$%%%%%%%%%L%%&YY&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&)))))))))))))))))*******K*********** *******:*********M.... . . . . . . .................00 1!1"1#1$1%1&1'1(1(1)1*1+1,1-1.1/10111213141516171829Y:;Y\<Y=>292?2@2A2B2C2D2E2F2G2H8I8J8K8L8M8N8O8P9Q9R9S9/9T9U9V9W9X9Y9Z9[9\9]9^9_9`9a9b9c9d9e9e9f9f9g9g9h9\9i9i9j9j9k9^9l9m9n99o9p9q9r9`9s9s9t9t9J9u9v9w9x9y9z9{9|9}9~999999999999999999999999UeYY::UeUe:::::::::::::::::::::::::::::Q:R:S:::::::::::::::::::::::::::::::::BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCYH  Y  Y   j!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGIHIIIJIKILJMJMJNJNJOJPJQJRKSKSKTKTKUMVNWNWNXNXNYNZN[N\N]Y^_S`SaSbScSdSeSfSgShSiSjSkSlSmSnSoSpSqSrSsStuuvvwwxxyz{r|}8TI4ukylWo3D3MMAVZ4mRgDevelopment.Shake.ClassesDevelopment.Shake.CommandDevelopment.ShakeDevelopment.Shake.FilePathDevelopment.Shake.RuleDevelopment.Shake.ConfigDevelopment.Shake.ForwardDevelopment.Shake.UtilGeneral.FileLockGeneral.BilistGeneral.TemplateGeneral.BinaryGeneral.CleanupGeneral.Concurrent General.ExtraDevelopment.Shake.MonadGeneral.TimingDevelopment.Shake.PoolDevelopment.Shake.Resource newResource newThrottle withResourcecmdneed withResourcesshake Paths_shakeDevelopment.Shake.ProfileDevelopment.Shake.ByteStringDevelopment.Ninja.EnvDevelopment.Ninja.TypeDevelopment.Ninja.LexerDevelopment.Ninja.ParseDevelopment.Shake.CmdOptionGeneral.ProcessGeneral.StringGeneral.InternDevelopment.Shake.Progress shakeProgress getProgressDevelopment.Shake.ErrorsDevelopment.Shake.FilePattern<.>Development.Shake.ValueRuleDevelopment.Shake.SpecialDevelopment.Shake.FileInfoDevelopment.Shake.Typestracedcommand trackAllowaction storedValueDevelopment.Shake.StorageDevelopment.Shake.DatabaseDevelopment.Shake.Core%> doesFileExistwant shakeOptions shakeThreads takeBaseName writeFile'!Development.Shake.Rules.DirectoryDevelopment.Shake.Rules.File dropExtension alwaysRerunreplaceBaseName readFile'Development.Shake.DerivedDevelopment.Shake.DemoDevelopment.Shake.Rules.FilesDevelopment.Shake.Rules.Oracle fromStdout!Development.Shake.Rules.OrderOnlyDevelopment.Shake.Rules.RerunStdoutwriteFileChangedDevelopment.Shake.Shake shakeArgsDevelopment.Shake.ArgsremoveFilesAfterghc-prim GHC.Classes==EqbaseGHC.ShowShowData.Typeable.InternalTypeableshowListshow showsPrec/=binar_IvYoLp9H6Xy3zEH13MmZwdData.Binary.ClassgetputBinarydeeps_LbCWUlehDDeLxurARKDH5oControl.DeepSeqrnfNFData1Lskj20rYQaLxOB2uLCxG1Control.Monad.Extraunithasha_2GTZqecVp8NJZrNuKzGxfyData.Hashable.Classhash hashWithSaltHashabletrans_3eG64VdP2vzGjP6wJiCp5XControl.Monad.IO.ClassliftIOResource newResourceIO newThrottleIOdropDirectory1takeDirectory1 normaliseExtoNative toStandardexe CmdOptionCwdEnvAddEnvRemEnvAddPathStdinStdinBS FileStdinShell BinaryPipesTracedTimeout WithStdout WithStderr EchoStdout EchoStderr FileStdout FileStderrAutoDepsProgress isFailure countSkipped countBuilt countUnknown countTodo timeSkipped timeBuilt timeUnknowntimeTodoprogressDisplayprogressTitlebarprogressProgramprogressSimpleShakeExceptionshakeExceptionTargetshakeExceptionStackshakeExceptionInner FilePattern?== ShakeValue EqualCost EqualCheapEqualExpensiveNotEqual VerbositySilentQuietNormalLoudChatty Diagnostic ShakeOptions shakeFiles shakeVersionshakeVerbosity shakeStaunch shakeReport shakeLintshakeLintInsideshakeLintIgnoreshakeCommandOptions shakeFlush shakeAssumeshakeAbbreviationsshakeStorageLogshakeLineBuffering shakeTimingsshakeRunCommands shakeChangeshakeCreationCheckshakeLiveFilesshakeVersionIgnore shakeOutput shakeExtraChange ChangeModtime ChangeDigestChangeModtimeAndDigestChangeModtimeAndDigestInputChangeModtimeOrDigestLint LintBasic LintFSATraceAssume AssumeDirty AssumeClean AssumeSkipActionRules equalValuerulepriority alternativeswithoutActionsactionOnException actionFinallyapplyapply1getShakeOptionsputLoud putNormalputQuiet getVerbosity withVerbosityquietlytrackUse trackChange newCacheIOnewCacheunsafeExtraThreadparallelorderOnlyActiondoesDirectoryExistgetEnvgetEnvWithDefaultgetDirectoryContentsgetDirectoryFilesgetDirectoryDirsgetDirectoryFilesIO removeFilesneeded trackRead trackWritephonyphonys~>?>|%>getHashedShakeVersionsystem' systemCwd systemOutput copyFile'copyFileChanged readFileLineswriteFileLines withTempFile withTempDirforPpar CmdArguments:-> CmdResult CmdStringCmdLine fromCmdLineCmdTime fromCmdTimeProcess fromProcessExitfromExit Stdouterr fromStdouterrStderr fromStderraddPathaddEnvcommand_&%>&?> addOracle askOracle askOracleWith orderOnly shakeArgsWithshakeOptDescrs defaultRule**>?>>*>>*>|*>&*>readConfigFilereadConfigFileWithEnvusingConfigFile usingConfig getConfig getConfigKeys shakeForwardshakeArgsForward forwardRuleforwardOptions cacheActioncache parseMakefileneedMakefileDependenciesneededMakefileDependenciesshakeArgsAccumulateshakeArgsPruneshakeArgsPruneWithc_GetLastError c_CloseHandle c_CreateFileWc_GENERIC_WRITEc_GENERIC_READc_FILE_SHARE_NONE c_OPEN_ALWAYSc_FILE_ATTRIBUTE_NORMALc_INVALID_HANDLE_VALUEc_ERROR_SHARING_VIOLATION withLockFileBilisttoListisEmptyconssnocuncons$fMonoidBilist $fEqBilist runTemplate librarieslbs_stripPrefixBinFloat fromBinFloatBinList fromBinList BinaryWithputWithgetWithconvert$fBinaryBinFloat$fShowBinFloat$fBinaryBinList $fShowBinList$fBinaryWithctxMaybe$fBinaryWithctx[]$fBinaryWithctx(,) GHC.TypesWordGHC.WordWord8Word16Word32Word64 byteSwap64 byteSwap32 byteSwap16 Data.BinarydecodeFileOrFail decodeFile encodeFile decodeOrFaildecodeencodeggetgputGBinaryData.Binary.PutputWord8PutData.Binary.GetgetWord8Data.Binary.Get.InternalGet withCleanup addCleanupCleanupBoolTrueFalseSuniqueitemsFencenewFence signalFence waitFence testFence $fShowFence showQuotegetProcessorCount randomElemwiths maximumBy'maximum'runRAWputRW unmodifyRW captureRAWCaptureRAWfromRAWhandlerrorww catchSafegetROgetRWgetsROgetsRWwithRAWmodifyRWwithROwithRWcatchRAWtryRAWthrowRAW printTimingstimertimings resetTimings addTiming showTimingsshowGapstepaddPooladdPoolPriority increasePoolrunPoolthreads threadsLimit threadsMax threadsSumtodoPoolTreeQueueNonDetnewQueueenqueuePriorityenqueuedequeue emptyTree insertTree removeTreeemptySworkerThrottleAvailableThrottleWaitingfiniteAvailable finiteWaiting resourceOrd resourceShowacquireResourcereleaseResourceThrottleFinite resourceIds resourceIdwaiter blockPool $fOrdResource $fEqResource$fShowResourcecatchIOversionbindirlibdirdatadir libexecdir sysconfdir getBinDir getLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName writeProfile ProfileTrace prfCommandprfStartprfStop ProfileEntryprfNameprfBuilt prfChanged prfDepends prfExecution prfTracesprfTimegenerateSummary generateHTML generateTrace generateJSON jsonListLinesjsonList jsonObjectlinesCRfilepathNormalise endsSlash wordsMakefiledotDotdotslashnewEnvscopeEnvaskEnvfromEnv $fShowEnvruleBindBuildruleNameenv depsNormal depsImplicit depsOrderOnly buildBindNinjarulessingles multiplesdefaultspoolsExprExprsLitVarFileStrStraskExpraskVaraddBindaddBindsnewNinjaLexemeLexBindLexBuild LexInclude LexSubninjaLexRuleLexPool LexDefault LexDefineStr0chrinc dropWhile0span0break0break00head0tail0list0take0isVarisVarDot endsDollardropN dropSpace lexerFilelexer lexerLooplexBindlexBuild lexDefaultlexRulelexPool lexInclude lexSubninja lexDefinelexxBindlexxFilelexxName lexxExprslexxExpr splitLineCont splitLineCRparse parseFile withBinds applyStmt splitDepsgetDepthGHC.IOFilePathfilep_KsGE6pHE5eZHSN90ZVax6ASystem.FilePath.WindowspathSeparators pathSeparator normalise makeRelative isAbsolute isRelative makeValidisValid equalFilePathjoinPathsplitDirectories splitPathcombinereplaceDirectory takeDirectorydropTrailingPathSeparatoraddTrailingPathSeparatorhasTrailingPathSeparator takeFileName dropFileNamereplaceFileName splitFileNameisDrivehasDrive dropDrive takeDrive joinDrive splitDrive getSearchPathsplitSearchPathisExtSeparator extSeparatorisSearchPathSeparatorsearchPathSeparatorisPathSeparatorSystem.FilePath.PosixtakeExtensionsdropExtensionssplitExtensions hasExtension addExtensionreplaceExtension-<.> takeExtensionsplitExtensionGHC.BaseStringoptimiseBuffers ProcessOpts poCommandpoCwdpoEnv poTimeoutpoStdinpoStdoutpoStderrpoAsync DestinationDestEchoDestFile DestString DestBytesSourceSrcFile SrcStringSrcBytesBuffer newBuffer addBuffer readBuffer isDestString isDestBytes stdStreamstdIn withTimeoutcmdSpecforkWaitabortwithCreateProcessOld withFilesprocess bs_hGetSome $fOrdBuffer $fEqBufferBSUBSpackunpackpack_unpack_packUunpackUunpackU_packU_requireU $fShowBSU $fNFDataBSU $fNFDataBS$fShowBSIdInternemptyinsertaddlookupfromList$fBinaryWithwIdMealyNothingJustmessageprogressReplaywriteProgressReport ProgressEntry idealSecs idealPerc actualSecs actualPercrunMealyc_setConsoleTitle echoMealy scanMealyoldMealylatchiffdecay formatMessage showMinSecliftA2' isInvalidindentxterm$fApplicativeMealy$fFunctorMealy$fMonoidProgresserrerrorStructurederrorStructuredContents structurederrorDirectoryNotFileerrorNoRuleToBuildTypeerrorRuleTypeMismatcherrorIncompatibleRuleserrorMultipleRulesMatcherrorRuleRecursionerrorComplexRecursionerrorDuplicateOracle errorNoApplyspecialIsOracleKey$fShowShakeException$fExceptionShakeExceptionWalkStarSkipSkip1StarsoptimiseisRelativePatternisRelativePathmatchsimple compatibleextract substituteWalkToSlash SlashSlashPatisLitfromLitparseLit internalTestmatchOne matchStarsspecialswalknextfinalWitness typeNames witnessIn witnessOutValueKeynewKeynewValuetypeKey typeValuefromKey fromValuewitnessregisterWitness toStableListcurrentWitness$fBinaryWithWitnessValue$fBinaryWitness $fEqWitness $fEqValue$fHashableValue $fNFDataValue $fShowValue $fShowKeyspecialAlwaysRebuildsspecialIsFileKeyWIN32_FILE_ATTRIBUTE_DATAFileSize FileInfoSizeModTime FileInfoModFileHash FileInfoHashFileInfoc_GetFileAttributesExWc_GetFileAttributesExA fileInfoEq fileInfoNeqfileInfo getFileHashresult getFileInfogetFileInfoNoDirErr getFileInfoEx alloca_WIN32_FILE_ATTRIBUTE_DATApeekFileAttributespeekLastWriteTimeLowpeekFileSizeLow $fEqFileInfo$fShowFileInfoHidden Data.DataDataTypeRep System.IOputStrLn fromHiddenfieldsShakeOptionstyShakeOptionsconShakeOptionsunhidetyHidden $fDataHidden $fShowHidden$fShowShakeOptions$fDataShakeOptionsasyncExceptionMapdatabaseVersion splitVersion withStorage flushThread readChunkstoChunkstoredequalexecutebuiltchangeddepends executiontracesReadyErrorLoadedWaitingMissingDatabase diagnosticTracewaitForbuilddependencyOrder resultsOnlyStepKeyOpsDepends fromDependsPendingResultStatuslockinternstatusjournalassumeInternDBStatusDBStackStepincStep showStackaddStack showTopStacktopStack checkStack emptyStack statusTypeisError isWaitingisReady afterWaiting newWaiting runWaiting getResult internKeyqueryKeyprogressassertFinishedDatabase removeSteptoReport checkValidlistLive listDependslookupDependenciesstepKey toStepResultfromStepResult withDatabase$fBinaryWithWitnessStatus $fBinaryTrace$fBinaryWithWitnessResult $fShowPending $fNFDataTraceIOMonoidMonadrunshakeExceptionIntDouble fromActionLocal localStacklocalVerbositylocalBlockApply localDepends localDiscount localTraceslocalTrackAllowslocalTrackUsedGlobalglobalDatabase globalPool globalCleanupglobalTimestamp globalRules globalOutput globalOptionsglobalDiagnostic globalLint globalAfterglobalTrackAbsentglobalProgressRuleInfo resultTypeSRulesactionsARuleruleKey ruleValuenewRules modifyRulesgetRulesregisterWitnessescreateRuleinfo runStoredrunEqual runExecute actionBoom lineBuffering abbreviate runActionrunAfter applyForall applyKeyValueputWhentrackCheckUsedtrackAllowForallunsafeAllowApply blockApplyapplyBlockedBy $fMonoidRules$fMonoidSRulesdefaultRuleDirectory GetDirectoryA GetDirectoryQGetDirdir GetDirFilespat GetDirDirsGetEnvAGetEnvQDoesDirectoryExistADoesDirectoryExistQDoesFileExistADoesFileExistQ getDirActioncontentsanswergetDir $fRuleGetDirectoryQGetDirectoryA$fRuleGetEnvQGetEnvA,$fRuleDoesDirectoryExistQDoesDirectoryExistA"$fRuleDoesFileExistQDoesFileExistA$fBinaryGetDirectoryQ$fHashableGetDirectoryQ$fNFDataGetDirectoryQ$fShowGetDirectoryA$fShowGetDirectoryQ $fShowGetEnvA $fShowGetEnvQ$fShowDoesDirectoryExistA$fShowDoesDirectoryExistQ$fShowDoesFileExistA$fShowDoesFileExistQstoredValueErrordefaultRuleFileFileAFileQ fromFileQstoredValueErrDirneedNormneedBSneededBS neededCheckroot$fRuleFileQFileA $fShowFileA $fBinaryFileA $fNFDataFileA$fHashableFileA $fShowFileQData.TraversableforM checkExitCodeproce_92p6c0OJebP7mjyJ5QnhVNSystem.Process.Internals ProcessHandleGHC.IO.ExceptionExitCode ExitFailureFSATcommandExplicitrunShell parseFSATcommandExplicitIO resolveEnv resolvePathfindExecutableWithArgarg cmdArguments cmdResult cmdString FSATWriteFSATRead FSATDeleteFSATMovePidPid0 ResultStdout ResultStderrResultStdouterr ResultCode ResultTime ResultLine ResultProcessLBSUnit cmdResultWithshowCommandForUser2 $fArgMaybe$fArg[]$fArgCmdOption$fArg[]0$fArg[]1$fCmdArguments[]$fCmdArgumentsIO$fCmdArgumentsAction$fCmdArguments(->)$fCmdResult(,,,,)$fCmdResult(,,,)$fCmdResult(,,)$fCmdResult(,) $fCmdResult()$fCmdResultStdouterr$fCmdResultStderr$fCmdResultStdout$fCmdResultCmdTime$fCmdResultCmdLine$fCmdResultProcessHandle$fCmdResultProcess$fCmdResultExitCode$fCmdResultExit$fCmdStringByteString$fCmdStringByteString0 $fCmdString[] $fCmdString()$fEqPidyesNowraprequiredemoputLineFilesAFilesQ getFileTimes$fRuleFilesQFilesA $fShowFilesQ $fShowFilesAOracleAOracleQ$fRuleOracleQOracleA orderOnlyBS AlwaysRerunA AlwaysRerunQdefaultRuleRerun$fRuleAlwaysRerunQAlwaysRerunA$fEqAlwaysRerunA$fShowAlwaysRerunA$fShowAlwaysRerunQ Data.EitherLeft shakeOptsExExtraChangeDirectoryVersionNumericVersion AssumeNew AssumeOldPrintDirectoryColorHelpSleepNoTime ExceptionNoBuildProgressRecordProgressReplayDemo showOptDescr fmapOptDescrunescapeescape ConfigKeysConfigForwardAForwardQforwards$fRuleForwardQForwardA$fShowForwardQ fmapArgDescr