Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Re-export display-related functions and types to simplify external use.
Symbol
data Decoration Source #
Decorations on symbols/characters such as hats or Vector representations (determines bolding, italics, etc).
Hat | Places a |
Vector | Makes a symbol bold. |
Prime | Appends a |
Delta | Prepends a |
Magnitude | Places |
Instances
Eq Decoration Source # | |
Defined in Language.Drasil.Symbol (==) :: Decoration -> Decoration -> Bool # (/=) :: Decoration -> Decoration -> Bool # | |
Ord Decoration Source # | |
Defined in Language.Drasil.Symbol compare :: Decoration -> Decoration -> Ordering # (<) :: Decoration -> Decoration -> Bool # (<=) :: Decoration -> Decoration -> Bool # (>) :: Decoration -> Decoration -> Bool # (>=) :: Decoration -> Decoration -> Bool # max :: Decoration -> Decoration -> Decoration # min :: Decoration -> Decoration -> Decoration # |
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:
(string such as "x" that represent a value that can vary)Variable
(strings such as "max" or "target" that represent a single idea)Label
characters (ex. unicode)Symbol
Decorated
symbols usingAtop
Concatenations
of symbols, including subscripts and superscripts
! (this is to give this a monoid-like flavour)Empty
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, |
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 |
Atop Decoration Symbol | Used to decorate symbols. For things like vectors (which need to be bold),
primes, magnitudes, etc. See |
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: |
Empty | Placeholder for when a symbol is not needed. |
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.