HaTeX-3.16.2.0: The Haskell LaTeX library.

Safe HaskellNone
LanguageHaskell2010

Text.LaTeX.Base

Contents

Description

This module exports those minimal things you need to work with HaTeX. Those things are:

Synopsis

LaTeX datatype

data LaTeX Source

Type of LaTeX blocks.

Instances

Eq LaTeX Source 
Show LaTeX Source 
IsString LaTeX Source

Method fromString escapes LaTeX reserved characters using protectString.

Arbitrary LaTeX Source 
Monoid LaTeX Source

Method mappend is strict in both arguments (except in the case when the first argument is TeXEmpty).

LaTeXC LaTeX Source

This instance just sets liftListL = id.

Render LaTeX Source 
Texy LaTeX Source 

Escaping reserved characters

protectString :: String -> String Source

Escape LaTeX reserved characters in a String.

protectText :: Text -> Text Source

Escape LaTeX reserved characters in a Text.

Internal re-exports

Monoids

Since the Monoid instance is the only way to append LaTeX values, a re-export of the Monoid class is given here for convenience.

class Monoid a where

The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following laws:

  • mappend mempty x = x
  • mappend x mempty = x
  • mappend x (mappend y z) = mappend (mappend x y) z
  • mconcat = foldr mappend mempty

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. Sum and Product.

Minimal complete definition

mempty, mappend

Methods

mempty :: a

Identity of mappend

mappend :: a -> a -> a

An associative operation

mconcat :: [a] -> a

Fold 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.

Instances

Monoid Ordering 
Monoid () 
Monoid All 
Monoid Any 
Monoid ByteString 
Monoid ByteString 
Monoid Builder 
Monoid IntSet 
Monoid Doc 
Monoid LaTeX

Method mappend is strict in both arguments (except in the case when the first argument is TeXEmpty).

Monoid TeXCheck 
Monoid [a] 
Ord a => Monoid (Max a) 
Ord a => Monoid (Min a) 
Monoid a => Monoid (Dual a) 
Monoid (Endo a) 
Num a => Monoid (Sum a) 
Num a => Monoid (Product a) 
Monoid (First a) 
Monoid (Last a) 
Monoid a => Monoid (Maybe a)

Lift a semigroup into Maybe forming a Monoid according to http://en.wikipedia.org/wiki/Monoid: "Any semigroup S may be turned into a monoid simply by adjoining an element e not in S and defining e*e = e and e*s = s = s*e for all s ∈ S." Since there is no "Semigroup" typeclass providing just mappend, we use Monoid instead.

Monoid (IntMap a) 
Ord a => Monoid (Set a) 
Monoid (Seq a) 
Monoid (Vector a) 
(Ord a, Bounded a) => Monoid (Min a) 
(Ord a, Bounded a) => Monoid (Max a) 
Monoid m => Monoid (WrappedMonoid m) 
Semigroup a => Monoid (Option a) 
(Hashable a, Eq a) => Monoid (HashSet a) 
Monoid (Doc e) 
Monoid b => Monoid (a -> b) 
(Monoid a, Monoid b) => Monoid (a, b) 
Monoid a => Monoid (Const a b) 
Monoid (Proxy k s) 
Ord k => Monoid (Map k v) 
(Eq k, Hashable k) => Monoid (HashMap k v) 
(Monad m, (~) * a ()) => Monoid (LaTeXT m a) 
(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) 
Alternative f => Monoid (Alt * f a) 
Monoid a => Monoid (Tagged k s a) 
(Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d) 
(Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e) 

(<>) :: Monoid m => m -> m -> m infixr 6

An infix synonym for mappend.

Since: 4.5.0.0