-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A command-line interface for user input, written in Haskell.
gr
grHaskeline provides a user interface for line input in command-line
grprograms. This library is similar in purpose to readline, but since it
gris written in Haskell it is (hopefully) more easily used in other
grHaskell programs.
gr
grHaskeline runs both on POSIX-compatible systems and on Windows.
@package haskeline
@version 0.7.4.2


-- | This module redefines some of the functions in
gr<a>Control.Exception</a> to work for more general monads built on top
grof <a>IO</a>.
module System.Console.Haskeline.MonadException

-- | An instance of <a>MonadException</a> is generally made up of monad
grtransformers layered on top of the IO monad.
gr
grThe <a>controlIO</a> method enables us to "lift" a function that
grmanages IO actions (such as <a>bracket</a> or <a>catch</a>) into a
grfunction that wraps arbitrary monadic actions.
class MonadIO m => MonadException m
controlIO :: MonadException m => (RunIO m -> IO (m a)) -> m a
catch :: (MonadException m, Exception e) => m a -> (e -> m a) -> m a
handle :: (MonadException m, Exception e) => (e -> m a) -> m a -> m a
catches :: (MonadException m) => m a -> [Handler m a] -> m a
data Handler m a
Handler :: (e -> m a) -> Handler m a
finally :: MonadException m => m a -> m b -> m a
throwIO :: (MonadIO m, Exception e) => e -> m a
throwTo :: (MonadIO m, Exception e) => ThreadId -> e -> m ()
bracket :: MonadException m => m a -> (a -> m b) -> (a -> m c) -> m c

-- | Lift a IO operation
gr
gr<pre>
grwrap :: (a -&gt; IO b) -&gt; IO b
gr</pre>
gr
grto a more general monadic operation
gr
gr<pre>
grliftIOOp wrap :: MonadException m =&gt; (a -&gt; m b) -&gt; m b
gr</pre>
gr
grFor example:
gr
gr<pre>
gr<a>liftIOOp</a> (<a>withFile</a> f m) :: MonadException m =&gt; (Handle -&gt; m r) -&gt; m r
gr<a>liftIOOp</a> <a>alloca</a> :: (MonadException m, Storable a) =&gt; (Ptr a -&gt; m b) -&gt; m b
gr<a>liftIOOp</a> (<a>withForeignPtr</a> fp) :: MonadException m =&gt; (Ptr a -&gt; m b) -&gt; m b
gr</pre>
liftIOOp :: MonadException m => ((a -> IO (m b)) -> IO (m c)) -> (a -> m b) -> m c

-- | Lift an IO operation
gr
gr<pre>
grwrap :: IO a -&gt; IO a
gr</pre>
gr
grto a more general monadic operation
gr
gr<pre>
grliftIOOp_ wrap :: MonadException m =&gt; m a -&gt; m a
gr</pre>
liftIOOp_ :: MonadException m => (IO (m a) -> IO (m a)) -> m a -> m a

-- | A <a>RunIO</a> function takes a monadic action <tt>m</tt> as input,
grand outputs an IO action which performs the underlying impure part of
gr<tt>m</tt> and returns the '<tt>pure'</tt> part of <tt>m</tt>.
gr
grNote that <tt>(RunIO return)</tt> is an incorrect implementation,
grsince it does not separate the pure and impure parts of the monadic
graction. This module defines implementations for several common monad
grtransformers.
newtype RunIO m
RunIO :: (forall b. m b -> IO (m b)) -> RunIO m

-- | Any type that you wish to throw or catch as an exception must be an
grinstance of the <tt>Exception</tt> class. The simplest case is a new
grexception type directly below the root:
gr
gr<pre>
grdata MyException = ThisException | ThatException
gr    deriving Show
gr
grinstance Exception MyException
gr</pre>
gr
grThe default method definitions in the <tt>Exception</tt> class do what
grwe need in this case. You can now throw and catch
gr<tt>ThisException</tt> and <tt>ThatException</tt> as exceptions:
gr
gr<pre>
gr*Main&gt; throw ThisException `catch` \e -&gt; putStrLn ("Caught " ++ show (e :: MyException))
grCaught ThisException
gr</pre>
gr
grIn more complicated examples, you may wish to define a whole hierarchy
grof exceptions:
gr
gr<pre>
gr---------------------------------------------------------------------
gr-- Make the root exception type for all the exceptions in a compiler
gr
grdata SomeCompilerException = forall e . Exception e =&gt; SomeCompilerException e
gr
grinstance Show SomeCompilerException where
gr    show (SomeCompilerException e) = show e
gr
grinstance Exception SomeCompilerException
gr
grcompilerExceptionToException :: Exception e =&gt; e -&gt; SomeException
grcompilerExceptionToException = toException . SomeCompilerException
gr
grcompilerExceptionFromException :: Exception e =&gt; SomeException -&gt; Maybe e
grcompilerExceptionFromException x = do
gr    SomeCompilerException a &lt;- fromException x
gr    cast a
gr
gr---------------------------------------------------------------------
gr-- Make a subhierarchy for exceptions in the frontend of the compiler
gr
grdata SomeFrontendException = forall e . Exception e =&gt; SomeFrontendException e
gr
grinstance Show SomeFrontendException where
gr    show (SomeFrontendException e) = show e
gr
grinstance Exception SomeFrontendException where
gr    toException = compilerExceptionToException
gr    fromException = compilerExceptionFromException
gr
grfrontendExceptionToException :: Exception e =&gt; e -&gt; SomeException
grfrontendExceptionToException = toException . SomeFrontendException
gr
grfrontendExceptionFromException :: Exception e =&gt; SomeException -&gt; Maybe e
grfrontendExceptionFromException x = do
gr    SomeFrontendException a &lt;- fromException x
gr    cast a
gr
gr---------------------------------------------------------------------
gr-- Make an exception type for a particular frontend compiler exception
gr
grdata MismatchedParentheses = MismatchedParentheses
gr    deriving Show
gr
grinstance Exception MismatchedParentheses where
gr    toException   = frontendExceptionToException
gr    fromException = frontendExceptionFromException
gr</pre>
gr
grWe can now catch a <tt>MismatchedParentheses</tt> exception as
gr<tt>MismatchedParentheses</tt>, <tt>SomeFrontendException</tt> or
gr<tt>SomeCompilerException</tt>, but not other types, e.g.
gr<tt>IOException</tt>:
gr
gr<pre>
gr*Main&gt; throw MismatchedParentheses `catch` \e -&gt; putStrLn ("Caught " ++ show (e :: MismatchedParentheses))
grCaught MismatchedParentheses
gr*Main&gt; throw MismatchedParentheses `catch` \e -&gt; putStrLn ("Caught " ++ show (e :: SomeFrontendException))
grCaught MismatchedParentheses
gr*Main&gt; throw MismatchedParentheses `catch` \e -&gt; putStrLn ("Caught " ++ show (e :: SomeCompilerException))
grCaught MismatchedParentheses
gr*Main&gt; throw MismatchedParentheses `catch` \e -&gt; putStrLn ("Caught " ++ show (e :: IOException))
gr*** Exception: MismatchedParentheses
gr</pre>
class (Typeable e, Show e) => Exception e

-- | The <tt>SomeException</tt> type is the root of the exception type
grhierarchy. When an exception of type <tt>e</tt> is thrown, behind the
grscenes it is encapsulated in a <tt>SomeException</tt>.
data SomeException
[SomeException] :: SomeException

-- | Exceptions that occur in the <tt>IO</tt> monad. An
gr<tt>IOException</tt> records a more specific error type, a descriptive
grstring and maybe the handle that was used when the error was flagged.
data IOException
instance System.Console.Haskeline.MonadException.MonadException m => System.Console.Haskeline.MonadException.MonadException (Control.Monad.Trans.Identity.IdentityT m)
instance System.Console.Haskeline.MonadException.MonadException GHC.Types.IO
instance System.Console.Haskeline.MonadException.MonadException m => System.Console.Haskeline.MonadException.MonadException (Control.Monad.Trans.Reader.ReaderT r m)
instance System.Console.Haskeline.MonadException.MonadException m => System.Console.Haskeline.MonadException.MonadException (Control.Monad.Trans.State.Strict.StateT s m)
instance System.Console.Haskeline.MonadException.MonadException m => System.Console.Haskeline.MonadException.MonadException (Control.Monad.Trans.Maybe.MaybeT m)
instance (System.Console.Haskeline.MonadException.MonadException m, Control.Monad.Trans.Error.Error e) => System.Console.Haskeline.MonadException.MonadException (Control.Monad.Trans.Error.ErrorT e m)
instance System.Console.Haskeline.MonadException.MonadException m => System.Console.Haskeline.MonadException.MonadException (Control.Monad.Trans.List.ListT m)
instance (GHC.Base.Monoid w, System.Console.Haskeline.MonadException.MonadException m) => System.Console.Haskeline.MonadException.MonadException (Control.Monad.Trans.Writer.Lazy.WriterT w m)
instance (GHC.Base.Monoid w, System.Console.Haskeline.MonadException.MonadException m) => System.Console.Haskeline.MonadException.MonadException (Control.Monad.Trans.RWS.Lazy.RWST r w s m)

module System.Console.Haskeline.Completion

-- | Performs completions from the given line state.
gr
grThe first <a>String</a> argument is the contents of the line to the
grleft of the cursor, reversed. The second <a>String</a> argument is the
grcontents of the line to the right of the cursor.
gr
grThe output <a>String</a> is the unused portion of the left half of the
grline, reversed.
type CompletionFunc m = (String, String) -> m (String, [Completion])
data Completion
Completion :: String -> String -> Bool -> Completion

-- | Text to insert in line.
[replacement] :: Completion -> String

-- | Text to display when listing alternatives.
[display] :: Completion -> String

-- | Whether this word should be followed by a space, end quote, etc.
[isFinished] :: Completion -> Bool

-- | Disable completion altogether.
noCompletion :: Monad m => CompletionFunc m

-- | Create a finished completion out of the given word.
simpleCompletion :: String -> Completion

-- | A custom <a>CompletionFunc</a> which completes the word immediately to
grthe left of the cursor.
gr
grA word begins either at the start of the line or after an unescaped
grwhitespace character.
completeWord :: Monad m => Maybe Char -> [Char] -> (String -> m [Completion]) -> CompletionFunc m

-- | A custom <a>CompletionFunc</a> which completes the word immediately to
grthe left of the cursor, and takes into account the line contents to
grthe left of the word.
gr
grA word begins either at the start of the line or after an unescaped
grwhitespace character.
completeWordWithPrev :: Monad m => Maybe Char -> [Char] -> (String -> String -> m [Completion]) -> CompletionFunc m
completeQuotedWord :: Monad m => Maybe Char -> [Char] -> (String -> m [Completion]) -> CompletionFunc m -> CompletionFunc m
completeFilename :: MonadIO m => CompletionFunc m

-- | List all of the files or folders beginning with this path.
listFiles :: MonadIO m => FilePath -> m [Completion]
filenameWordBreakChars :: String
instance GHC.Show.Show System.Console.Haskeline.Completion.Completion
instance GHC.Classes.Ord System.Console.Haskeline.Completion.Completion
instance GHC.Classes.Eq System.Console.Haskeline.Completion.Completion


-- | This module provides a low-level API to the line history stored in the
gr<tt>InputT</tt> monad transformer.
gr
grFor most application, it should suffice to instead use the following
gr<tt>Settings</tt> flags:
gr
gr<ul>
gr<li><tt>autoAddHistory</tt>: add nonblank lines to the command history
gr(<a>True</a> by default).</li>
gr<li><tt>historyFile</tt>: read/write the history to a file before and
grafter the line input session.</li>
gr</ul>
gr
grIf you do want custom history behavior, you may need to disable the
grabove default setting(s).
module System.Console.Haskeline.History
data History
emptyHistory :: History
addHistory :: String -> History -> History

-- | Add a line to the history unless it matches the previously recorded
grline.
addHistoryUnlessConsecutiveDupe :: String -> History -> History

-- | Add a line to the history, and remove all previous entries which are
grthe same as it.
addHistoryRemovingAllDupes :: String -> History -> History

-- | The input lines stored in the history (newest first)
historyLines :: History -> [String]

-- | Reads the line input history from the given file. Returns
gr<a>emptyHistory</a> if the file does not exist or could not be read.
readHistory :: FilePath -> IO History

-- | Writes the line history to the given file. If there is an error when
grwriting the file, it will be ignored.
writeHistory :: FilePath -> History -> IO ()

-- | Limit the number of lines stored in the history.
stifleHistory :: Maybe Int -> History -> History

-- | The maximum number of lines stored in the history. If <a>Nothing</a>,
grthe history storage is unlimited.
stifleAmount :: History -> Maybe Int
instance GHC.Show.Show System.Console.Haskeline.History.History


-- | A rich user interface for line input in command-line programs.
grHaskeline is Unicode-aware and runs both on POSIX-compatible systems
grand on Windows.
gr
grUsers may customize the interface with a <tt>~/.haskeline</tt> file;
grsee <a>https://github.com/judah/haskeline/wiki/UserPreferences</a> for
grmore information.
gr
grAn example use of this library for a simple read-eval-print loop
gr(REPL) is the following:
gr
gr<pre>
grimport System.Console.Haskeline
gr
grmain :: IO ()
grmain = runInputT defaultSettings loop
gr   where
gr       loop :: InputT IO ()
gr       loop = do
gr           minput &lt;- getInputLine "% "
gr           case minput of
gr               Nothing -&gt; return ()
gr               Just "quit" -&gt; return ()
gr               Just input -&gt; do outputStrLn $ "Input was: " ++ input
gr                                loop
gr</pre>
module System.Console.Haskeline

-- | A monad transformer which carries all of the state and settings
grrelevant to a line-reading application.
data InputT m a

-- | Run a line-reading application. This function should suffice for most
grapplications.
gr
grThis function is equivalent to <tt><a>runInputTBehavior</a>
gr<a>defaultBehavior</a></tt>. It uses terminal-style interaction if
gr<a>stdin</a> is connected to a terminal and has echoing enabled.
grOtherwise (e.g., if <a>stdin</a> is a pipe), it uses file-style
grinteraction.
gr
grIf it uses terminal-style interaction, <a>Prefs</a> will be read from
grthe user's <tt>~/.haskeline</tt> file (if present). If it uses
grfile-style interaction, <a>Prefs</a> are not relevant and will not be
grread.
runInputT :: MonadException m => Settings m -> InputT m a -> m a

-- | Returns <a>True</a> if the current session uses terminal-style
grinteraction. (See <a>Behavior</a>.)
haveTerminalUI :: Monad m => InputT m Bool

-- | Map a user interaction by modifying the base monad computation.
mapInputT :: (forall b. m b -> m b) -> InputT m a -> InputT m a

-- | Haskeline has two ways of interacting with the user:
gr
gr<ul>
gr<li>"Terminal-style" interaction provides an rich user interface by
grconnecting to the user's terminal (which may be different than
gr<a>stdin</a> or <a>stdout</a>).</li>
gr<li>"File-style" interaction treats the input as a simple stream of
grcharacters, for example when reading from a file or pipe. Input
grfunctions (e.g., <tt>getInputLine</tt>) print the prompt to
gr<a>stdout</a>.</li>
gr</ul>
gr
grA <a>Behavior</a> is a method for deciding at run-time which type of
grinteraction to use.
gr
grFor most applications (e.g., a REPL), <a>defaultBehavior</a> should
grhave the correct effect.
data Behavior

-- | Run a line-reading application according to the given behavior.
gr
grIf it uses terminal-style interaction, <a>Prefs</a> will be read from
grthe user's <tt>~/.haskeline</tt> file (if present). If it uses
grfile-style interaction, <a>Prefs</a> are not relevant and will not be
grread.
runInputTBehavior :: MonadException m => Behavior -> Settings m -> InputT m a -> m a

-- | Read input from <a>stdin</a>. Use terminal-style interaction if
gr<a>stdin</a> is connected to a terminal and has echoing enabled.
grOtherwise (e.g., if <a>stdin</a> is a pipe), use file-style
grinteraction.
gr
grThis behavior should suffice for most applications.
defaultBehavior :: Behavior

-- | Use file-style interaction, reading input from the given
gr<a>Handle</a>.
useFileHandle :: Handle -> Behavior

-- | Use file-style interaction, reading input from the given file.
useFile :: FilePath -> Behavior

-- | Use terminal-style interaction whenever possible, even if <a>stdin</a>
grand/or <a>stdout</a> are not terminals.
gr
grIf it cannot open the user's terminal, use file-style interaction,
grreading input from <a>stdin</a>.
preferTerm :: Behavior

-- | Reads one line of input. The final newline (if any) is removed. When
grusing terminal-style interaction, this function provides a rich
grline-editing user interface.
gr
grIf <tt><a>autoAddHistory</a> == <a>True</a></tt> and the line input is
grnonblank (i.e., is not all spaces), it will be automatically added to
grthe history.
getInputLine :: MonadException m => String -> InputT m (Maybe String)

-- | Reads one line of input and fills the insertion space with initial
grtext. When using terminal-style interaction, this function provides a
grrich line-editing user interface with the added ability to give the
gruser default values.
gr
grThis function behaves in the exact same manner as <a>getInputLine</a>,
grexcept that it pre-populates the input area. The text that resides in
grthe input area is given as a 2-tuple with two <a>String</a>s. The
grstring on the left of the tuple (obtained by calling <a>fst</a>) is
grwhat will appear to the left of the cursor and the string on the right
gr(obtained by calling <a>snd</a>) is what will appear to the right of
grthe cursor.
gr
grSome examples of calling of this function are:
gr
gr<pre>
grgetInputLineWithInitial "prompt&gt; " ("left", "") -- The cursor starts at the end of the line.
grgetInputLineWithInitial "prompt&gt; " ("left ", "right") -- The cursor starts before the second word.
gr</pre>
getInputLineWithInitial :: MonadException m => String -> (String, String) -> InputT m (Maybe String)

-- | Reads one character of input. Ignores non-printable characters.
gr
grWhen using terminal-style interaction, the character will be read
grwithout waiting for a newline.
gr
grWhen using file-style interaction, a newline will be read if it is
grimmediately available after the input character.
getInputChar :: MonadException m => String -> InputT m (Maybe Char)

-- | Reads one line of input, without displaying the input while it is
grbeing typed. When using terminal-style interaction, the masking
grcharacter (if given) will replace each typed character.
gr
grWhen using file-style interaction, this function turns off echoing
grwhile reading the line of input.
gr
grNote that if Haskeline is built against a version of the
gr<tt>Win32</tt> library earlier than 2.5, <a>getPassword</a> will
grincorrectly echo back input on MinTTY consoles (such as Cygwin or
grMSYS).
getPassword :: MonadException m => Maybe Char -> String -> InputT m (Maybe String)

-- | Write a Unicode string to the user's standard output.
outputStr :: MonadIO m => String -> InputT m ()

-- | Write a string to the user's standard output, followed by a newline.
outputStrLn :: MonadIO m => String -> InputT m ()

-- | Return a printing function, which in terminal-style interactions is
grthread-safe and may be run concurrently with user input without
graffecting the prompt.
getExternalPrint :: MonadException m => InputT m (String -> IO ())

-- | Application-specific customizations to the user interface.
data Settings m
Settings :: CompletionFunc m -> Maybe FilePath -> Bool -> Settings m

-- | Custom tab completion.
[complete] :: Settings m -> CompletionFunc m

-- | Where to read/write the history at the start and end of each line
grinput session.
[historyFile] :: Settings m -> Maybe FilePath

-- | If <a>True</a>, each nonblank line returned by <tt>getInputLine</tt>
grwill be automatically added to the history.
[autoAddHistory] :: Settings m -> Bool

-- | A useful default. In particular:
gr
gr<pre>
grdefaultSettings = Settings {
gr          complete = completeFilename,
gr          historyFile = Nothing,
gr          autoAddHistory = True
gr          }
gr</pre>
defaultSettings :: MonadIO m => Settings m

-- | Because <a>complete</a> is the only field of <a>Settings</a> depending
gron <tt>m</tt>, the expression <tt>defaultSettings {completionFunc =
grf}</tt> leads to a type error from being too general. This function
grworks around that issue, and may become unnecessary if another field
grdepending on <tt>m</tt> is added.
setComplete :: CompletionFunc m -> Settings m -> Settings m

-- | <a>Prefs</a> allow the user to customize the terminal-style
grline-editing interface. They are read by default from
gr<tt>~/.haskeline</tt>; to override that behavior, use <a>readPrefs</a>
grand <tt>runInputTWithPrefs</tt>.
gr
grEach line of a <tt>.haskeline</tt> file defines one field of the
gr<a>Prefs</a> datatype; field names are case-insensitive and
grunparseable lines are ignored. For example:
gr
gr<pre>
greditMode: Vi
grcompletionType: MenuCompletion
grmaxhistorysize: Just 40
gr</pre>
data Prefs

-- | Read <a>Prefs</a> from a given file. If there is an error reading the
grfile, the <a>defaultPrefs</a> will be returned.
readPrefs :: FilePath -> IO Prefs

-- | The default preferences which may be overwritten in the
gr<tt>.haskeline</tt> file.
defaultPrefs :: Prefs

-- | Run a line-reading application. Uses <a>defaultBehavior</a> to
grdetermine the interaction behavior.
runInputTWithPrefs :: MonadException m => Prefs -> Settings m -> InputT m a -> m a

-- | Run a line-reading application.
runInputTBehaviorWithPrefs :: MonadException m => Behavior -> Prefs -> Settings m -> InputT m a -> m a

-- | Get the current line input history.
getHistory :: MonadIO m => InputT m History

-- | Set the line input history.
putHistory :: MonadIO m => History -> InputT m ()

-- | Change the current line input history.
modifyHistory :: MonadIO m => (History -> History) -> InputT m ()

-- | If Ctrl-C is pressed during the given action, throw an exception of
grtype <a>Interrupt</a>. For example:
gr
gr<pre>
grtryAction :: InputT IO ()
grtryAction = handle (\Interrupt -&gt; outputStrLn "Cancelled.")
gr               $ withInterrupt $ someLongAction
gr</pre>
gr
grThe action can handle the interrupt itself; a new <a>Interrupt</a>
grexception will be thrown every time Ctrl-C is pressed.
gr
gr<pre>
grtryAction :: InputT IO ()
grtryAction = withInterrupt loop
gr    where loop = handle (\Interrupt -&gt; outputStrLn "Cancelled; try again." &gt;&gt; loop)
gr                   someLongAction
gr</pre>
gr
grThis behavior differs from GHC's built-in Ctrl-C handling, which may
grimmediately terminate the program after the second time that the user
grpresses Ctrl-C.
withInterrupt :: MonadException m => InputT m a -> InputT m a
data Interrupt
Interrupt :: Interrupt

-- | Catch and handle an exception of type <a>Interrupt</a>.
gr
gr<pre>
grhandleInterrupt f = handle $ \Interrupt -&gt; f
gr</pre>
handleInterrupt :: MonadException m => m a -> m a -> m a


-- | This module provides a stateful, IO-based interface to Haskeline,
grwhich may be easier to integrate into some existing programs or
grlibraries.
gr
grIt is strongly recommended to use the safer, monadic API of
gr<a>System.Console.Haskeline</a>, if possible, rather than the explicit
grstate management functions of this module.
gr
grThe equivalent REPL example is:
gr
gr<pre>
grimport System.Console.Haskeline
grimport System.Console.Haskeline.IO
grimport Control.Concurrent
gr
grmain = bracketOnError (initializeInput defaultSettings)
gr            cancelInput -- This will only be called if an exception such
gr                            -- as a SigINT is received.
gr            (\hd -&gt; loop hd &gt;&gt; closeInput hd)
gr    where
gr        loop :: InputState -&gt; IO ()
gr        loop hd = do
gr            minput &lt;- queryInput hd (getInputLine "% ")
gr            case minput of
gr                Nothing -&gt; return ()
gr                Just "quit" -&gt; return ()
gr                Just input -&gt; do queryInput hd $ outputStrLn
gr                                    $ "Input was: " ++ input
gr                                 loop hd
gr</pre>
module System.Console.Haskeline.IO
data InputState

-- | Initialize a session of line-oriented user interaction.
initializeInput :: Settings IO -> IO InputState

-- | Finish and clean up the line-oriented user interaction session. Blocks
gron an existing call to <a>queryInput</a>.
closeInput :: InputState -> IO ()

-- | Cancel and clean up the user interaction session. Does not block on an
grexisting call to <a>queryInput</a>.
cancelInput :: InputState -> IO ()

-- | Run one action (for example, <a>getInputLine</a>) as part of a session
grof user interaction.
gr
grFor example, multiple calls to <a>queryInput</a> using the same
gr<a>InputState</a> will share the same input history. In constrast,
grmultiple calls to <a>runInputT</a> will use distinct histories unless
grthey share the same history file.
gr
grThis function should not be called on a closed or cancelled
gr<a>InputState</a>.
queryInput :: InputState -> InputT IO a -> IO a
