!m3      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ None   HIJKL  LKIJHNone Safe 1 !"#$%&'()*+,-./012345678:9;<=FEDCBA@?>G1:9 $#-8(+*%)0'&"!654321/.7,=<FEDCBA@?>G; None M   !"#$%&'()*+,-./012345678:9;<=FEDCBA@?>GHIJKLNone:*ZM core-programInformation about the version number of this piece of software and other related metadata related to the project it was built from. This is supplied to your program when you call  ?. This value is used if the user requests it by specifying the  --version option on the command-line.>Simply providing an overloaded string literal such as version "1.0" will give you a M with that value: ,{-# LANGUAGE OverloadedStrings #-} main ::  () main = do context <-   "1.0"   (  ... *For more complex usage you can populate a M object using the Q8 splice below. You can then call various accessors like P to access individual fields.Q core-programyThis is a splice which includes key built-time metadata, including the number from the version field from your project's .cabal, file (as written by hand or generated from  package.yaml).While we generally discourage the use of Template Haskell by beginners (there are more important things to learn first) it is a way to execute code at compile time and that is what what we need in order to have the version number extracted from the .cabalX file rather than requiring the user to specify (and synchronize) it in multiple places.DTo use this, enable the Template Haskell language extension in your Main.hs file. Then use the special $( ... )> "insert splice here" syntax that extension provides to get a M5 object with the desired metadata about your project: -{-# LANGUAGE TemplateHaskell #-} version :: M version = $(Q ) main ::  () main = do context <-   version   (  ... (Using Template Haskell slows down compilation of this file, but the upside of this technique is that it avoids linking the Haskell build machinery into your executable, saving you about 10 MB in the size of the resultant binary)MONPQMQPNONone4MmU core-programADifferent ways parsing a simple or complex command-line can fail.V core-programNSomething was wrong with the way the user specified [usually a short] option. W core-programOUser specified an option that doesn't match any in the supplied configuration. X core-program2Arguments are mandatory, and this one is missing. Y core-program,Arguments are present we weren't expecting. Z core-programbIn a complex configuration, user specified a command that doesn't match any in the configuration. [ core-program;In a complex configuration, user didn't specify a command. \ core-programAIn a complex configuration, usage information was requested with --help/, either globally or for the supplied command. ] core-program.Display of the program version requested with  --version. ^ core-programResult of having processed the command-line and the environment. You get at the parsed command-line options and arguments by calling  within a  block.Each option and mandatory argument parsed from the command-line is either standalone (in the case of switches and flags, such as --quiet) or has an associated value. In the case of options the key is the name of the option, and for arguments it is the implicit name specified when setting up the program. For example, in: 2$ ./submit --username=gbmh GraceHopper_Resume.pdf the option has parameter name "username " and value "gmbhY"; the argument has parameter name "filename" (assuming that is what was declared in the hF entry) and a value being the Admiral's CV. This would be returned as: ^ A [("username","gbmh"), ("filename","GraceHopper_Resume.pdf")] [] &The case of a complex command such as git or stackN, you get the specific mode chosen by the user returned in the first position: $ missiles launch --all would be parsed as: ^ ( "launch") [("all",Empty)] [] c core-programIndividual parameters read in off the command-line can either have a value (in the case of arguments and options taking a value) or be empty (in the case of options that are just flags).f core-programNDeclaration of an optional switch or mandatory argument expected by a program.g takes a long name for the option, a short single character abbreviation if offered for convenience, whether or not the option takes a value (and what label to show in help output) and a description for use when displaying usage via --help.h indicates a mandatory argument and takes the long name used to identify the parsed value from the command-line, and likewise a description for --help output.1By convention option and argument names are both  lower caseQ. If the identifier is two or more words they are joined with a hyphen. Examples:  [ g "quiet" ( 'q') e* "Keep the noise to a minimum." , g "dry-run"  (dR "TIME") "Run a simulation of what would happen at the specified time." , h< "username" "The user to delete from the system." ] By convention a  descriptionj is one or more complete sentences each of which ends with a full stop. For options that take values, use  upper case5 when specifying the label to be used in help output.i declares an environment variablej that, if present, will be read by the program and stored in its runtime context. By convention these are  upper caseL. If the identifier is two or more words they are joined with an underscore:  [ ... , iN "CRAZY_MODE" "Specify how many crazies to activate." , ... ] j core-programDescription of the command-line structure of a program which has "commands" (sometimes referred to as "subcommands") representing different modes of operation. This is familiar from tools like git and docker.m core-programNThe setup for parsing the command-line arguments of your program. You build a Config with s or t, and pass it to  .n core-program:The name of an option, command, or agument (omitting the "--e" prefix in the case of options). This identifier will be used to generate usage text in response to --helpj and by you later when retreiving the values of the supplied parameters after the program has initialized.Turn on OverloadedStrings+ when specifying configurations, obviously.p core-programxThe description of an option, command, or environment variable (for use when rendering usage information in response to --help on the command-line).q core-program-Single letter "short" options (omitting the "-" prefix, obviously).r core-programA completely empty configuration, without the default debugging and logging options. Your program won't process any command-line options or arguments, which would be weird in most cases. Prefer s.s core-programDeclare a simple (as in normal) configuration for a program with any number of optional parameters and mandatory arguments. For example: main ::  () main = do context <-   "1.0"   (s [ g "host" ( 'h') e [| Specify an alternate host to connect to when performing the frobnication. The default is "localhost". |] , g "port" ( 'p') e [`| Specify an alternate port to connect to when frobnicating. |] , g "dry-run"  (d "TIME") [{| Perform a trial run at the specified time but don't actually do anything. |] , g "quiet" ( 'q') e [<| Supress normal output. |] , h "filename" [L| The file you want to frobnicate. |] ])  context program 3which, if you build that into an executable called snippet and invoke it with --help, would result in: $ ./snippet --help Usage: snippet [OPTIONS] filename Available options: -h, --host Specify an alternate host to connect to when performing the frobnication. The default is "localhost". -p, --port Specify an alternate port to connect to when frobnicating. --dry-run=TIME Perform a trial run at the specified time but don't actually do anything. -q, --quiet Supress normal output. -v, --verbose Turn on event tracing. By default the logging stream will go to standard output on your terminal. --debug Turn on debug level logging. Implies --verbose. Required arguments: filename The file you want to frobnicate. $ | MFor information on how to use the multi-line string literals shown here, see  in Core.Text.Utilities.t core-programRDeclare a complex configuration (implying a larger tool with various "[sub]commands" or "modes"} for a program. You can specify global options applicable to all commands, a list of commands, and environment variables that will be honoured by the program. Each command can have a list of local options and arguments as needed. For example:  program :: * MusicAppStatus () program = ... main ::  () main = do context <-   ( version)  (t [ k [ g "station-name"  (d "NAME") [| Specify an alternate radio station to connect to when performing actions. The default is "BBC Radio 1". |] , i "PLAYER_FORCE_HEADPHONES" [| If set to 1, override the audio subsystem to force output to go to the user's headphone jack. |] ] , l( "play" "Play the music." [ g "repeat"  e [| Request that they play the same song over and over and over again, simulating the effect of listening to a Top 40 radio station. |] ] , lB "rate" "Vote on whether you like the song or not." [ g "academic"  e [| The rating you wish to apply, from A+ to F. This is the default, so there is no reason whatsoever to specify this. But some people are obsessive, compulsive, and have time on their hands. |] , g "numeric"  e [6| Specify a score as a number from 0 to 100 instead of an academic style letter grade. Note that negative values are not valid scores, despite how vicerally satisfying that would be for music produced in the 1970s. |] , g "unicode" ( 'c') e [| Instead of a score, indicate your rating with a single character. This allows you to use emoji, so that you can rate a piece '', as so many songs deserve. |] , h "score" [_| The rating you wish to apply. |] ] ])  context program vis a program with one global option (in addition to the default ones) [and an environment variable] and two commands: play, with one option; and rate, with two options and a required argument. It also is set up to carry its top-level application state around in a type called MusicAppStatus (implementing  and so initialized here with Q. This is a good pattern to use given we are so early in the program's lifetime).<The resultant program could be invoked as in these examples: $ ,./player --station-name="KBBL-FM 102.5" play $  $ ./player -v rate --numeric 76 $ MFor information on how to use the multi-line string literals shown here, see  in Core.Text.Utilities.v core-program~Given a program configuration schema and the command-line arguments, process them into key/value pairs in a Parameters object.This results in U on the left side if one of the passed in options is unrecognized or if there is some other problem handling options or arguments (because at that point, we want to rabbit right back to the top and bail out; there's no recovering).This isn't something you'll ever need to call directly; it's exposed for testing convenience. This function is invoked when you call   or  (which calls  configure with a default Config when initializing). core-programBreak the command-line apart in two steps. The first peels off the global options, the second below looks to see if there is a command (of fails) and if so, whether it has any parameters.We do it this way so that v can pas the global options to  extractor and thence  to catch --version and --help.%UVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy%mrstu^_`abcdenoqpfghijklvwUVWXYZ[\]xyNone /147@AMmn  core-program The type of a top-level program.You would use this by writing: module Main where import  Core.Program main ::  () main =  program Aand defining a program that is the top level of your application:  program ::   () Such actions are combinable; you can sequence them (using bind in do-notation) or run them in parallel, but basically you should need one such object at the top of your application.Type variablesA 9 has a user-supplied application state and a return type.The first type variable, , is your application's state. This is an object that will be threaded through the computation and made available to your code in the b monad. While this is a common requirement of the outer code layer in large programs, it is often not necessary in small programs or when starting new projects. You can mark that there is no top-level application state required using 1 and easily change it later if your needs evolve.The return type, A, is usually unit as this effectively being called directly from main and Haskell programs have type  ()S. That is, they don't return anything; I/O having already happened as side effects.Programs in separate modulesOne of the quirks of Haskell is that it is difficult to refer to code in the Main module when you've got a number of programs kicking around in a project each with a main5 function. So you're best off putting your top-level ^ actions in a separate modules so you can refer to them from test suites and example snippets. core-programmThe verbosity level of the logging subsystem. You can override the level specified on the command-line using  from within the  monad. core-programA G with no user-supplied state to be threaded throughout the computation.The Core.Program.Execute framework makes your top-level application state available at the outer level of your process. While this is a feature that most substantial programs rely on, it is not[ needed for many simple tasks or when first starting out what will become a larger project.This is effectively the unit type, but this alias is here to clearly signal a user-data type is not a part of the program semantics. core-programKInternal context for a running program. You access this via actions in the X monad. The principal item here is the user-supplied top-level application data of type  which can be retrieved with  and updated with . core-programGet the internal Context of the running ProgramW. There is ordinarily no reason to use this; to access your top-level application data  within the Context use . core-program&Run a subprogram from within a lifted IO block. core-program Initialize the programs's execution context. This takes care of various administrative actions, including setting up output channels, parsing command-line arguments (according to the supplied configuration), and putting in place various semaphores for internal program communication. See Core.Program.Arguments for details.This is also where you specify the initial {blank, empty, default) value for the top-level user-defined application state, if you have one. Specify " if you aren't using this feature. core-programProbe the width of the terminal, in characters. If it fails to retrieve, for whatever reason, return a default of 80 characters wide. core-programProcess the command line options and arguments. If an invalid option is encountered or a [mandatory] argument is missing, then the program will terminate here.None " core-programMake a non-zero exit code which is 0b1000000 + the number of the signal. Probably never need this (especaially given our attempt to write out a human readable name for the signal caught) but it's a convention we're happy to observe. core-program|Install signal handlers for SIGINT and SIGTERM that set the exit semaphore so that a Program's [minimal] cleanup can occur.None>@AM. core-programNUtility function to prepend '0' characters to a string representing a number. core-programWrite the supplied text to stdout."This is for normal program output.   "Beginning now"  core-programCall : on the supplied argument and write the resultant text to stdout.(This is the equivalent of  from base) core-programCPretty print the supplied argument and write the resultant text to stdout4. This will pass the detected terminal width to the K function, resulting in appopriate line wrapping when rendering your value. core-programONote a significant event, state transition, status, or debugging message. This:   "Starting..." will result in  13:05:55Z (0000.001) Starting...appearing on stdout and the message being sent down the logging channel. The output string is current time in UTC, and time elapsed since startup shown to the nearest millisecond (our timestamps are to nanosecond precision, but you don't need that kind of resolution in in ordinary debugging).*Messages sent to syslog will be logged at Info level severity. core-programIOutput a debugging message formed from a label and a value. This is like { above but for the (rather common) case of needing to inspect or record the value of a variable when debugging code. This:  setProgramName "hello" name <- getProgramName  "programName" name will result in (13:05:58Z (0003.141) programName = helloappearing on stdout andz the message being sent down the logging channel, assuming these actions executed about three seconds after program start.*Messages sent to syslog will be logged at Debug level severity. core-programbConvenience for the common case of needing to inspect the value of a general variable which has a  instance core-programkConvenience for the common case of needing to inspect the value of a general variable for which there is a v instance and so can pretty print the supplied argument to the log. This will pass the detected terminal width to the  function, resulting in appopriate line wrapping when rendering your value (if logging to something other than console the default width of 80 will be applied). None@ASXmu core-programxA thread for concurrent computation. Haskell uses green threads: small lines of work that are scheduled down onto actual execution contexts, set by default by this library to be one per core. They are incredibly lightweight, and you are encouraged to use them freely. Haskell provides a rich ecosystem of tools to do work concurrently and to communicate safely between threads (this wraps async's ) core-program=Embelish a program with useful behaviours. See module header Core.Program.Execute< for a detailed description. Internally this function calls / with an appropriate default when initializing. core-programEmbelish a program with useful behaviours, supplying a configuration for command-line options & argument parsing and an initial value for the top-level application state, if appropriate. core-programSafely exit the program with the supplied exit code. Current output and debug queues will be flushed, and then the process will terminate. core-programQChange the verbosity level of the program's logging output. This changes whether  and the 9 family of functions emit to the logging stream; they do not affect 2ing to the terminal on the standard output stream. core-programwOverride the program name used for logging, etc. At least, that was the idea. Nothing makes use of this at the moment. :/ core-programKGet the program name as invoked from the command-line (or as overridden by ). core-program5Retreive the current terminal's width, in characters.'If you are outputting an object with a : instance then you may not need this; you can instead use wrteRc which is aware of the width of your terminal and will reflow (in as much as the underlying type's Render instance lets it). core-programBGet the user supplied application state as originally supplied to . and modified subsequntly by replacement with . ! state <- getApplicationState  core-program5Update the user supplied top-level application state. F let state' = state { answer = 42 } setApplicationState state'  core-program Alias for . core-program Alias for . core-programWrite the supplied Bytes to the given Handle. Note that in contrast to $ we don't output a trailing newline.   h b Do not use this to output to stdout0 as that would bypass the mechanism used by the *, , and S* functions to sequence output correctly. If you wish to write to the terminal use:   ( b) (which is not unsafe_, but will lead to unexpected results if the binary blob you pass in is other than UTF-8 text). core-program,Read the (entire) contents of the specified Handle. core-program5Fork a thread. The child thread will run in the same Context as the calling Program<, including sharing the user-defined application state type. (this wraps async's  which in turn wraps base's ) core-programhPause the current thread for the given number of seconds. For example, to delay a second and a half, do:   1.5  (this wraps base's ) core-programmRetrieve the values of parameters parsed from options and arguments supplied by the user on the command-line..The command-line parameters are returned in a g, mapping from from the option or argument name to the supplied value. You can query this map directly: program = do params <-  let result = B "silence" (paramterValuesFrom params) case result of  ->  () # quiet = case quiet of d _ -> LR NotQuiteRight -- complain that flag doesn't take value e -> 4 "You should be quiet now" -- much better ... which is pattern matching to answer "was this option specified by the user?" or "what was the value of this [mandatory] argument?", and then "if so, did the parameter have a value?"=This is available should you need to differentiate between a Value and an Empty c6, but for many cases as a convenience you can use the , , and [ functions below (which are just wrappers around a code block like the example shown here). core-programArguments are mandatory, so by the time your program is running a value has already been identified. This returns the value for that parameter. core-programOLook to see if the user supplied a valued option and if so, what its value was. core-programReturns  Just True if the option is present, and Nothing if it is not. core-programfIllegal internal state resulting from what should be unreachable code or otherwise a programmer error.None@ASXr core-program>This gives you a function that you can use within your lifted  actions to return to the  monad.oThe type signature of this function is a bit involved, but the example below shows that the lambda gives you a function+ as its argument (we recommend you name it  runProgram for consistency) which gives you a way to run a subprogram, be that a single action like writing to terminal or logging, or a larger action in a do-notation block: main :: IO () main =  $ do  $ \runProgram -> do -- in IO monad, lifted -- (just as if you had used liftIO) ... runProgram $ do -- now unlifted, back to Program monad ... Think of this as  with an escape hatch.This function is named : because it is a convenience around the following pattern:  context <- % liftIO $ do ... > context $ do -- now in Program monad ...  None core-program+Watch for changes to a given list of files.wBefore continuing we insert a 100ms pause to allow whatever the editor was to finish its write and switcheroo sequence.NoneXMPNOQUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy !"#"$%&'()*+,+-+.+/010203040567+89:;9:<9:=9:=>?@>AB>AC>AD>AE>AF>AG>AH>AI>AJ>?K>?L>?M>?N>?O>?P>?Q>?R>?S>?T>?U>?V>?W>?X>?Y>?Z>?[>?\>?]>?^>?_>?`>?a>?b>?c>?defgefhefiefjefkeflefmefnefoefpefqefrefstuvtuwtuxtuytuz{|}~     %+core-program-0.2.4.4-EWUXZv9RfwWGs0qu8DdFAgCore.System.BaseCore.System.ExternalCore.System.PrettyCore.Program.MetadataCore.Program.ArgumentsCore.Program.ExecuteCore.Program.LoggingCore.Program.UnliftCore.Program.Notify Core.System configureNonesimplegetCommandLineProgramCore.Program.Context executeWith fromPackageexecutesetVerbosityLevelgetApplicationStatesetApplicationStateCore.Program.SignalCore.Text.UntilitiesRenderControl.ConcurrentforkIO Core.ProgrambaseGHC.IO.Handle.FDstdoutGHC.IO.Handle.TypesHandleControl.Monad.IO.ClassliftIOMonadIO System.IOwithFilestderrstdin GHC.IO.HandlehFlushGHC.Exception.TypedisplayException fromException toException Exception GHC.IO.IOMode ReadWriteMode AppendMode WriteModeReadModeIOMode GHC.IO.UnsafeunsafePerformIO SomeException,chronologique-0.3.1.3-IedigeuVn7sCuXX9jeUXTBChrono.TimeStampgetCurrentTimeNanoseconds unTimeStamp TimeStamp*prettyprinter-1.6.2-4WdMOwMbqc6874D5AiTTCa"Data.Text.Prettyprint.Doc.InternalDoc'Data.Text.Prettyprint.Doc.Symbols.Asciicommarbracelbracerbracketlbracketrparenlparendquotesquote unAnnotateannotateenclose punctuatefillCatvcathcatsepfillSepvsephsep concatWith<+>indenthangflatAltgrouphardline softline'softlineline'linenestemptyDocprettyPretty:prettyprinter-ansi-terminal-1.1.1.2-2l1Kfz7PJ3EBHZ2boOxT3G2Data.Text.Prettyprint.Doc.Render.Terminal.Internalbold colorDullcolorWhiteCyanMagentaBlueYellowGreenRedBlackColor AnsiStyle.safe-exceptions-0.1.7.0-JIns11DhTTRKUEalvQYe6pControl.Exception.Safefinallybracketcatch impureThrowthrowVersionprojectNameFromprojectSynopsisFromversionNumberFrom$fIsStringVersion $fShowVersion $fLiftVersionInvalidCommandLine InvalidOption UnknownOptionMissingArgumentUnexpectedArgumentsUnknownCommandNoCommandFound HelpRequestVersionRequest ParameterscommandNameFromparameterValuesFromenvironmentValuesFromParameterValueValueEmptyOptionsOptionArgumentVariableCommandsGlobalCommandConfigLongName Description ShortNameblankcomplexbaselineOptionsparseCommandLineextractValidEnvironments buildUsage buildVersion$fTextualLongName$fPrettyLongName $fKeyLongName$fIsStringParameterValue$fExceptionInvalidCommandLine$fShowLongName$fIsStringLongName $fEqLongName$fHashableLongName $fOrdLongName$fShowParameterValue$fEqParameterValue$fShowParameters$fEqParameters$fShowInvalidCommandLine$fEqInvalidCommandLine VerbosityOutputEventDebugContextisNone unProgram getContext subProgram putMessagewritewriteSwriteReventdebugdebugSdebugRThread terminategetVerbosityLevelsetProgramNamegetProgramNamegetConsoleWidthretrieveupdateoutputinputunThreadforksleeplookupArgumentlookupOptionValuelookupOptionFlaginvalid withContext waitForChangeghc-prim GHC.TypesIO GHC.MaybeNothingJust(core-text-0.2.3.5-8sGGI0SxHUq6AXmEJYl9B2Core.Text.UtilitiesquoteGHC.BasememptyMonoidsplitCommandLine1parsePossibleOptionshandleCommandLineMessageprogramNameFrom versionFromcommandLineFromexitSemaphoreFrom startTimeFromterminalWidthFromverbosityLevelFromoutputChannelFromloggerChannelFromapplicationDataFromcodesetupSignalHandlers padWithZerosGHC.ShowshowprintrenderShow"async-2.2.2-JNOgs3QkEuXLm97AkAPhACControl.Concurrent.AsyncAsyncCore.Text.RopeintoRopeasync GHC.Conc.IO threadDelay(core-data-0.2.1.7-JbSSJhlcKTp6Ua4YO5VYydCore.Data.StructuresMaplookupKeyValuereturn