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

Language.Drasil.Display

Contents

Description

Re-export display-related functions and types to simplify external use.

Synopsis

Symbol

data Decoration Source #

Decorations on symbols/characters such as hats or Vector representations (determines bolding, italics, etc).

Constructors

Hat

Places a ^ on top of a symbol.

Vector

Makes a symbol bold.

Prime

Appends a ' to a symbol.

Delta

Prepends a Δ to a symbol.

Magnitude

Places || before and after a symbol.

data Symbol Source #

A Symbol is actually going to be a graphical description of what gets rendered as a (unique) symbol. This is actually NOT based on semantics at all, but just a description of how things look.

Symbols can be:

  • Variable (string such as "x" that represent a value that can vary)
  • Label (strings such as "max" or "target" that represent a single idea)
  • Symbol characters (ex. unicode)
  • Decorated symbols using Atop
  • Concatenations of symbols, including subscripts and superscripts
  • Empty! (this is to give this a monoid-like flavour)

Constructors

Variable String

Basic variable name creation.

Label String

For when symbols need more context, but we don't want to add a new variable name. For example, v_f may be encoded as Concat [variable "v", label "f"].

Integ Int

For using numbers in Symbols.

Special Special

For now, special characters are the degree and partial differentiation symbols. These should eventually move elsewhere and the Symbol type removed.

Atop Decoration Symbol

Used to decorate symbols. For things like vectors (which need to be bold), primes, magnitudes, etc. See Decoration for more details.

Corners [Symbol] [Symbol] [Symbol] [Symbol] Symbol

Order of Symbols: upleft lowleft upright lowright base. Ex:

Corners [1]   [2]   [3]   [4]   [5]
 Visually:  [1]   [3]

               [5]

            [2]   [4]
Concat [Symbol]

Concatentation of two symbols: [s1, s2] -> s1s2

Empty

Placeholder for when a symbol is not needed.

Instances

Instances details
Monoid Symbol Source #

Symbols can be empty or concatenated.

Instance details

Defined in Language.Drasil.Symbol

Semigroup Symbol Source #

Symbols may be concatenated.

Instance details

Defined in Language.Drasil.Symbol

Eq Symbol Source # 
Instance details

Defined in Language.Drasil.Symbol

Methods

(==) :: Symbol -> Symbol -> Bool #

(/=) :: Symbol -> Symbol -> Bool #

compsy :: Symbol -> Symbol -> Ordering Source #

The default compare function that sorts all the lower case symbols after the upper case ones.

Comparation is used twice for each Atomic case, once for making sure they are the same letter, once for case sensitive. As far as this comparison is considered, Δ is a "decoration" and ignored unless the compared symbols are the exact same, in which case it is ordered after the undecorated symbol.

Superscripts and subscripts are ordered after the base symbols (because they add additional context to a symbol). For example: `v_f^{AB}` (expressed in LaTeX notation for clarity), where v_f is a final velocity, and the `^{AB}` adds context that it is the final velocity between points A and B. In these cases, the sorting of `v_f^{AB}` should be following v_f as it is logical to place it with its parent concept.