h*40      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abc1.10.21 Safe-Inferred1defghijklmnopqrstuvwxyz{|}~ Safe-Inferred;2015 Joey Hess  BSD-2-clause Safe-Inferred7 concurrent-outputBuffered output.concurrent-outputThis alias is provided to avoid breaking backwards compatibility.concurrent-outputValues that can be output.concurrent-output.A shared global variable for the OutputHandle.concurrent-outputHolds a lock while performing an action. This allows the action to perform its own output to the console, without using functions from this module.While this is running, other threads that try to lockOutput will block. Any calls to " and & will not block, but the output will be buffered and displayed only once the action is done.concurrent-output%Blocks until we have the output lock.concurrent-output0Tries to take the output lock, without blocking.concurrent-output/Only safe to call after taking the output lock. concurrent-output%Use this around any actions that use " or & , unless  is being used.This is necessary to ensure that buffered concurrent output actually gets displayed before the program exits.!concurrent-output&Blocks until any processes started by & have finished, and any buffered output is displayed. Also blocks while  is is use.  calls this at the end, so you do not normally need to use this."concurrent-outputDisplays a value to stdout.Uses locking to ensure that the whole output occurs atomically even when other threads are concurrently generating output.No newline is appended to the value, so if you want a newline, be sure to include it yourself.When something else is writing to the console at the same time, this does not block. It buffers the value, so it will be displayed once the other writer is done.0When outputConcurrent is used within a call to , the output is displayed above the currently open console regions. Only lines ending in a newline are displayed in this case (it uses 7).#concurrent-outputLike ", but displays to stderr.(Does not throw an exception.)%concurrent-outputSame as 6; provided to avoid breaking backwards compatibility.&concurrent-outputWrapper around   that prevents multiple processes that are running concurrently from writing to stdout/stderr at the same time.If the process does not output to stdout or stderr, it's run by createProcess entirely as usual. Only processes that can generate output are handled specially:A process is allowed to write to stdout and stderr in the usual way, assuming it can successfully take the output lock.When the output lock is held (ie, by another concurrent process, or because " is being called at the same time), the process is instead run with its stdout and stderr redirected to a buffer. The buffered output will be displayed as soon as the output lock becomes free.Note that the the process is waited for by a background thread, so unlike createProcess, neglecting to call waitForProcess will not result in zombie processess.'concurrent-outputWrapper around   that makes sure a process is run in the foreground, with direct access to stdout and stderr. Useful when eg, running an interactive process.Note that the the process is waited for by a background thread, so unlike createProcess, neglecting to call waitForProcess will not result in zombie processess.3concurrent-output4Adds a value to the output buffer for later display.Note that buffering large quantities of data this way will keep it resident in memory until it can be displayed. While " uses temp files if the buffer gets too big, this STM function cannot do so.5concurrent-outputA STM action that waits for some buffered output to become available, and returns it.The function can select a subset of output when only some is desired; the fst part is returned and the snd is left in the buffer.This will prevent it from being displayed in the usual way, so you'll need to use 9 to display it yourself.7concurrent-output Use with 5 to make it only return buffered output that ends with a newline. Anything buffered without a newline is left in the buffer.9concurrent-output3Emits the content of the OutputBuffer to the Handle If you use this, you should use : to ensure you're the only thread writing to the console.;concurrent-outputNote that using a lazy Text as an Outputable value will buffer it all in memory.:  !"#$%&'()*+,-./0123456789: !"#$%&'()* +,-./0123456789 2015 Joey Hess  BSD-2-clause Safe-Inferred "#&'!% 35679 "#&'!% 356792015 Joey Hess  BSD-2-clause Safe-Inferred@concurrent-outputCalls &Aconcurrent-outputCalls %@A@A2015 Joey Hess  BSD-2-clause Safe-Inferred0Bconcurrent-output)Values that can be displayed in a region.Dconcurrent-outputMany actions in this module can be run in either the IO monad or the STM monad. Using STM allows making several changes to the displayed regions atomically, with the display updated a single time.Hconcurrent-output4A handle allowing access to a region of the console.Iconcurrent-output1Controls how a region is laid out in the console.Here's an annotated example of how the console layout works. Each sequence of the same letter represents a distinct region. scrolling...... scrolling...... scrolling...... aaaaaa......... -- Linear bbbbbbbbbbbbbbb -- Linear bbb............ (expanded to multiple lines) ccccccccc...... -- Linear ddddeeeefffffff -- [InLine] fffffggggg..... (expanded to multiple lines) Lconcurrent-output;All the regions that are currently displayed on the screen.The list is ordered from the bottom of the screen up. Reordering it will change the order in which regions are displayed. It's also fine to remove, duplicate, or add new regions to the list.Mconcurrent-outputGets the width of the console.On Unix, this is automatically updated when the terminal is resized. On Windows, it is determined at start. On WASM, the console width is hard coded to 80 since WASI does not provide a way to determine it.Nconcurrent-outputGet the height of the console.On Unix, this is automatically updated when the terminal is resized. On Windows, it is determined at start. On WASM, the console heigth is hard coded to 25 since WASI does not provide a way to determine it.concurrent-output Check if X is running.Oconcurrent-outputSets the value of a console region. This will cause the console to be updated to display the new value.It's fine for the value to be longer than the terminal is wide, or to include newlines ('n'). Regions expand to multiple lines as necessary.The value can include ANSI SGR escape sequences for changing the colors of all or part of a region. For this to display properly, a reset escape sequence must be included to get the color back to default. System.Console.ANSI makes it easy to construct such values. For example:  import System.Console.ANSI setConsoleRegion region ( "hello " <> setSGRCode [SetColor Foreground Vivid Red] <> "Mars" <> setSGRCode [Reset] <> "!" )Other ANSI escape sequences, especially those doing cursor movement, will mess up the layouts of regions. Caveat emptor.ANSI SGR escape sequences that span multiple lines do not currently display as you might hope. (Patches would be accepted.)Pconcurrent-output9Appends a value to the current value of a console region. appendConsoleRegion progress "." -- add another dot to progress displayQconcurrent-outputRuns the action with a new console region, closing the region when the action finishes or on exception.Rconcurrent-outputOpens a new console region.Sconcurrent-output7Makes a new region, but does not add it to the display.Tconcurrent-outputCloses a console region. Once closed, the region is removed from the display.Uconcurrent-outputCloses the console region, and displays the passed value in the scrolling area above the active console regions. When Nothing is passed, displays the current value of the console region.Vconcurrent-output-Gets the current content of a console region.Wconcurrent-output&Changes how a console region displays.Each time the region's value changes, the STM action is provided with the current value of the region, and returns the value to display.For example, this will prevent a region from ever displaying more than 10 characters wide, and will make it display text reversed: tuneDisplay myregion $ pure . T.take 10 tuneDisplay myregion $ pure . T.reverse7Note that repeated calls to tuneDisplay are cumulative.Normally, the STM action should avoid retrying, as that would block all display updates.Xconcurrent-output;Handles all display for the other functions in this module.Note that this uses , so it takes over all output to the console while the passed IO action is running. As well as displaying the console regions, this handles display of anything buffered by " and &. So,   and !9 should not be run while this is in use, and will block.When standard output is not an ANSI capable terminal, console regions are not displayed.concurrent-outputThis is a broadcast TChan, which gets a DisplayChange written to it after the display has been updated. It can be used to wait for something to be displayed.Yconcurrent-outputRuns a STM action, and waits for the display to be fully updated with any changes that action makes to the displayed regions.concurrent-outputWait for any changes to the region list, eg adding or removing a region.concurrent-outputSplits a Text into the lines it would display using when output onto a console with a given width, starting from the first column.ANSI SGR sequences are handled specially, so that color, etc settings work despite the lines being split up, and the lines can be output indepedently. For example, "foooREDbar bazRESET" when split into lines becomes ["fooREDbarRESET", "RED bazRESET"]concurrent-outputFinds the least expensive output to make a console that was displaying the old line display the new line. Cursor starts at far left.Basically, loop through and find spans where the old and new line are the same. Generate cursorForwardCode ANSI sequences to skip over those spans, unless such a sequence would be longer than the span it's skipping.Since ANSI sequences can be present in the line, need to take them into account. Generally, each of the sequences in new has to be included, even if old contained the same sequence: old: GREENfoofoofooREDbarbarbarRESETbaz new: GREENfoofoofooREDxarbarbaxRESETbaz ret: GREEN-------->REDx------>yRESET(The first GREEN does not effect any output text, so it can be elided.)Also, despite old having the same second span as new, in the same location, that span has to be re-emitted because its color changed: old: GREENfoofooREDbarbarbarbarbar new: GREENfoofoofooTANbarbarbar ret: GREEN----->fooTANbarbarbarCLEARRESTAlso note above that the sequence has to clear the rest of the line, since the new line is shorter than the old.\concurrent-output9Makes a STM action be run to get the content of a region.Any change to the values that action reads will result in an immediate refresh of the display.]concurrent-outputNote that using a lazy Text in a region will buffer it all in memory.HIJKBCFGDEXQRSTOPUVWMNLYHIJKBCFGDEXQRSTOPUVWMNLY      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEF GHIJKLLMNOPQRSTUVWXYZ[\]^_`abcdefghijhikhilhimhinhinopqopropsoptopuopvopwopxopyopzop{op|op}op~opopopopopopopopopopopopopopopopopopG0concurrent-output-1.10.21-6lfxGMlkdbE9NyhJHWDSxi"System.Console.Concurrent.InternalSystem.Process.ConcurrentSystem.Console.Regionsconcurrent-outputUtility.Exception Utility.MonaddisplayConsoleRegionsSystem.Process createProcessSystem.Console.ConcurrentBufSigAtEndOutputBufferedActivityOutput InTempFiletempFile endsInNewLine StdHandleStdOutStdErr OutputBufferConcurrentProcessHandle OutputabletoOutputLockLocked OutputHandle outputLock outputBuffer errorBuffer outputThreadsglobalOutputHandle lockOutputtakeOutputLocktryTakeOutputLockwithLocktakeOutputLock'dropOutputLockwithConcurrentOutputflushConcurrentOutputoutputConcurrenterrorConcurrentoutputConcurrent'waitForProcessConcurrentcreateProcessConcurrentcreateProcessForeground fgProcess bgProcess willOutputtoHandle bufferForsetupOutputBuffer outputDrainerregisterOutputThreadunregisterOutputThread bufferWriteraddOutputBufferbufferOutputSTMbufferOutputSTM'outputBufferWaiterSTM waitAnyBufferwaitCompleteLines endsNewLineemitOutputBuffer$fOutputableList$fOutputableText$fOutputableText0 $fEqAtEnd$fEqOutputBuffer$fEqOutputBufferedActivitywaitForProcessToRegionContenttoRegionContent LiftRegion liftRegion RegionContent ConsoleRegion RegionLayoutLinearInLine regionList consoleWidth consoleHeightsetConsoleRegionappendConsoleRegionwithConsoleRegionopenConsoleRegionnewConsoleRegioncloseConsoleRegionfinishConsoleRegiongetConsoleRegion tuneDisplaywaitDisplayChange$fLiftRegionIO$fLiftRegionSTM$fToRegionContentSTM$fToRegionContentText$fToRegionContentText0$fToRegionContentList$fEqLineUpdate$fShowLineUpdate$fEqConsoleRegion$fEqRegionLayoutbaseGHC.Exception.Type Exception toException fromExceptiondisplayException SomeExceptionexceptions-0.10.7Control.Monad.CatchExitCaseExitCaseSuccessExitCaseException ExitCaseAbort MonadMaskmaskuninterruptibleMaskgeneralBracket MonadCatchcatch MonadThrowthrowMbracket_catchAllbrackettry onExceptionmask_uninterruptibleMask_finally catchJusthandle handleJusttryJustbracketOnErrorcatches catchIOErrorcatchIf handleIOError handleAllhandleIfonError catchBoolIO catchMaybeIOcatchDefaultIO catchMsgIOcatchIOtryIO bracketIO catchNonAsync tryNonAsync tryWhenExistscatchHardwareFaultifMnoopprocess-1.6.17.0regionDisplayEnableddisplayUpdateNotifierregionListWaiter calcLinescalcLineUpdate