Terminal objects are automatically freed by the garbage collector.
Hence, there is no equivalent of del_curterm here.
Moduleterminfo-0.4.1.7Haskell2010
System.Console.Terminfo.Base
This module provides a low-level interface to the C functions of the terminfo library.
NOTE: Since this library is built on top of the curses interface, it is not thread-safe.
- 5 types
- 3 classes
- 13 values
- Packageterminfo-0.4.1.7
- Exports21
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceBase.hs
Initialization
4 declarationsInitialize the terminfo library to the given terminal entry.
Throws a SetupTermError if the terminfo database could not be read.
Note:*
ncursesis not thread-safe; initializing or using multiple Terminals in different threads at the same time can result in memory unsafety.
Initialize the terminfo library, using the TERM environmental variable.
If TERM is not set, we use the generic, minimal entry dumb.
Throws a SetupTermError if the terminfo database could not be read.
Instances2Show, Exception
Show SetupTermErrorDefined in terminfo-0.4.1.7 · System.Console.Terminfo.BaseException SetupTermErrorDefined in terminfo-0.4.1.7 · System.Console.Terminfo.Base
Capabilities
6 declarationsA feature or operation which a Terminal may define.
Instances5Monad, Functor, Applicative, Alternative, MonadPlus
Monad CapabilityDefined in terminfo-0.4.1.7 · System.Console.Terminfo.BaseFunctor CapabilityDefined in terminfo-0.4.1.7 · System.Console.Terminfo.BaseApplicative CapabilityDefined in terminfo-0.4.1.7 · System.Console.Terminfo.BaseAlternative CapabilityDefined in terminfo-0.4.1.7 · System.Console.Terminfo.BaseMonadPlus CapabilityDefined in terminfo-0.4.1.7 · System.Console.Terminfo.Base
Look up a boolean capability in the terminfo database.
Unlike tiGuardFlag, this capability never fails; it returns False if the capability is absent or set to false, and returns True otherwise.
Look up a boolean capability in the terminfo database, and fail if it's not defined.
Look up a numeric capability in the terminfo database.
Deprecated. use tiGetOutput instead.
Look up a string capability in the terminfo database. NOTE: This function is deprecated; use tiGetOutput1 instead.
Output
3 declarationsTerminfo contains many string capabilities for special effects.
For example, the cuu1 capability moves the cursor up one line; on ANSI terminals
this is accomplished by printing the control sequence "\ESC[A".
However, some older terminals also require "padding", or short pauses, after certain commands.
For example, when TERM=vt100 the cuu1 capability is "\ESC[A$<2>", which instructs terminfo
to pause for two milliseconds after outputting the control sequence.
The TermOutput monoid abstracts away all padding and control sequence output. Unfortunately, that datatype is difficult to integrate into existing String-based APIs such as pretty-printers. Thus, as a workaround, tiGetOutput1 also lets us access the control sequences as Strings. The one caveat is that it will not allow you to access padded control sequences as Strings. For example:
> t <- setupTerm "vt100"
> isJust (getCapability t (tiGetOutput1 "cuu1") :: Maybe String)
False
> isJust (getCapability t (tiGetOutput1 "cuu1") :: Maybe TermOutput)
TrueString capabilities will work with software-based terminal types such as xterm and linux.
However, you should use TermOutput if compatibility with older terminals is important.
Additionally, the visualBell capability which flashes the screen usually produces its effect with a padding directive, so it will only work with TermOutput.
Look up an output capability which takes a fixed number of parameters
(for example, Int -> Int -> TermOutput).
For capabilities which may contain variable-length padding, use tiGetOutput instead.
Instances2TermStr
TermStr TermOutputDefined in terminfo-0.4.1.7 · System.Console.Terminfo.BaseTermStr [Char]Defined in terminfo-0.4.1.7 · System.Console.Terminfo.Base
TermOutput
An action which sends output to the terminal. That output may mix plain text with control characters and escape sequences, along with delays (called "padding") required by some older terminals.
Instances4Semigroup, Monoid, OutputCap, TermStr
Semigroup TermOutputDefined in terminfo-0.4.1.7 · System.Console.Terminfo.BaseMonoid TermOutputDefined in terminfo-0.4.1.7 · System.Console.Terminfo.BaseOutputCap TermOutputDefined in terminfo-0.4.1.7 · System.Console.Terminfo.BaseTermStr TermOutputDefined in terminfo-0.4.1.7 · System.Console.Terminfo.Base
Write the terminal output to the standard output device.
Write the terminal output to the terminal or file managed by the given Handle.
Look up an output capability in the terminfo database.
A parameter to specify the number of lines affected. Some capabilities
(e.g., clear and dch1) use
this parameter on some terminals to compute variable-length padding.
Monoid functions
The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following:
- Right identity
- Left identity
- Associativity
(
law)
- Concatenation
You can alternatively define mconcat instead of mempty, in which case the laws are:
- Unit
- Multiplication
- Subclass
The method names refer to the monoid of lists under concatenation, but there are many other instances.
Some types can be viewed as a monoid in more than one way,
e.g. both addition and multiplication on numbers.
In such cases we often define newtypes and make those instances
of Monoid, e.g. Data.Semigroup.Sum and Data.Semigroup.Product.
NOTE: Semigroup is a superclass of Monoid since base-4.11.0.0.
Methods
mempty :: aIdentity of mappend
Examples
Example1 expression "Hello world" <> mempty"Hello world"
Example1 expression mempty <> [1, 2, 3][1,2,3]
mappend :: a -> a -> aAn associative operation
NOTE: This method is redundant and has the default implementation
mappend = (<>)since base-4.11.0.0. Should it be implemented manually, since mappend is a synonym for (<>), it is expected that the two functions are defined the same way. In a future GHC release mappend will be removed from Monoid.mconcat :: [a] -> aFold a list using the monoid.
For most types, the default definition for mconcat will be used, but the function is included in the class definition so that an optimized version can be provided for specific types.
Example1 expression mconcat ["Hello", " ", "Haskell", "!"]"Hello Haskell!"
Instances56Monoid, …
Monoid ByteArrayDefined in base-4.20.2.0 · Data.Array.ByteMonoid AllDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalMonoid AnyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalMonoid EventDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.TypesMonoid EventLifetimeDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.TypesMonoid LifetimeDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.Typesmappendtakes the longer of two lifetimes.Monoid ExceptionContextDefined in ghc-internal-9.1003.0 · GHC.Internal.Exception.ContextMonoid OrderingDefined in ghc-internal-9.1003.0 · GHC.Internal.BaseMonoid TermOutputDefined in terminfo-0.4.1.7 · System.Console.Terminfo.BaseMonoid ()Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseMonoid (Comparison a)Defined in base-4.20.2.0 · Data.Functor.ContravariantMonoid (Equivalence a)Defined in base-4.20.2.0 · Data.Functor.ContravariantMonoid (Predicate a)Defined in base-4.20.2.0 · Data.Functor.ContravariantMonoid (First a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidMonoid (Last a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidMonoid (Endo a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalMonoid [a]Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseMonoid a => Monoid (STM a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Conc.SyncMonoid a => Monoid (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityMonoid a => Monoid (Down a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.OrdMonoid a => Monoid (Dual a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalMonoid a => Monoid (IO a)Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseMonoid a => Monoid (a)Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseMonoid m => Monoid (WrappedMonoid m)Defined in base-4.20.2.0 · Data.SemigroupMonoid p => Monoid (Par1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsSemigroup a => Monoid (Maybe a)Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseLift a semigroup into Maybe forming a Monoid according to http://en.wikipedia.org/wiki/Monoid: "Any semigroup
Smay be turned into a monoid simply by adjoining an elementenot inSand defininge*e = eande*s = s = s*efor alls ∈ S."Since 4.11.0: constraint on inner
avalue generalised from Monoid to Semigroup.Bits a => Monoid (Ior a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsBits a => Monoid (Xor a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsFiniteBits a => Monoid (And a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsThis constraint is arguably too strong. However, as some types (such as
Natural) have undefined complement, this is the only safe choice.FiniteBits a => Monoid (Iff a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsThis constraint is arguably too strong. However, as some types (such as
Natural) have undefined complement, this is the only safe choice.Num a => Monoid (Product a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalNum a => Monoid (Sum a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalOrd a => Monoid (Max a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.UtilsOrd a => Monoid (Min a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.Utils(Generic a, Monoid (Rep a ())) => Monoid (Generically a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics(Ord a, Bounded a) => Monoid (Max a)Defined in base-4.20.2.0 · Data.Semigroup(Ord a, Bounded a) => Monoid (Min a)Defined in base-4.20.2.0 · Data.SemigroupMonoid (Proxy s)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.ProxyMonoid (U1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsMonoid a => Monoid (Op a b)Defined in base-4.20.2.0 · Data.Functor.Contravariantmempty @(Op a b)without newtypes ismempty @(b->a)=_ -> mempty.mempty :: Op a b mempty = Op _ -> memptyMonoid a => Monoid (ST s a)Defined in ghc-internal-9.1003.0 · GHC.Internal.STMonoid b => Monoid (a -> b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Base(Monoid a, Monoid b) => Monoid (a, b)Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseAlternative f => Monoid (Alt f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalMonoid (f p) => Monoid (Rec1 f p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsMonoid a => Monoid (Const a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.Const(Applicative f, Monoid a) => Monoid (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Monoid(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c)Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseMonoid c => Monoid (K1 i c p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics(Monoid (f a), Monoid (g a)) => Monoid (Product f g a)Defined in base-4.20.2.0 · Data.Functor.Product(Monoid (f p), Monoid (g p)) => Monoid ((:*:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics(Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d)Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseMonoid (f (g a)) => Monoid (Compose f g a)Defined in base-4.20.2.0 · Data.Functor.ComposeMonoid (f (g p)) => Monoid ((:.:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsMonoid (f p) => Monoid (M1 i c f p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics(Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e)Defined in ghc-internal-9.1003.0 · GHC.Internal.Base
An operator version of mappend.