h$9      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~    None6  ;<=>?  ?><=;None Safe-Inferred$ !"#$%&'()*+,-./012345678:9$:9 $#-8(+*%)0'&"!654321/.7, None    !"#$%&'()*+,-./012345678:9;<=>?None ; "@ 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 @ with that value: ,{-# LANGUAGE OverloadedStrings #-} main ::  () main = do context <-   "1.0"   ( ... *For more complex usage you can populate a @ object using the D8 splice below. You can then call various accessors like C to access individual fields.D core-programThis 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 .cabal file rather than requiring the user to specify (and synchronize) it in multiple places.To 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 @5 object with the desired metadata about your project: -{-# LANGUAGE TemplateHaskell #-} version :: @ version = $(D ) 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)@BCAD@DCABNone 58H core-programDifferent ways parsing a simple or complex command-line can fail.I core-programSomething was wrong with the way the user specified [usually a short] option.J core-programUser specified an option that doesn't match any in the supplied configuration.K core-program1Arguments are mandatory, and this one is missing.L core-program+Arguments are present we weren't expecting.M core-programIn a complex configuration, user specified a command that doesn't match any in the configuration.N core-program:In a complex configuration, user didn't specify a command.O core-programIn a complex configuration, usage information was requested with --help., either globally or for the supplied command.P core-program.Display of the program version requested with  --version.Q 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 "gmbh"; the argument has parameter name "filename" (assuming that is what was declared in the [ entry) and a value being the Admiral's CV. This would be returned as: Q  [("username","gbmh"), ("filename","GraceHopper_Resume.pdf")] [] &The case of a complex command such as git or stack, you get the specific mode chosen by the user returned in the first position: $ missiles launch --all would be parsed as: Q ( "launch") [("all",Empty)] [] V 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).Y core-programDeclaration of an optional switch or mandatory argument expected by a program.Z 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.[ 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 case. If the identifier is two or more words they are joined with a hyphen. Examples:  [ Z "quiet" ( 'q') X* "Keep the noise to a minimum." , Z "dry-run"  (W "TIME") "Run a simulation of what would happen at the specified time." , [< "username" "The user to delete from the system." ] By convention a  description 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.\ declares an environment variable that, if present, will be read by the program and stored in its runtime context. By convention these are  upper case. If the identifier is two or more words they are joined with an underscore:  [ ... , \ "CRAZY_MODE" "Specify how many crazies to activate." , ... ] ] 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.` core-programThe setup for parsing the command-line arguments of your program. You build a Config with simple or complex, and pass it to  .a core-program:The name of an option, command, or agument (omitting the "--" prefix in the case of options). This identifier will be used to generate usage text in response to --help and by you later when retreiving the values of the supplied parameters after the program has initialized.Turn on OverloadedStrings+ when specifying configurations, obviously.c core-programThe description of an option, command, or environment variable (for use when rendering usage information in response to --help on the command-line).d core-program-Single letter "short" options (omitting the "-" prefix, obviously).e  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 simple.f  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"   (f [ Z "host" ( 'h') X [| Specify an alternate host to connect to when performing the frobnication. The default is "localhost". |] , Z "port" ( 'p') X [| Specify an alternate port to connect to when frobnicating. |] , Z "dry-run"  (W "TIME") [| Perform a trial run at the specified time but don't actually do anything. |] , Z "quiet" ( 'q') X [<| Supress normal output. |] , [ "filename" [| 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 informational messages. 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. $ | For information on how to use the multi-line string literals shown here, see  in Core.Text.Utilities.g  core-programDeclare 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)  (complex [ ^ [ Z "station-name"  (W "NAME") [| Specify an alternate radio station to connect to when performing actions. The default is "BBC Radio 1". |] , \ "PLAYER_FORCE_HEADPHONES" [| If set to 1, override the audio subsystem to force output to go to the user's headphone jack. |] ] , _( "play" "Play the music." [ Z "repeat"  X [| Request that they play the same song over and over and over again, simulating the effect of listening to a Top 40 radio station. |] ] , _ "rate" "Vote on whether you like the song or not." [ Z "academic"  X [| 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. |] , Z "numeric"  X [| 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. |] , Z "unicode" ( 'c') X [| 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. |] , [ "score" [| The rating you wish to apply. |] ] ])  context program is 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 . This is a good pattern to use given we are so early in the program's lifetime).  () # quiet = case quiet of W _ -> ? NotQuiteRight -- complain that flag doesn't take value X -> 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 V6, 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-programLook 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-programLook to see if the user supplied the named environment variable and if so, return what its value was. core-programIllegal internal state resulting from what should be unreachable code or otherwise a programmer error.## None  core-program>This gives you a function that you can use within your lifted  actions to return to the  monad.The 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.Before continuing we insert a 100ms pause to allow whatever the editor was to finish its write and switcheroo sequence.None@BCADHPONMLKIJQRUSTVWXY\Z[]^_`abcdefghijklmn;&'(&)*&+,&+-&./&'0&'1&23&45&46&47&48&9:&9;&9<&9=&9>&?@&4ABCDBCEBCFBCFGHIGJKGJLGJMGJNGJOGJPGJQGJRGJSGHTGHUGHVGHWGHXGHYGHZGH[GH\GH]GH^GH_GH`GHaGHbGHcGHdGHeGHfGHgGHhGHiGHjGHkGHlGHmnopnoqnornosnotuvwxyz{|}~     &&&&&&.&!&&+core-program-0.3.1.0-8T5YZTeOF4r52m4GhpG6y5Core.System.BaseCore.System.ExternalCore.System.PrettyCore.Program.MetadataCore.Program.ArgumentsCore.Program.Execute Core.ProgramCore.Program.LoggingCore.Program.UnliftCore.Program.Notify Core.System configureNonesimplegetCommandLineProgramCore.Program.Context executeWith fromPackageexecutesetVerbosityLevelgetApplicationStatesetApplicationStateCore.Telemetry.Observability beginTrace usingTrace encloseSpanCore.Program.Signaltrap_ Control.MonadforeverCore.Text.UntilitiesRenderControl.ConcurrentforkIOmapM_mapMbaseGHC.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-78bArwB7lyfNecxH5ho14Chrono.TimeStampgetCurrentTimeNanoseconds unTimeStamp TimeStamp)prettyprinter-1.7.1-BauxLiNvN3EiJKyXe93SMPrettyprinter.InternalDocPrettyprinter.Symbols.Asciicommarbracelbracerbracketlbracketrparenlparendquotesquote unAnnotateannotateenclose punctuatefillCatvcathcatsepfillSepvsephsep concatWith<+>indenthangflatAltgrouphardline softline'softlineline'linenestemptyDocprettyPretty.safe-exceptions-0.1.7.2-JneZS63Oo6PChwawONXlrZControl.Exception.Safefinallybracketcatch impureThrowthrowVersionprojectNameFromprojectSynopsisFromversionNumberFrom$fIsStringVersion $fShowVersion$fLiftLiftedRepVersionInvalidCommandLine InvalidOption UnknownOptionMissingArgumentUnexpectedArgumentsUnknownCommandNoCommandFound HelpRequestVersionRequest ParameterscommandNameFromparameterValuesFromenvironmentValuesFromParameterValueValueEmptyOptionsOptionArgumentVariableCommandsGlobalCommandConfigLongName Description ShortName blankConfig simpleConfig complexConfig appendOptionemptyParametersbaselineOptionsparseCommandLineextractValidEnvironments buildUsage buildVersion$fTextualLongName$fPrettyLongName $fKeyLongName$fIsStringParameterValue$fExceptionInvalidCommandLine$fShowInvalidCommandLine$fEqInvalidCommandLine$fShowParameters$fEqParameters$fShowParameterValue$fEqParameterValue$fShowLongName$fIsStringLongName $fEqLongName$fHashableLongName $fOrdLongName VerbosityOutputVerboseDebugContext$sel:programNameFrom:Context$sel:terminalWidthFrom:Context$sel:versionFrom:Context$sel:initialConfigFrom:Context!$sel:initialExportersFrom:Context$sel:commandLineFrom:Context$sel:exitSemaphoreFrom:Context$sel:startTimeFrom:Context$sel:verbosityLevelFrom:Context$sel:outputChannelFrom:Context!$sel:telemetryChannelFrom:Context#$sel:telemetryForwarderFrom:Context$sel:currentDatumFrom:Context $sel:applicationDataFrom:Context Forwarder#$sel:telemetryHandlerFrom:ForwarderExporter$sel:codenameFrom:Exporter$sel:setupConfigFrom:Exporter$sel:setupActionFrom:ExporterTraceSpanDatum$sel:spanIdentifierFrom:Datum$sel:spanNameFrom:Datum$sel:serviceNameFrom:Datum$sel:spanTimeFrom:Datum$sel:traceIdentifierFrom:Datum$sel:parentIdentifierFrom:Datum$sel:durationFrom:Datum$sel:attachedMetadataFrom:Datum emptyDatumunSpanunTraceemptyForwarder fmapContextisNone unProgram getContext subProgramhandleCommandLinehandleVerbosityLevelhandleTelemetryChoiceSeverity SeverityNoneSeverityCritical SeverityWarn SeverityInfo SeverityDebug putMessageformatLogMessagewritewriteSwriteRinfowarncriticaldebugdebugSdebugRThread loopForever terminategetVerbosityLevelsetProgramNamegetProgramNamegetConsoleWidth outputEntire inputEntire execProcessunThread forkThread resetTimer sleepThread waitThread waitThread_lookupArgumentlookupOptionValuelookupOptionFlaglookupEnvironmentValueinvalid withContext waitForChangeghc-prim GHC.TypesIO GHC.MaybeNothingJust(core-text-0.3.5.0-7nNKEmJTl05KmKc2n81kwLCore.Text.UtilitiesquoteGHC.BasememptyMonoidsetupSignalHandlersGHC.ShowshowprintrenderShow"async-2.2.4-Khnf8sHKxyWEfiI0ZZ50wtControl.Concurrent.AsyncAsyncCore.Text.RopeintoRope,typed-process-0.2.6.3-2coORhZ0yux5KTJGRth8UbSystem.Process.Typed readProcess GHC.Conc.IO threadDelayreturn)core-data-0.2.1.11-4JsEGx4cs39HMe5zSU6XmFCore.Data.StructuresMaplookupKeyValue