!(      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ None *>HMPV_`GterminalXThis class offers abstract value constructors for foreground and background coloring. terminalThis attribute sets the  foreground color (the text color). terminalThis attribute sets the  background color.terminal!This attribute makes text appear bold.terminal!This attribute makes text appear italic.terminal,This attribute makes text appear underlined.terminal7This attribute swaps foreground and background (color).`This operation is idempotent: Applying the attribute a second time won't swap it back. Use  instead.terminal<This class introduces abstract constructors for text markup.terminaliThis associated type represents all possible attributes that are available in the current environment.When writing polymorphic code against these monadic interfaces the concrete instantiation of this type is usually unknown and class instances are generally advised to not expose value constructors for this type.Instead, subclasses like   and + offer abstract value constructors like , , @ which are then given meaning by the concrete class instance.terminalFReset an attribute so that it does no longer affect subsequent output.Binary attributes like  or ' shall just be reset to their opposite.hFor non-binary attributes like colors all of their possible values shall be treated as equal, so that   (  $   ) >>  (  ) Hresults in the foreground color attribute reset afterwards whereas after   (  $   ) >>  (  ) %the foreground color is still set as   .terminal&Reset all attributes to their default.terminaliShall determine wheter two attribute values would override each other or can be applied independently.#Shall obey the laws of equivalence.terminaltThis class describes an environment that Unicode text can be printed to. This might either be file or a terminal.>Instances shall implement the concept of lines and line width.lInstances shall implement the concept of a carriage that can be set to the beginning of the next line.It is assumed that the carriage automatically moves to the beginning of the next line if the end of the current line is reached.aInstances shall be Unicode aware or must at least be able to print a replacement character./Implementations must be aware of infinite lazy s and long s. s should be printed character wise as evaluating them might trigger exceptions at any point. Long text should be printed chunk wise in order to stay interruptible.Implementations must not use an unbounded output buffer. Print operations shall block and be interruptible when the output buffer is full.Instances shall not pass control characters in text to the printer (not even line break). Control characters shall be replaced with . Text formatting shall be done with the designated classes extending . Allowing control sequences would cause a dependency on certain terminal types, but also pose an underrated security risk as modern terminals are highly programmable and should not be fed with untrusted input.terminal4Move the carriage to the beginning of the next line.terminalPrint a single character.terminalPrint a .terminalPrint a  and an additional newline.terminalPrint a .terminalPrint a  and an additional newline.terminaluFlush the output buffer and make the all previous output actually visible after a reasonably short amount of time.EThe operation may return before the buffer has actually been flushed. terminalGet the current line width.tThe operation may return the last known line width and may not be completely precise when I/O is asynchronous.zThis operations shall not block too long and rather be called more often in order to adapt to changes in line width.!   None*MP_`n"terminal)Get the dimensions of the visible window.#terminalMove the cursor n lines up. Do not change column.$terminalMove the cursor n" lines down. Do not change column.%terminalMove the cursor n* columns to the right. Do not change line.&terminalMove the cursor n) columns to the left. Do not change line.'terminal<Get the current cursor position as reported by the terminal. Position 0 0! is the upper left of the window.*The cursor is always within window bounds.mThis operation causes a round-trip to the terminal and shall be used sparely (e.g. on window size change).(terminalSet the cursor position. Position 0 0! is the upper left of the window.SThe resulting cursor position is undefined when it is outside the window bounds.)terminalSet the cursor row.0 is the topmost row.*terminalSet the cursor column.0 is the leftmost column.+terminal$Save cursor position and attributes.,terminal'Restore cursor position and attributes.+Restores the cursor as previously saved by +.9The cursor position is strictly relative to the visible window and does not take eventual scrolling into account. The advantage of this operation is that it does not require transmission of coordinates and attributes to the terminal and is therefor slightly more efficient than all other alternatives.Only use this when auto-wrap is disabled, alternate screen buffer is enabled or you can otherwise guarantee that the window does not scroll between + and ,!-terminalWInsert whitespace at the cursor position and shift existing characters to the right..terminal?Delete characters and shift existing characters from the right./terminal#Replace characters with whitespace.0terminal0Insert lines and shift existing lines downwards.1terminal4Delete lines and shift up existing lines from below.2terminal&Clears characters in the current line.3terminal*Clears lines above/below the current line.4terminalShow the cursor.5terminalHide the cursor.6terminal2Whether or not to automatically wrap on line ends.7terminal2Whether or not to use the alternate screen buffer.nThe main screen buffer content is preserved and restored when leaving the alternate screen screen buffer.SThe dimensions of the alternate screen buffer are exactly those of the screen.9terminal,Erase left of/above current cursor position.:terminal-Erase right of/below current cursor position.;terminalErase whole line/screen.#!76543210/.-,+*)('&%$#"8;:9<=?>@ABCNone*MP_` DterminalInterrupt is a special type of event that needs to be treated with priority. It is therefor not included in the regular event stream.Vterminal!Events triggered by mouse action.6Mouse event reporting must be activated before (TODO).\terminalModifier keys.]terminalEvents triggered by key press.oterminalEvents emitted by the terminal.Event decoding might be ambique. In case of ambiqueness all possible meaning shall be emitted. The user is advised to only match on events expected in a certain context and ignore all others.:Key events are highly ambique: I.e. when the user presses space= it might either be meant as a regular text element (like a,b,cN) or the focus is on the key itself (like in "Press space to continue...").FThe story is even more complicated: Depending on terminal type and termiosA settings, certain control codes have special meaning or not (Ctrl+Cn sometimes means interrupt, but not if the environment supports delivering it as a signal). Don't wait for Ctrl+C when you mean D+! Example: The tab key will likely emit KeyEvent (CharKey I ) ctrlKey and KeyEvent TabKey mempty in most settings.uterminal?This monad describes an environment that maintains a stream of o5s and offers out-of-band signaling for interrupts.An interrupt shall occur if the user either presses CTRL+C or any other mechanism the environment designates for that purpose.Implementations shall maintain an interrupt flag that is set when an interrupt occurs. Computations in this monad shall check and reset this flag regularly. If the execution environment finds this flag still set when trying to signal another interrupt, it shall throw  / to the seemingly unresponsive computation.vterminalHWait for the next interrupt or next event transformed by a given mapper. The first mapper parameter is a transaction that succeeds as soon as an interrupt occurs. Executing this transaction resets the interrupt flag. When a second interrupt occurs before the interrupt flag has been reset, the current thread shall receive an  .-The second mapper parameter is a transaction that succeeds as as soon as the next event arrives and removes that event from the stream of events. It shall be executed at most once within a single transaction or the transaction would block until the requested number of events is available.YThe mapper may also be used in order to additionally wait on external events (like an    to complete).wterminalWait for the next event.:Returns as soon as an interrupt or a regular event occurs.cThis operation resets the interrupt flag, signaling responsiveness to the execution environment.xterminal&Check whether an interrupt is pending.cThis operation resets the interrupt flag, signaling responsiveness to the execution environment.:DEFHGILKJMQPONRUTSV[ZYXW\]nmlkjihgfedcba`_^otpsrquvwxyz{| None*MP_`}terminal The type } is a finite state transducer.IIntermediate state can be passed as closure. See below for an example.}~ None*MP_`terminalIThis is a convenience class combining all other terminal related classes.None*MP_`]terminalPrint an annotated .Example: Eimport System.Terminal import Data.Text.Prettyprint.Doc printer :: (MonadFormatingPrinter m,  m) => m () printer =  $  (foreground $   ) "This is blue!" <>  <>  A ("Just bold!" <> otherDoc <> "..just bold again") otherDoc :: ( m,  m ~ ann) =>  ann otherDoc =  (  ) " BOLD ON RED BACKGROUND " "Note the necessary unification of  m and ann in the definition of otherDoc!terminalLike  but adds an additional newline.terminalPrints types instantiating the  class.terminalPrints types instantiating the & class and adds an additional newline.terminalPrints 1s (rather internal and not for the average user).None*MP_`l terminal ANSI colors.terminalANSI text attributes.terminal0The commands every terminal needs to understand.zThis shall only be extended when something is missing that all terminals understand. Otherwise portability will be lost.terminaleTypes that represent terminals need to implement this class in order to be driven by this library.&This library ships with two instances:7 represents the local terminal wired to the process.j is a minimal in-process terminal emulator designed to be used for unit-testing terminal applications. terminalVThe terminal identification string usually extracted from the environment variable TERM. Should contain values like xterm or  rxvt-unicode.terminallA stream of input events. The transaction will succeed as soon as the next input event becomes available.Note: Trying to read more than one event within the same transaction might be successfull, but might also lead to undesired behaviour as the transaction will block until all of its preconditions are fulfilled.terminalThis transaction succeeds as soon as an interrupt occurs. Executing the transaction shall reset an interrupt flag maintained by a supervising background thread.It is mandatory to regularly check this transaction in order to signal responsiveness to the background thread. The execution environment is otherwise advised to throw an  Y exception as soon as a second interrupt arrives and it sees a previous one unhandled.terminalThis operation shall send a command to the terminal. It shall block when the buffer exeeded its capacity and unblock as soon as space becomes available again.Note: All implementations must limit the size of the output buffer or the application is at risk of running out of memory when writing much faster than the terminal can read.terminal This operations flushes the output buffer. Whether it blocks or not until the buffer has actually been flushed shall be undefined (there might be other buffers involved that cannot be force-flushed so it is probably better to not give any guarantees here).terminalMThis operation shall return the latest known window size without blocking.terminalThis operation shall return the current cursor position. It may block as depending on implementation it usually requires an in-band roundtrip to the terminal. Use it wisely.;None*MP_`terminalSee 8https://en.wikipedia.org/wiki/List_of_Unicode_charactersNone*MP_`TNone *HMPVX_`0terminal8This monad transformer represents terminal applications.cIt implements all classes in this module and should serve as a good foundation for most use cases.Note that it is not necessary nor recommended to have this type in every signature. Keep your application abstract and mention  only once at the top level.Example: main :: IO () main =  withTerminal (# myApplication) myApplication :: (# m) => m () myApplication = do  "Hello world!"  terminalRun a # application on the given terminal.None*MP_`terminal;Run the given handler with the locally connected terminal ( / ). <import System.Terminal main :: IO () main = withTerminal $  do + "Hello there, please press a button!"  ev <-  waitEvent  $ "Event was " ++ show ev    !"#$%&'()*+,-./0123456789:;<=>?@ACBDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnoqrsptuvwxyz{|Ɔ   !"#$%&'()*+,-./01234567@ACB<=>?89:;uvwxoqrsptDE]^_`abcdefghijklmn\yz{|MNOPQVWXYZ[RSTUIJKLFGHNone*MP_`S!None*MP_`>O}~O}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVVWXYYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~m`]   -s 35ABCDGHIJKLMPQ'terminal-0.2.0.0-IsxWmqDhmFG9BMeJ7wIe3oSystem.TerminalSystem.Terminal.InternalSystem.Terminal.MonadPrinter Data.TextTextSystem.Terminal.MonadScreenSystem.Terminal.MonadInput Control.Exception.AsyncException UserInterruptControl.Monad.AsyncAsyncSystem.Terminal.DecoderSystem.Terminal.MonadTerminalSystem.Terminal.PrettySystem.Terminal.TerminalSystem.Terminal.Platform LocalTerminalSystem.Terminal.VirtualVirtualTerminalSystem.IO.ErrorSystem.Terminal.EncoderSystem.Terminal.TerminalT System.IOstdinstdoutMonadColorPrinterColorblackredgreenyellowbluemagentacyanwhitebright foreground backgroundMonadFormattingPrinterbolditalic underlinedinvertedMonadMarkupPrinter Attribute setAttributeresetAttributeresetAttributesresetsAttribute MonadPrinterputLnputChar putString putStringLnputText putTextLnflush getLineWidth MonadScreen getWindowSize moveCursorUpmoveCursorDownmoveCursorForwardmoveCursorBackwardgetCursorPositionsetCursorPosition setCursorRowsetCursorColumn saveCursor restoreCursor insertChars deleteChars eraseChars insertLines deleteLines eraseInLineeraseInDisplay showCursor hideCursor setAutoWrapsetAlternateScreenBuffer EraseMode EraseBackward EraseForwardEraseAllPositionrowcolSizeheightwidth Interrupt DeviceEventDeviceAttributesReportCursorPositionReport WindowEventWindowLostFocusWindowGainedFocusWindowSizeChanged DirectionUpwards Downwards Leftwards Rightwards MouseButtonLeftMouseButtonRightMouseButtonOtherMouseButton MouseEvent MouseMovedMouseButtonPressedMouseButtonReleasedMouseButtonClicked MouseWheeled ModifiersKeyCharKeyTabKeySpaceKey BackspaceKeyEnterKey InsertKey DeleteKeyHomeKeyBeginKeyEndKey PageUpKey PageDownKey EscapeKeyPrintKeyPauseKeyArrowKey FunctionKeyEventKeyEvent OtherEvent MonadInput awaitWith awaitEventcheckInterruptshiftKeyctrlKeyaltKeymetaKeyDecoder feedDecoderdefaultDecoder MonadTerminalputDocputDocLn putPretty putPrettyLnputSimpleDocStreamBlackRedGreenYellowBlueMagentaCyanWhite BrightBlack BrightRed BrightGreen BrightYellow BrightBlue BrightMagenta BrightCyan BrightWhiteBoldItalic UnderlinedInverted Foreground BackgroundCommandPutLnPutText SetAttributeResetAttributeResetAttributes MoveCursorUpMoveCursorDownMoveCursorForwardMoveCursorBackward ShowCursor HideCursor SaveCursor RestoreCursorGetCursorPositionSetCursorPosition SetCursorRowSetCursorColumn InsertChars DeleteChars EraseChars InsertLines DeleteLines EraseInLineEraseInDisplay SetAutoWrapSetAlternateScreenBufferTerminaltermType termEvent termInterrupt termCommand termFlushtermGetWindowSizetermGetCursorPosition defaultEncode TerminalT runTerminalT withTerminalVirtualTerminalSettings virtualTypevirtualWindowSize virtualEventvirtualInterruptvirtualSettings virtualCursor virtualWindowvirtualAutoWrapvirtualAlternateScreenBufferwithVirtualTerminalbaseGHC.BaseString text-1.2.3.1Data.Text.Internal interpretCSI*prettyprinter-1.2.1-JPC8f5cJn5SAkoQXDSGO7Z"Data.Text.Prettyprint.Doc.InternalDocannotatelinePrettySimpleDocStreamsafeChar sanitizeChar sanitizeTextcommand scrollDownmoveCursorHorizontalmoveCursorVertical