drasil-lang-0.1.60.0: A framework for code and document generation for scientific software - Language SubPackage
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Drasil.Sentence

Description

Contains Sentences and helpers functions.

Synopsis

Types

Sentence

data Sentence where Source #

For writing Sentences via combining smaller elements. Sentences are made up of some known vocabulary of things:

  • units (their visual representation)
  • words (via Strings)
  • special characters
  • accented letters
  • references to specific layout objects

Constructors

Ch :: SentenceStyle -> TermCapitalization -> UID -> Sentence

Ch looks up the term for a given UID and displays the term with a given SentenceStyle and CapitalizationRule. This allows Sentences to hold plural forms of NounPhrases and NamedIdeas.

SyCh :: UID -> Sentence

A branch of Ch dedicated to SymbolStyle only.

Sy :: USymb -> Sentence

Converts a unit symbol into a usable Sentence form.

S :: String -> Sentence

Constructor for Strings, used often for descriptions in Chunks.

P :: Symbol -> Sentence

Converts the graphical representation of a symbol into a usable Sentence form.

E :: ModelExpr -> Sentence

Lifts an expression into a Sentence.

Ref :: UID -> Sentence -> RefInfo -> Sentence

Takes a UID to a reference, a display name (Sentence), and any additional reference display information (RefInfo). Resolves the reference later (similar to Ch).

Quote :: Sentence -> Sentence

Adds quotation marks around a Sentence.

Percent :: Sentence

Used for a % symbol.

(:+:) :: Sentence -> Sentence -> Sentence infixr 5

Direct concatenation of two Sentences (no implicit spaces!).

EmptyS :: Sentence

Empty Sentence.

Instances

Instances details
Monoid Sentence Source #

Sentences can be empty or directly concatenated.

Instance details

Defined in Language.Drasil.Sentence

Semigroup Sentence Source #

Sentences can be concatenated.

Instance details

Defined in Language.Drasil.Sentence

Context Types

data SentenceStyle Source #

Used in Ch constructor to determine the state of a term (can record whether something is in plural form, a singular term, or in short form).

data RefInfo Source #

Holds any extra information needed for a Reference, be it an equation, pages, a note, or nothing.

Constructors

None 
Equation [Int] 
Page [Int] 
RefNote String 

data TermCapitalization Source #

Used in Ch constructor to determine the capitalization of a term. CapF is for capitalizing the first word from the UID of the given term. CapW is for capitalizing all words from the UID of the given term. Mirrors CapFirst and CapWords from CapitalizationRule.

Constructors

CapF 
CapW 
NoCap 

Functions

(+:+) :: Sentence -> Sentence -> Sentence Source #

Helper for concatenating two Sentences with a space between them.

(+:+.) :: Sentence -> Sentence -> Sentence Source #

Helper which concatenates two Sentences using +:+ and appends a period.

(+:) :: Sentence -> Sentence -> Sentence Source #

Helper which concatenates two sentences using +:+ and appends a colon.

(!.) :: Sentence -> Sentence Source #

Helper which appends a period to the end of a Sentence (used often as a post-fix operator).

capSent :: Sentence -> Sentence Source #

Capitalizes a Sentence.

headSent :: Int -> Sentence -> Sentence Source #

Helper which creates a Header with size s of the Sentence.

ch :: (HasUID c, HasSymbol c) => c -> Sentence Source #

Gets a symbol and places it in a Sentence.

eS' :: Express t => t -> Sentence Source #

sC :: Sentence -> Sentence -> Sentence Source #

Helper for concatenating two Sentences with a comma and space between them.

sDash :: Sentence -> Sentence -> Sentence Source #

Helper for concatenating two Sentences with a space-surrounded dash between them.

sParen :: Sentence -> Sentence Source #

Helper for wrapping Sentences in parentheses.

sentencePlural :: UID -> Sentence Source #

Gets plural term of UID.

Smart constructors for turning a UID into a Sentence.

sentenceShort :: UID -> Sentence Source #

Gets short form of UID.

Smart constructors for turning a UID into a Sentence.

sentenceSymb :: UID -> Sentence Source #

Gets symbol form of UID.

Smart constructors for turning a UID into a Sentence.

sentenceTerm :: UID -> Sentence Source #

Gets singular form of UID.

Smart constructors for turning a UID into a Sentence.