HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleecho-0.1.4Haskell2010

System.IO.Echo.Internal

Exports functions that handle whether or not terminal input is handled in a way that should be portable across different platforms and consoles.

Unlike System.IO.Echo, this module exports internal functionality which, if used improperly, can lead to runtime errors. Make sure to read the documentation beforehand!

  • 2 types
  • 12 values
  • Packageecho-0.1.4
  • Exports14
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceInternal.hs

Safe public interface

6 declarations
valueechoOff :: EchoState
#

Indicates that the terminal's input echoing is (or should be) off.

valueechoOn :: EchoState
#

Indicates that the terminal's input echoing is (or should be) on.

Alternative (safe) interface

2 declarations
valuegetInputEcho :: IO Bool
#

Return whether the terminal's echoing is on (True) or off (False).

Note that while this works on MinTTY, it is not as efficient as getInputEchoState, as it involves a somewhat expensive substring computation.

Unsafe STTY internals

5 declarations
datadata EchoState
#

A representation of the terminal input's current echoing state. Example values include echoOff and echoOn.

Constructors

  • MinTTY STTYSettings

    The argument to (or value returned from) an invocation of the stty command-line utility. Most POSIX-like shells have stty, including MinTTY on Windows. Since neither hGetEcho nor hSetEcho work on MinTTY, when getInputEchoState runs on MinTTY, it returns a value built with this constructor.

    However, native Windows consoles like cmd.exe or PowerShell do not have stty, so if you construct an EchoState with this constructor manually, take care not to use it with a native Windows console.

  • DefaultTTY Bool

    A simple on (True) or off (False) toggle. This is returned by hGetEcho and given as an argument to hSetEcho, which work on most consoles, with the notable exception of MinTTY on Windows. If you construct an EchoState with this constructor manually, take care not to use it with MinTTY.

Instances3Eq, Ord, Show
  • Eq EchoStateDefined in echo-0.1.4 · System.IO.Echo.Internal
  • Ord EchoStateDefined in echo-0.1.4 · System.IO.Echo.Internal
  • Show EchoStateDefined in echo-0.1.4 · System.IO.Echo.Internal
valuesetInputEchoSTTY :: STTYSettings -> IO ()
#

Create an stty process and wait for it to complete. This is useful for changing stty's settings, after which stty does not output anything.

setInputEchoSTTY = void . sttyRaw

MinTTY

1 declaration
valueminTTY :: Bool
#

Is the current process attached to a MinTTY console (e.g., Cygwin or MSYS)?