drasil-printers-0.1.10.0: A framework for code and document generation for scientific software - Printers SubPackage
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Drasil.TeX.Monad

Description

Printing Monad. Starts with a specific data type (reader monad) and extends from there.

Synopsis

Printing Monad

data MathContext Source #

There are two proper contexts, Text and Math; Curr is the current context. There are multiple ways of getting there: for Text, either being at the top-level or inside text. For Math, either surrounded by $ or in begin{equation} .. end{equation}. Curr is when the current context is fine.

Constructors

Text 
Math 
Curr 

Instances

Instances details
Eq MathContext Source # 
Instance details

Defined in Language.Drasil.TeX.Monad

newtype PrintLaTeX a Source #

A monad for printing in LaTeX.

Constructors

PL 

Fields

Instances

Instances details
Applicative PrintLaTeX Source #

This printing monad is also applicative.

Instance details

Defined in Language.Drasil.TeX.Monad

Methods

pure :: a -> PrintLaTeX a #

(<*>) :: PrintLaTeX (a -> b) -> PrintLaTeX a -> PrintLaTeX b #

liftA2 :: (a -> b -> c) -> PrintLaTeX a -> PrintLaTeX b -> PrintLaTeX c #

(*>) :: PrintLaTeX a -> PrintLaTeX b -> PrintLaTeX b #

(<*) :: PrintLaTeX a -> PrintLaTeX b -> PrintLaTeX a #

Functor PrintLaTeX Source #

Defines the printing monad as a functor.

Instance details

Defined in Language.Drasil.TeX.Monad

Methods

fmap :: (a -> b) -> PrintLaTeX a -> PrintLaTeX b #

(<$) :: a -> PrintLaTeX b -> PrintLaTeX a #

Monad PrintLaTeX Source #

Define the printing monad.

Instance details

Defined in Language.Drasil.TeX.Monad

Methods

(>>=) :: PrintLaTeX a -> (a -> PrintLaTeX b) -> PrintLaTeX b #

(>>) :: PrintLaTeX a -> PrintLaTeX b -> PrintLaTeX b #

return :: a -> PrintLaTeX a #

Monoid (PrintLaTeX Doc) Source #

D is a monoid.

Instance details

Defined in Language.Drasil.TeX.Monad

Semigroup (PrintLaTeX Doc) Source #

D is a member of Semigroup.

Instance details

Defined in Language.Drasil.TeX.Monad

type D = PrintLaTeX Doc Source #

Convenient abbreviation.

switch :: (MathContext -> MathContext) -> D -> D Source #

MonadReader calls this local. Can switch contexts (including no-switch cases). Adjust printing as necessary.

toMath :: D -> D Source #

Change context to Math.

toText :: D -> D Source #

Change context to Text.

getCtx :: PrintLaTeX MathContext Source #

MonadReader calls this ask.

(%%) :: D -> D -> D infixl 5 Source #

Since Text.PrettyPrint steals <>, use %% instead for $$.

($+$) :: D -> D -> D infixr 6 Source #

Lifts Text.PrettyPrint's $+$. Above, with no overlapping. Associative.

tpRunPrint :: ([Doc] -> Doc) -> [D] -> D Source #

Concatenates a list of D using a function from [Doc] -> Doc.

vcat :: [D] -> D Source #

List version of $$. Above, except that if the last line of the first argument stops at least one position before the first line of the second begins, these two lines are overlapped.

vpunctuate :: Doc -> [D] -> D Source #

hpunctuate :: Doc -> [D] -> D Source #

lub :: MathContext -> MathContext -> MathContext Source #

MathContext operations.

newtype Latex Source #

Latex type. Holds Spaces.

Constructors

L 

Fields

Instances

Instances details
RenderSpecial Latex Source #

Renders special characters.

Instance details

Defined in Language.Drasil.TeX.Monad

Methods

special :: Special -> Latex #