drasil-lang-0.1.60.0: A framework for code and document generation for scientific software - Language SubPackage
Safe HaskellNone
LanguageGHC2024

Language.Drasil

Description

The Drasil language, including expressions, chunks, sentences, references, classes, datatypes, and generally useful functions. Re-exports modules to simplify external use.

Synopsis

The Drasil Expression Language

Encodes mathematical and display related expressions.

Base Expression Language

Defines the expression types and common operators.

data Expr Source #

Expression language where all terms are supposed to be 'well understood' (i.e., have a definite meaning). Right now, this coincides with "having a definite value", but should not be restricted to that.

Instances

Instances details
CanGenCode Expr Source # 
Instance details

Defined in Drasil.Code.CodeExpr.Convert

ExprC Expr Source # 
Instance details

Defined in Language.Drasil.Expr.Class

Methods

lit :: Literal -> Expr Source #

($=) :: Expr -> Expr -> Expr Source #

($!=) :: Expr -> Expr -> Expr Source #

($<) :: Expr -> Expr -> Expr Source #

($>) :: Expr -> Expr -> Expr Source #

($<=) :: Expr -> Expr -> Expr Source #

($>=) :: Expr -> Expr -> Expr Source #

($.) :: Expr -> Expr -> Expr Source #

($+) :: Expr -> Expr -> Expr Source #

($*) :: Expr -> Expr -> Expr Source #

($-) :: Expr -> Expr -> Expr Source #

($/) :: Expr -> Expr -> Expr Source #

($^) :: Expr -> Expr -> Expr Source #

($&&) :: Expr -> Expr -> Expr Source #

($||) :: Expr -> Expr -> Expr Source #

in' :: Expr -> Expr -> Expr Source #

abs_ :: Expr -> Expr Source #

neg :: Expr -> Expr Source #

log :: Expr -> Expr Source #

ln :: Expr -> Expr Source #

sqrt :: Expr -> Expr Source #

sin :: Expr -> Expr Source #

cos :: Expr -> Expr Source #

tan :: Expr -> Expr Source #

sec :: Expr -> Expr Source #

csc :: Expr -> Expr Source #

cot :: Expr -> Expr Source #

arcsin :: Expr -> Expr Source #

arccos :: Expr -> Expr Source #

arctan :: Expr -> Expr Source #

exp :: Expr -> Expr Source #

dim :: Expr -> Expr Source #

norm :: Expr -> Expr Source #

negVec :: Expr -> Expr Source #

not_ :: Expr -> Expr Source #

idx :: Expr -> Expr -> Expr Source #

idxOf :: Expr -> Expr -> Expr Source #

defint :: Symbol -> Expr -> Expr -> Expr -> Expr Source #

defsum :: Symbol -> Expr -> Expr -> Expr -> Expr Source #

defprod :: Symbol -> Expr -> Expr -> Expr -> Expr Source #

realInterval :: IsChunk c => c -> RealInterval Expr Expr -> Expr Source #

euclidean :: [Expr] -> Expr Source #

cross :: Expr -> Expr -> Expr Source #

vScale :: Expr -> Expr -> Expr Source #

vAdd :: Expr -> Expr -> Expr Source #

vSub :: Expr -> Expr -> Expr Source #

completeCase :: [(Expr, Expr)] -> Expr Source #

incompleteCase :: [(Expr, Expr)] -> Expr Source #

matrix :: [[Expr]] -> Expr Source #

set' :: Space -> [Expr] -> Expr Source #

apply :: (IsChunk f, HasSymbol f) => f -> [Expr] -> Expr Source #

sy :: (IsChunk c, HasSymbol c) => c -> Expr Source #

Express Expr Source #

Rewriting Exprs using the ModelExpr language.

Instance details

Defined in Language.Drasil.ExprClasses

LiteralC Expr Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

Eq Expr Source #

Expressions are equal if their constructors and contents are equal.

TODO: This needs to add more equality checks

Instance details

Defined in Language.Drasil.Expr.Lang

Methods

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

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

Typed Expr Space Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

RequiresChecking (QDefinition Expr) Expr Space Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

class ExprC r where Source #

Methods

lit :: Literal -> r Source #

($=) :: r -> r -> r infixr 4 Source #

($!=) :: r -> r -> r Source #

($<) :: r -> r -> r Source #

Smart constructor for ordering two equations.

($>) :: r -> r -> r Source #

Smart constructor for ordering two equations.

($<=) :: r -> r -> r Source #

Smart constructor for ordering two equations.

($>=) :: r -> r -> r Source #

Smart constructor for ordering two equations.

($.) :: r -> r -> r Source #

Smart constructor for the dot product of two equations.

($+) :: r -> r -> r Source #

Add two expressions.

($*) :: r -> r -> r Source #

Multiply two expressions.

($-) :: r -> r -> r Source #

($/) :: r -> r -> r infixl 7 Source #

($^) :: r -> r -> r infixr 8 Source #

($&&) :: r -> r -> r infixr 9 Source #

($||) :: r -> r -> r infixr 9 Source #

in' :: r -> r -> r Source #

Smart constructor for set-theoretic membership relation. Added ' to avoid conflict.

abs_ :: r -> r Source #

Smart constructor for taking the absolute value of an expression.

neg :: r -> r Source #

Smart constructor for negating an expression.

log :: r -> r Source #

Smart constructor to take the log of an expression.

ln :: r -> r Source #

Smart constructor to take the ln of an expression.

sqrt :: r -> r Source #

Smart constructor to take the square root of an expression.

sin :: r -> r Source #

Smart constructor to apply sin to an expression.

cos :: r -> r Source #

Smart constructor to apply cos to an expression.

tan :: r -> r Source #

Smart constructor to apply tan to an expression.

sec :: r -> r Source #

Smart constructor to apply sec to an expression.

csc :: r -> r Source #

Smart constructor to apply csc to an expression.

cot :: r -> r Source #

Smart constructor to apply cot to an expression.

arcsin :: r -> r Source #

Smart constructor to apply arcsin to an expression.

arccos :: r -> r Source #

Smart constructor to apply arccos to an expression.

arctan :: r -> r Source #

Smart constructor to apply arctan to an expression.

exp :: r -> r Source #

Smart constructor for the exponential (base e) function.

dim :: r -> r Source #

Smart constructor for calculating the dimension of a vector.

norm :: r -> r Source #

Smart constructor for calculating the normal form of a vector.

negVec :: r -> r Source #

Smart constructor for negating vectors.

not_ :: r -> r Source #

Smart constructor for applying logical negation to an expression.

idx :: r -> r -> r Source #

Smart constructor for indexing.

idxOf :: r -> r -> r Source #

Smart constructor for indexOf. Finds the index of the first occurrence of a value in a list.

defint :: Symbol -> r -> r -> r -> r Source #

Smart constructor for the summation, product, and integral functions over an interval.

defsum :: Symbol -> r -> r -> r -> r Source #

Smart constructor for the summation, product, and integral functions over an interval.

defprod :: Symbol -> r -> r -> r -> r Source #

Smart constructor for the summation, product, and integral functions over an interval.

realInterval :: IsChunk c => c -> RealInterval r r -> r Source #

Smart constructor for 'real interval' membership.

euclidean :: [r] -> r Source #

Euclidean function : takes a vector and returns the sqrt of the sum-of-squares.

cross :: r -> r -> r Source #

Smart constructor to cross product two expressions.

vScale :: r -> r -> r Source #

Smart constructor for vector scaling

vAdd :: r -> r -> r Source #

Vector Addition

vSub :: r -> r -> r Source #

Vector Subtraction

completeCase :: [(r, r)] -> r Source #

Smart constructor for case statements with a complete set of cases.

incompleteCase :: [(r, r)] -> r Source #

Smart constructor for case statements with an incomplete set of cases.

matrix :: [[r]] -> r Source #

Create a matrix.

set' :: Space -> [r] -> r Source #

Create a Set.

apply :: (IsChunk f, HasSymbol f) => f -> [r] -> r Source #

Applies a given function with a list of parameters.

sy :: (IsChunk c, HasSymbol c) => c -> r Source #

Create an Expr from a Symbolic Chunk.

Instances

Instances details
ExprC CodeExpr Source # 
Instance details

Defined in Drasil.Code.CodeExpr.Lang

Methods

lit :: Literal -> CodeExpr Source #

($=) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($!=) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($<) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($>) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($<=) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($>=) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($.) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($+) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($*) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($-) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($/) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($^) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($&&) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($||) :: CodeExpr -> CodeExpr -> CodeExpr Source #

in' :: CodeExpr -> CodeExpr -> CodeExpr Source #

abs_ :: CodeExpr -> CodeExpr Source #

neg :: CodeExpr -> CodeExpr Source #

log :: CodeExpr -> CodeExpr Source #

ln :: CodeExpr -> CodeExpr Source #

sqrt :: CodeExpr -> CodeExpr Source #

sin :: CodeExpr -> CodeExpr Source #

cos :: CodeExpr -> CodeExpr Source #

tan :: CodeExpr -> CodeExpr Source #

sec :: CodeExpr -> CodeExpr Source #

csc :: CodeExpr -> CodeExpr Source #

cot :: CodeExpr -> CodeExpr Source #

arcsin :: CodeExpr -> CodeExpr Source #

arccos :: CodeExpr -> CodeExpr Source #

arctan :: CodeExpr -> CodeExpr Source #

exp :: CodeExpr -> CodeExpr Source #

dim :: CodeExpr -> CodeExpr Source #

norm :: CodeExpr -> CodeExpr Source #

negVec :: CodeExpr -> CodeExpr Source #

not_ :: CodeExpr -> CodeExpr Source #

idx :: CodeExpr -> CodeExpr -> CodeExpr Source #

idxOf :: CodeExpr -> CodeExpr -> CodeExpr Source #

defint :: Symbol -> CodeExpr -> CodeExpr -> CodeExpr -> CodeExpr Source #

defsum :: Symbol -> CodeExpr -> CodeExpr -> CodeExpr -> CodeExpr Source #

defprod :: Symbol -> CodeExpr -> CodeExpr -> CodeExpr -> CodeExpr Source #

realInterval :: IsChunk c => c -> RealInterval CodeExpr CodeExpr -> CodeExpr Source #

euclidean :: [CodeExpr] -> CodeExpr Source #

cross :: CodeExpr -> CodeExpr -> CodeExpr Source #

vScale :: CodeExpr -> CodeExpr -> CodeExpr Source #

vAdd :: CodeExpr -> CodeExpr -> CodeExpr Source #

vSub :: CodeExpr -> CodeExpr -> CodeExpr Source #

completeCase :: [(CodeExpr, CodeExpr)] -> CodeExpr Source #

incompleteCase :: [(CodeExpr, CodeExpr)] -> CodeExpr Source #

matrix :: [[CodeExpr]] -> CodeExpr Source #

set' :: Space -> [CodeExpr] -> CodeExpr Source #

apply :: (IsChunk f, HasSymbol f) => f -> [CodeExpr] -> CodeExpr Source #

sy :: (IsChunk c, HasSymbol c) => c -> CodeExpr Source #

ExprC Expr Source # 
Instance details

Defined in Language.Drasil.Expr.Class

Methods

lit :: Literal -> Expr Source #

($=) :: Expr -> Expr -> Expr Source #

($!=) :: Expr -> Expr -> Expr Source #

($<) :: Expr -> Expr -> Expr Source #

($>) :: Expr -> Expr -> Expr Source #

($<=) :: Expr -> Expr -> Expr Source #

($>=) :: Expr -> Expr -> Expr Source #

($.) :: Expr -> Expr -> Expr Source #

($+) :: Expr -> Expr -> Expr Source #

($*) :: Expr -> Expr -> Expr Source #

($-) :: Expr -> Expr -> Expr Source #

($/) :: Expr -> Expr -> Expr Source #

($^) :: Expr -> Expr -> Expr Source #

($&&) :: Expr -> Expr -> Expr Source #

($||) :: Expr -> Expr -> Expr Source #

in' :: Expr -> Expr -> Expr Source #

abs_ :: Expr -> Expr Source #

neg :: Expr -> Expr Source #

log :: Expr -> Expr Source #

ln :: Expr -> Expr Source #

sqrt :: Expr -> Expr Source #

sin :: Expr -> Expr Source #

cos :: Expr -> Expr Source #

tan :: Expr -> Expr Source #

sec :: Expr -> Expr Source #

csc :: Expr -> Expr Source #

cot :: Expr -> Expr Source #

arcsin :: Expr -> Expr Source #

arccos :: Expr -> Expr Source #

arctan :: Expr -> Expr Source #

exp :: Expr -> Expr Source #

dim :: Expr -> Expr Source #

norm :: Expr -> Expr Source #

negVec :: Expr -> Expr Source #

not_ :: Expr -> Expr Source #

idx :: Expr -> Expr -> Expr Source #

idxOf :: Expr -> Expr -> Expr Source #

defint :: Symbol -> Expr -> Expr -> Expr -> Expr Source #

defsum :: Symbol -> Expr -> Expr -> Expr -> Expr Source #

defprod :: Symbol -> Expr -> Expr -> Expr -> Expr Source #

realInterval :: IsChunk c => c -> RealInterval Expr Expr -> Expr Source #

euclidean :: [Expr] -> Expr Source #

cross :: Expr -> Expr -> Expr Source #

vScale :: Expr -> Expr -> Expr Source #

vAdd :: Expr -> Expr -> Expr Source #

vSub :: Expr -> Expr -> Expr Source #

completeCase :: [(Expr, Expr)] -> Expr Source #

incompleteCase :: [(Expr, Expr)] -> Expr Source #

matrix :: [[Expr]] -> Expr Source #

set' :: Space -> [Expr] -> Expr Source #

apply :: (IsChunk f, HasSymbol f) => f -> [Expr] -> Expr Source #

sy :: (IsChunk c, HasSymbol c) => c -> Expr Source #

ExprC ModelExpr Source # 
Instance details

Defined in Language.Drasil.Expr.Class

Methods

lit :: Literal -> ModelExpr Source #

($=) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($!=) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($<) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($>) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($<=) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($>=) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($.) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($+) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($*) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($-) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($/) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($^) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($&&) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($||) :: ModelExpr -> ModelExpr -> ModelExpr Source #

in' :: ModelExpr -> ModelExpr -> ModelExpr Source #

abs_ :: ModelExpr -> ModelExpr Source #

neg :: ModelExpr -> ModelExpr Source #

log :: ModelExpr -> ModelExpr Source #

ln :: ModelExpr -> ModelExpr Source #

sqrt :: ModelExpr -> ModelExpr Source #

sin :: ModelExpr -> ModelExpr Source #

cos :: ModelExpr -> ModelExpr Source #

tan :: ModelExpr -> ModelExpr Source #

sec :: ModelExpr -> ModelExpr Source #

csc :: ModelExpr -> ModelExpr Source #

cot :: ModelExpr -> ModelExpr Source #

arcsin :: ModelExpr -> ModelExpr Source #

arccos :: ModelExpr -> ModelExpr Source #

arctan :: ModelExpr -> ModelExpr Source #

exp :: ModelExpr -> ModelExpr Source #

dim :: ModelExpr -> ModelExpr Source #

norm :: ModelExpr -> ModelExpr Source #

negVec :: ModelExpr -> ModelExpr Source #

not_ :: ModelExpr -> ModelExpr Source #

idx :: ModelExpr -> ModelExpr -> ModelExpr Source #

idxOf :: ModelExpr -> ModelExpr -> ModelExpr Source #

defint :: Symbol -> ModelExpr -> ModelExpr -> ModelExpr -> ModelExpr Source #

defsum :: Symbol -> ModelExpr -> ModelExpr -> ModelExpr -> ModelExpr Source #

defprod :: Symbol -> ModelExpr -> ModelExpr -> ModelExpr -> ModelExpr Source #

realInterval :: IsChunk c => c -> RealInterval ModelExpr ModelExpr -> ModelExpr Source #

euclidean :: [ModelExpr] -> ModelExpr Source #

cross :: ModelExpr -> ModelExpr -> ModelExpr Source #

vScale :: ModelExpr -> ModelExpr -> ModelExpr Source #

vAdd :: ModelExpr -> ModelExpr -> ModelExpr Source #

vSub :: ModelExpr -> ModelExpr -> ModelExpr Source #

completeCase :: [(ModelExpr, ModelExpr)] -> ModelExpr Source #

incompleteCase :: [(ModelExpr, ModelExpr)] -> ModelExpr Source #

matrix :: [[ModelExpr]] -> ModelExpr Source #

set' :: Space -> [ModelExpr] -> ModelExpr Source #

apply :: (IsChunk f, HasSymbol f) => f -> [ModelExpr] -> ModelExpr Source #

sy :: (IsChunk c, HasSymbol c) => c -> ModelExpr Source #

frac :: (ExprC r, LiteralC r) => Integer -> Integer -> r Source #

Smart constructor for fractions.

recip_ :: (ExprC r, LiteralC r) => r -> r Source #

Smart constructor for rational expressions (only in 1/x form).

square :: (ExprC r, LiteralC r) => r -> r Source #

Smart constructor to square a function.

half :: (ExprC r, LiteralC r) => r -> r Source #

Smart constructor to half a function exactly.

oneHalf :: (ExprC r, LiteralC r) => r Source #

1/2, as an expression.

oneThird :: (ExprC r, LiteralC r) => r Source #

1/3rd, as an expression.

apply1 :: (ExprC r, IsChunk f, HasSymbol f, IsChunk a, HasSymbol a) => f -> a -> r Source #

Similar to apply, but converts second argument into Symbols.

apply2 :: (ExprC r, IsChunk f, HasSymbol f, IsChunk a, HasSymbol a, IsChunk b, HasSymbol b) => f -> a -> b -> r Source #

Similar to apply, but the applied function takes two parameters (which are both Symbols).

m2x2 :: ExprC r => r -> r -> r -> r -> r Source #

Create a two-by-two matrix from four given values. For example:

>>> m2x2 1 2 3 4
[ [1,2],
  [3,4] ]

vec2D :: ExprC r => r -> r -> r Source #

Create a 2D vector (a matrix with two rows, one column). First argument is placed above the second.

dgnl2x2 :: (ExprC r, LiteralC r) => r -> r -> r Source #

Creates a diagonal two-by-two matrix. For example:

>>> dgnl2x2 1 2
[ [1, 0],
  [0, 2] ]

rowVec :: ExprC r => [r] -> r Source #

Create a row vector

columnVec :: ExprC r => [r] -> r Source #

Create a column vector

mkSet :: ExprC r => Space -> [r] -> r Source #

data Completeness Source #

For case expressions (either complete or incomplete).

Instances

Instances details
Eq Completeness Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

type Relation = Expr Source #

A relation is just an expression (Expr).

Literals Language

Expression Modelling Language

Defines display-related expression functions. Used in models.

data ModelExpr where Source #

Expression language where all terms are supposed to have a meaning, but that meaning may not be that of a definite value. For example, specification expressions, especially with quantifiers, belong here.

Constructors

Spc :: Space -> ModelExpr

Introduce Space values into the expression language.

Instances

Instances details
ExprC ModelExpr Source # 
Instance details

Defined in Language.Drasil.Expr.Class

Methods

lit :: Literal -> ModelExpr Source #

($=) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($!=) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($<) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($>) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($<=) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($>=) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($.) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($+) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($*) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($-) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($/) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($^) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($&&) :: ModelExpr -> ModelExpr -> ModelExpr Source #

($||) :: ModelExpr -> ModelExpr -> ModelExpr Source #

in' :: ModelExpr -> ModelExpr -> ModelExpr Source #

abs_ :: ModelExpr -> ModelExpr Source #

neg :: ModelExpr -> ModelExpr Source #

log :: ModelExpr -> ModelExpr Source #

ln :: ModelExpr -> ModelExpr Source #

sqrt :: ModelExpr -> ModelExpr Source #

sin :: ModelExpr -> ModelExpr Source #

cos :: ModelExpr -> ModelExpr Source #

tan :: ModelExpr -> ModelExpr Source #

sec :: ModelExpr -> ModelExpr Source #

csc :: ModelExpr -> ModelExpr Source #

cot :: ModelExpr -> ModelExpr Source #

arcsin :: ModelExpr -> ModelExpr Source #

arccos :: ModelExpr -> ModelExpr Source #

arctan :: ModelExpr -> ModelExpr Source #

exp :: ModelExpr -> ModelExpr Source #

dim :: ModelExpr -> ModelExpr Source #

norm :: ModelExpr -> ModelExpr Source #

negVec :: ModelExpr -> ModelExpr Source #

not_ :: ModelExpr -> ModelExpr Source #

idx :: ModelExpr -> ModelExpr -> ModelExpr Source #

idxOf :: ModelExpr -> ModelExpr -> ModelExpr Source #

defint :: Symbol -> ModelExpr -> ModelExpr -> ModelExpr -> ModelExpr Source #

defsum :: Symbol -> ModelExpr -> ModelExpr -> ModelExpr -> ModelExpr Source #

defprod :: Symbol -> ModelExpr -> ModelExpr -> ModelExpr -> ModelExpr Source #

realInterval :: IsChunk c => c -> RealInterval ModelExpr ModelExpr -> ModelExpr Source #

euclidean :: [ModelExpr] -> ModelExpr Source #

cross :: ModelExpr -> ModelExpr -> ModelExpr Source #

vScale :: ModelExpr -> ModelExpr -> ModelExpr Source #

vAdd :: ModelExpr -> ModelExpr -> ModelExpr Source #

vSub :: ModelExpr -> ModelExpr -> ModelExpr Source #

completeCase :: [(ModelExpr, ModelExpr)] -> ModelExpr Source #

incompleteCase :: [(ModelExpr, ModelExpr)] -> ModelExpr Source #

matrix :: [[ModelExpr]] -> ModelExpr Source #

set' :: Space -> [ModelExpr] -> ModelExpr Source #

apply :: (IsChunk f, HasSymbol f) => f -> [ModelExpr] -> ModelExpr Source #

sy :: (IsChunk c, HasSymbol c) => c -> ModelExpr Source #

Express ModelExpr Source #

No change, it's already a ModelExpr.

Instance details

Defined in Language.Drasil.ExprClasses

LiteralC ModelExpr Source # 
Instance details

Defined in Language.Drasil.ModelExpr.Lang

ModelExprC ModelExpr Source # 
Instance details

Defined in Language.Drasil.ModelExpr.Class

Eq ModelExpr Source #

Expressions are equal if their constructors and contents are equal.

TODO: This needs to add more equality checks

Instance details

Defined in Language.Drasil.ModelExpr.Lang

data DerivType Source #

Determines the type of the derivative (either a partial derivative or a total derivative).

Instances

Instances details
Eq DerivType Source # 
Instance details

Defined in Language.Drasil.ModelExpr.Lang

class ModelExprC r where Source #

Methods

deriv :: (IsChunk c, HasSymbol c) => r -> c -> r Source #

Gets the derivative of an ModelExpr with respect to a Symbol.

pderiv :: (IsChunk c, HasSymbol c) => r -> c -> r Source #

Gets the derivative of an ModelExpr with respect to a Symbol.

nthderiv :: (IsChunk c, HasSymbol c) => Integer -> r -> c -> r Source #

Gets the nthderivative of an ModelExpr with respect to a Symbol.

nthpderiv :: (IsChunk c, HasSymbol c) => Integer -> r -> c -> r Source #

Gets the nthderivative of an ModelExpr with respect to a Symbol.

defines :: r -> r -> r Source #

One expression is "defined" by another.

space :: Space -> r Source #

Space literals.

isIn :: r -> Space -> r Source #

Check if a value belongs to a Space.

equiv :: [r] -> r Source #

Binary associative Equivalence.

intAll :: Symbol -> r -> r Source #

Smart constructor for the summation, product, and integral functions over all Real numbers.

sumAll :: Symbol -> r -> r Source #

Smart constructor for the summation, product, and integral functions over all Real numbers.

prodAll :: Symbol -> r -> r Source #

Smart constructor for the summation, product, and integral functions over all Real numbers.

Unicode symbols

Some expressions need special unicode characters.

data Special Source #

Special characters include partial derivatives and the degree circle.

Constructors

Circle 

Instances

Instances details
Eq Special Source # 
Instance details

Defined in Language.Drasil.Unicode

Methods

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

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

Ord Special Source # 
Instance details

Defined in Language.Drasil.Unicode

class RenderSpecial r where Source #

Class for rendering special characters.

Methods

special :: Special -> r Source #

The Drasil Language (Information Encoding)

This is the basis of the Drasil language for encoding information. Every chunk used in Drasil is defined here, along with some classes that help us to use these chunks.

Classes

Contains many of the classes used in Drasil, along with their methods.

Chunk-related

class HasSymbol c where Source #

A HasSymbol is anything which has a Symbol.

Methods

symbol :: c -> Stage -> Symbol Source #

Provides the Symbol for a particular stage of generation.

Instances

Instances details
HasSymbol CodeChunk Source #

Finds the Stage dependent Symbol of the DefinedQuantityDict used to make the CodeChunk.

Instance details

Defined in Drasil.Code.CodeVar

HasSymbol CodeFuncChunk Source #

Finds the Stage dependent Symbol of the CodeChunk used to make the CodeFuncChunk.

Instance details

Defined in Drasil.Code.CodeVar

HasSymbol CodeVarChunk Source #

Finds the Stage dependent Symbol of the CodeChunk used to make the CodeVarChunk.

Instance details

Defined in Drasil.Code.CodeVar

HasSymbol ConstrConcept Source #

Finds the Symbol of the DefinedQuantityDict used to make the ConstrConcept.

Instance details

Defined in Language.Drasil.Chunk.Constrained

HasSymbol DefinedQuantityDict Source #

Finds the Stage -> Symbol of the DefinedQuantityDict.

Instance details

Defined in Language.Drasil.Chunk.DefinedQuantity

HasSymbol UncertQ Source #

Finds the Symbol of the DefinedQuantityDict used to make the UncertQ.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

Methods

symbol :: UncertQ -> Stage -> Symbol Source #

HasSymbol (QDefinition e) Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

class IsChunk c => NamedIdea c where Source #

A NamedIdea is a term that we've identified (has a UID) as being worthy of naming.

Methods

term :: Lens' c NP Source #

Lens to the term (an NP).

Instances

Instances details
NamedIdea CodeChunk Source #

Finds the term (NP) of the DefinedQuantityDict used to make the CodeChunk.

Instance details

Defined in Drasil.Code.CodeVar

Methods

term :: Lens' CodeChunk NP Source #

NamedIdea CodeFuncChunk Source #

Finds the term (NP) of the CodeChunk used to make the CodeFuncChunk.

Instance details

Defined in Drasil.Code.CodeVar

Methods

term :: Lens' CodeFuncChunk NP Source #

NamedIdea CodeVarChunk Source #

Finds the term (NP) of the CodeChunk used to make the CodeVarChunk.

Instance details

Defined in Drasil.Code.CodeVar

Methods

term :: Lens' CodeVarChunk NP Source #

NamedIdea CI Source #

Finds term (NP) of the IdeaDict used to make the CI.

Instance details

Defined in Language.Drasil.Chunk.CommonIdea

Methods

term :: Lens' CI NP Source #

NamedIdea ConceptChunk Source #

Finds term (NP) of the ConceptChunk.

Instance details

Defined in Language.Drasil.Chunk.Concept.Core

Methods

term :: Lens' ConceptChunk NP Source #

NamedIdea ConstrConcept Source #

Finds term (NP) of the DefinedQuantityDict used to make the ConstrConcept.

Instance details

Defined in Language.Drasil.Chunk.Constrained

Methods

term :: Lens' ConstrConcept NP Source #

NamedIdea DefinedQuantityDict Source #

Finds the term (NP) of the ConceptChunk used to make the DefinedQuantityDict.

Instance details

Defined in Language.Drasil.Chunk.DefinedQuantity

NamedIdea IdeaDict Source #

Finds the term (NP) of the IdeaDict used to make the IdeaDict.

Instance details

Defined in Language.Drasil.Chunk.NamedIdea

Methods

term :: Lens' IdeaDict NP Source #

NamedIdea UncertQ Source #

Finds term (NP) of the DefinedQuantityDict used to make the UncertQ.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

Methods

term :: Lens' UncertQ NP Source #

NamedIdea UnitDefn Source #

Finds term (NP) of the ConceptChunk used to make the UnitDefn.

Instance details

Defined in Language.Drasil.Chunk.UnitDefn

Methods

term :: Lens' UnitDefn NP Source #

NamedIdea ConceptInstance Source #

Finds term (NP) of the ConceptChunk used to make the ConceptInstance.

Instance details

Defined in Language.Drasil.Document.ConceptInstance

Methods

term :: Lens' ConceptInstance NP Source #

NamedIdea (QDefinition e) Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

Methods

term :: Lens' (QDefinition e) NP Source #

class NamedIdea c => Idea c where Source #

An Idea is the combination of a NamedIdea and a CommonIdea. In other words, it may have an acronym/abbreviation.

Methods

getA :: c -> Maybe String Source #

Get the acronym/abbreviation.

Instances

Instances details
Idea CodeChunk Source #

Finds the idea contained in the DefinedQuantityDict used to make the CodeChunk.

Instance details

Defined in Drasil.Code.CodeVar

Idea CodeFuncChunk Source #

Finds the idea contained in the CodeChunk used to make the CodeFuncChunk.

Instance details

Defined in Drasil.Code.CodeVar

Idea CodeVarChunk Source #

Finds the idea contained in the CodeChunk used to make the CodeVarChunk.

Instance details

Defined in Drasil.Code.CodeVar

Idea CI Source #

Finds the idea of a CI (abbreviation).

Instance details

Defined in Language.Drasil.Chunk.CommonIdea

Methods

getA :: CI -> Maybe String Source #

Idea ConceptChunk Source #

Finds the abbreviation of the ConceptChunk.

Instance details

Defined in Language.Drasil.Chunk.Concept.Core

Idea ConstrConcept Source #

Finds the idea contained in the DefinedQuantityDict used to make the ConstrConcept.

Instance details

Defined in Language.Drasil.Chunk.Constrained

Idea DefinedQuantityDict Source #

Finds the idea contained in the ConceptChunk used to make the DefinedQuantityDict.

Instance details

Defined in Language.Drasil.Chunk.DefinedQuantity

Idea IdeaDict Source #

Finds the abbreviation of the IdeaDict.

Instance details

Defined in Language.Drasil.Chunk.NamedIdea

Idea UncertQ Source #

Finds the idea contained in the DefinedQuantityDict used to make the UncertQ.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

Idea UnitDefn Source #

Finds the idea contained in the ConceptChunk used to make the UnitDefn.

Instance details

Defined in Language.Drasil.Chunk.UnitDefn

Idea ConceptInstance Source #

Finds the idea contained in the ConceptChunk used to make the ConceptInstance.

Instance details

Defined in Language.Drasil.Document.ConceptInstance

Idea (QDefinition e) Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

class NamedIdea c => CommonIdea c where Source #

CommonIdea is a NamedIdea with the additional constraint that it must have an abbreviation. This is the main distinction between getA and abrv, where getA may return Nothing, while abrv will always return the abbreviation.

Methods

abrv :: c -> String Source #

Introduces abrv which necessarily provides an abbreviation.

Instances

Instances details
CommonIdea CI Source #

Finds the idea of a CI (abbreviation).

Instance details

Defined in Language.Drasil.Chunk.CommonIdea

Methods

abrv :: CI -> String Source #

class Definition c where Source #

Defines a chunk.

Methods

defn :: Lens' c Sentence Source #

Provides (a Lens to) the definition for a chunk.

Instances

Instances details
Definition CodeChunk Source #

Finds the Definition contained in the DefinedQuantityDict used to make the CodeChunk

Instance details

Defined in Drasil.Code.CodeVar

Methods

defn :: Lens' CodeChunk Sentence Source #

Definition CodeFuncChunk Source #

Finds the Definition of the CodeChunk used to make the CodeFuncChunk

Instance details

Defined in Drasil.Code.CodeVar

Definition CodeVarChunk Source # 
Instance details

Defined in Drasil.Code.CodeVar

Definition ConceptChunk Source #

Finds definition of a ConceptChunk.

Instance details

Defined in Language.Drasil.Chunk.Concept.Core

Definition ConstrConcept Source #

Finds definition of the DefinedQuantityDict used to make the ConstrConcept.

Instance details

Defined in Language.Drasil.Chunk.Constrained

Definition DefinedQuantityDict Source #

Finds the definition contained in the ConceptChunk used to make the DefinedQuantityDict.

Instance details

Defined in Language.Drasil.Chunk.DefinedQuantity

Definition UncertQ Source #

Finds definition of the DefinedQuantityDict used to make the UncertQ.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

Methods

defn :: Lens' UncertQ Sentence Source #

Definition UnitDefn Source #

Finds definition of the ConceptChunk used to make the UnitDefn.

Instance details

Defined in Language.Drasil.Chunk.UnitDefn

Methods

defn :: Lens' UnitDefn Sentence Source #

Definition ConceptInstance Source #

Finds the definition contained in the ConceptChunk used to make the ConceptInstance.

Instance details

Defined in Language.Drasil.Document.ConceptInstance

Definition (QDefinition e) Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

Methods

defn :: Lens' (QDefinition e) Sentence Source #

class ConceptDomain c where Source #

Some concepts have a domain (related information encoded in UIDs to other chunks).

Methods

cdom :: c -> [UID] Source #

Provides Getter for the concept domain tags for a chunk

cdom should be exported for use by the Drasil framework, but should not be exported beyond that.

Instances

Instances details
ConceptDomain ConceptChunk Source #

Finds the domain of UIDs of a ConceptChunk.

Instance details

Defined in Language.Drasil.Chunk.Concept.Core

Methods

cdom :: ConceptChunk -> [UID] Source #

ConceptDomain ConceptInstance Source #

Finds the domain contained in the ConceptChunk used to make the ConceptInstance.

Instance details

Defined in Language.Drasil.Document.ConceptInstance

type Concept c = (Idea c, Definition c) Source #

Concepts are Ideas with definitions and domains.

class HasSpace c where Source #

HasSpace is anything which has a Space.

Methods

typ :: Getter c Space Source #

Provides a Getter to the Space.

Instances

Instances details
HasSpace CodeChunk Source #

Finds the Space of the DefinedQuantityDict used to make the CodeChunk.

Instance details

Defined in Drasil.Code.CodeVar

Methods

typ :: Getter CodeChunk Space Source #

HasSpace CodeFuncChunk Source #

Finds the Space of the CodeChunk used to make the CodeFuncChunk.

Instance details

Defined in Drasil.Code.CodeVar

Methods

typ :: Getter CodeFuncChunk Space Source #

HasSpace CodeVarChunk Source #

Finds the Space of the CodeChunk used to make the CodeVarChunk.

Instance details

Defined in Drasil.Code.CodeVar

Methods

typ :: Getter CodeVarChunk Space Source #

HasSpace ConstrConcept Source #

Finds the Space of the DefinedQuantityDict used to make the ConstrConcept.

Instance details

Defined in Language.Drasil.Chunk.Constrained

Methods

typ :: Getter ConstrConcept Space Source #

HasSpace DefinedQuantityDict Source #

Finds the Space of the DefinedQuantityDict.

Instance details

Defined in Language.Drasil.Chunk.DefinedQuantity

HasSpace UncertQ Source #

Finds the Space of the DefinedQuantityDict used to make the UncertQ.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

Methods

typ :: Getter UncertQ Space Source #

HasSpace (QDefinition e) Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

Methods

typ :: Getter (QDefinition e) Space Source #

class HasUnitSymbol u where Source #

Some chunks store a unit symbol.

Methods

usymb :: u -> USymb Source #

Provides the ability to hold a unit symbol (USymb).

Instances

Instances details
HasUnitSymbol UnitDefn Source #

Finds unit symbol of the ConceptChunk used to make the UnitDefn.

Instance details

Defined in Language.Drasil.Chunk.UnitDefn

Methods

usymb :: UnitDefn -> USymb Source #

type Quantity c = (Idea c, HasSpace c, HasSymbol c) Source #

A Quantity is an Idea with a Space and a Symbol. In theory, it should also restrict to being a part of MayHaveUnit, but that causes all sorts of import cycles (or lots of orphans).

class HasReasVal c where Source #

A Quantity that could have a reasonable value.

Methods

reasVal :: Lens' c (Maybe ReasonableValue) Source #

Provides a Lens to the possible reasonable value.

Instances

Instances details
HasReasVal ConstrConcept Source #

Finds a reasonable value for the ConstrConcept.

Instance details

Defined in Language.Drasil.Chunk.Constrained

HasReasVal UncertQ Source #

Finds a reasonable value for the UncertQ.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

class Constrained c where Source #

The Constrained class is a Quantity that has value constraints. It does not enforce Quantity at this point.

Methods

constraints :: Lens' c [ConstraintE] Source #

Provides a Lens to the Constraints.

Instances

Instances details
Constrained ConstrConcept Source #

Finds the Constraints of a ConstrConcept.

Instance details

Defined in Language.Drasil.Chunk.Constrained

Constrained UncertQ Source #

Finds the Constraints of a UncertQ.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

class HasAdditionalNotes c where Source #

Records any additional notes needed to avoid losing information

Methods

getNotes :: Lens' c [Sentence] Source #

Provides a Lens to the notes.

class (Idea u, Definition u, HasUnitSymbol u) => IsUnit u where Source #

Units are Ideas with a Definition which store a unit symbol. They must also be explicitly declared to be instances of IsUnit.

Minimal complete definition

udefn, getUnits

Methods

getUnits :: u -> [UID] Source #

Holds units as a list of UID.

Instances

Instances details
IsUnit UnitDefn Source #

Gets the UnitDefn and contributing units.

Instance details

Defined in Language.Drasil.Chunk.UnitDefn

Methods

udefn :: UnitDefn -> Maybe UDefn

getUnits :: UnitDefn -> [UID] Source #

class DefiningExpr (c :: Type -> Type) where Source #

Methods

defnExpr :: Lens' (c e) e Source #

Provides a Lens to the expression. TODO: Well, technically, e doesn't need to be an "expression" of any sorts. It just needs to be _something_, and it would have approximately have same meaning.

Instances

Instances details
DefiningExpr QDefinition Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

Methods

defnExpr :: Lens' (QDefinition e) e Source #

class Express c where Source #

Express something axiomatically.

Minimal complete definition

express | mexpress

Methods

express :: c -> ModelExpr Source #

Express something as a single fact.

mexpress :: c -> NonEmpty ModelExpr Source #

Express something as a series of facts.

Instances

Instances details
Express ConstrConcept Source #

Convert the symbol of the ConstrConcept to a ModelExpr.

Instance details

Defined in Language.Drasil.Chunk.Constrained

Express DefinedQuantityDict Source #

Convert the symbol of the DefinedQuantityDict to a ModelExpr.

Instance details

Defined in Language.Drasil.Chunk.DefinedQuantity

Express UncertQ Source #

Convert the symbol of the UncertQ to a ModelExpr.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

Express Expr Source #

Rewriting Exprs using the ModelExpr language.

Instance details

Defined in Language.Drasil.ExprClasses

Express Literal Source # 
Instance details

Defined in Language.Drasil.ExprClasses

Express ModelExpr Source #

No change, it's already a ModelExpr.

Instance details

Defined in Language.Drasil.ExprClasses

Express e => Express (QDefinition e) Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

Express t => Express (NonEmpty t) Source # 
Instance details

Defined in Language.Drasil.ExprClasses

Express t => Express [t] Source # 
Instance details

Defined in Language.Drasil.ExprClasses

Types

Contains helper functions and smart constructors for each type. Similar types are grouped together.

Basic types

data IdeaDict Source #

IdeaDict is the canonical dictionary associated to an Idea. Contains a UID and a term that could have an abbreviation (Maybe String).

Ex. The project name "Double Pendulum" may have the abbreviation DblPend.

Instances

Instances details
HasChunkRefs IdeaDict Source # 
Instance details

Defined in Language.Drasil.Chunk.NamedIdea

Methods

chunkRefs :: IdeaDict -> Set UID #

HasUID IdeaDict Source #

Finds the UID of the IdeaDict used to make the IdeaDict.

Instance details

Defined in Language.Drasil.Chunk.NamedIdea

Methods

uid :: Getter IdeaDict UID #

Idea IdeaDict Source #

Finds the abbreviation of the IdeaDict.

Instance details

Defined in Language.Drasil.Chunk.NamedIdea

NamedIdea IdeaDict Source #

Finds the term (NP) of the IdeaDict used to make the IdeaDict.

Instance details

Defined in Language.Drasil.Chunk.NamedIdea

Methods

term :: Lens' IdeaDict NP Source #

Generic IdeaDict Source # 
Instance details

Defined in Language.Drasil.Chunk.NamedIdea

Associated Types

type Rep IdeaDict 
Instance details

Defined in Language.Drasil.Chunk.NamedIdea

type Rep IdeaDict = D1 ('MetaData "IdeaDict" "Language.Drasil.Chunk.NamedIdea" "drasil-lang-0.1.60.0-1HMwkmtaiHpDlCGzFv9lso" 'False) (C1 ('MetaCons "IdeaDict" 'PrefixI 'True) (S1 ('MetaSel ('Just "_uu") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 UID) :*: (S1 ('MetaSel ('Just "_np") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 NP) :*: S1 ('MetaSel ('Just "mabbr") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe String)))))

Methods

from :: IdeaDict -> Rep IdeaDict x #

to :: Rep IdeaDict x -> IdeaDict #

Eq IdeaDict Source #

Equal if UIDs are equal.

Instance details

Defined in Language.Drasil.Chunk.NamedIdea

type Rep IdeaDict Source # 
Instance details

Defined in Language.Drasil.Chunk.NamedIdea

type Rep IdeaDict = D1 ('MetaData "IdeaDict" "Language.Drasil.Chunk.NamedIdea" "drasil-lang-0.1.60.0-1HMwkmtaiHpDlCGzFv9lso" 'False) (C1 ('MetaCons "IdeaDict" 'PrefixI 'True) (S1 ('MetaSel ('Just "_uu") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 UID) :*: (S1 ('MetaSel ('Just "_np") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 NP) :*: S1 ('MetaSel ('Just "mabbr") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe String)))))

idea Source #

Arguments

:: UID

The UID.

-> NP

The term being declared.

-> String

The terms acronym/abbreviation.

-> IdeaDict 

Construct an IdeaDict (with an acronym/abbreviation).

idea' Source #

Arguments

:: UID

The UID.

-> NP

The term being declared.

-> IdeaDict 

Construct an IdeaDict (without an acronym/abbreviation).

data CI Source #

The common idea (with NounPhrase) data type. It must have a UID, NounPhrase for its term, an abbreviation (String), and a domain ([UID]). It is similar to IdeaDict and IdeaDict in the sense that these are for things worth naming, but this type also carries an abbreviation and related domains of knowledge.

Ex. The term "Operating System" has the abbreviation OS and comes from the domain of computer science.

Instances

Instances details
HasChunkRefs CI Source # 
Instance details

Defined in Language.Drasil.Chunk.CommonIdea

Methods

chunkRefs :: CI -> Set UID #

HasUID CI Source #

Finds UID of the IdeaDict used to make the CI.

Instance details

Defined in Language.Drasil.Chunk.CommonIdea

Methods

uid :: Getter CI UID #

Idea CI Source #

Finds the idea of a CI (abbreviation).

Instance details

Defined in Language.Drasil.Chunk.CommonIdea

Methods

getA :: CI -> Maybe String Source #

NamedIdea CI Source #

Finds term (NP) of the IdeaDict used to make the CI.

Instance details

Defined in Language.Drasil.Chunk.CommonIdea

Methods

term :: Lens' CI NP Source #

CommonIdea CI Source #

Finds the idea of a CI (abbreviation).

Instance details

Defined in Language.Drasil.Chunk.CommonIdea

Methods

abrv :: CI -> String Source #

Generic CI Source # 
Instance details

Defined in Language.Drasil.Chunk.CommonIdea

Associated Types

type Rep CI 
Instance details

Defined in Language.Drasil.Chunk.CommonIdea

type Rep CI = D1 ('MetaData "CI" "Language.Drasil.Chunk.CommonIdea" "drasil-lang-0.1.60.0-1HMwkmtaiHpDlCGzFv9lso" 'False) (C1 ('MetaCons "CI" 'PrefixI 'True) (S1 ('MetaSel ('Just "_nc'") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 IdeaDict) :*: (S1 ('MetaSel ('Just "_ab") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 String) :*: S1 ('MetaSel ('Just "cdom'") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [UID]))))

Methods

from :: CI -> Rep CI x #

to :: Rep CI x -> CI #

type Rep CI Source # 
Instance details

Defined in Language.Drasil.Chunk.CommonIdea

type Rep CI = D1 ('MetaData "CI" "Language.Drasil.Chunk.CommonIdea" "drasil-lang-0.1.60.0-1HMwkmtaiHpDlCGzFv9lso" 'False) (C1 ('MetaCons "CI" 'PrefixI 'True) (S1 ('MetaSel ('Just "_nc'") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 IdeaDict) :*: (S1 ('MetaSel ('Just "_ab") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 String) :*: S1 ('MetaSel ('Just "cdom'") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [UID]))))

commonIdea :: UID -> NP -> String -> [IdeaDict] -> CI Source #

The commonIdea smart constructor requires a chunk id (String), a term (NP), an abbreviation (String), and a list of IdeaDict (should be domains). Note: should be polymorphic in IdeaDict, but currently causes issues with ambiguous type variables, punting for now.

prependAbrv :: CommonIdea c => c -> String -> String Source #

Prepends the abbreviation from a CommonIdea to a String.

Concepts

data ConceptChunk Source #

The ConceptChunk datatype records a concept that contains a unique id (UID), a term (NP), a definition (Sentence), an optional abbreviation ('Maybe String'), and an associated domain of knowledge ([UID]).

Ex. The concept of Accuracy may be defined as the quality or state of being correct or precise.

Instances

Instances details
HasChunkRefs ConceptChunk Source # 
Instance details

Defined in Language.Drasil.Chunk.Concept.Core

HasUID ConceptChunk Source #

Finds UID of the ConceptChunk.

Instance details

Defined in Language.Drasil.Chunk.Concept.Core

Methods

uid :: Getter ConceptChunk UID #

Idea ConceptChunk Source #

Finds the abbreviation of the ConceptChunk.

Instance details

Defined in Language.Drasil.Chunk.Concept.Core

NamedIdea ConceptChunk Source #

Finds term (NP) of the ConceptChunk.

Instance details

Defined in Language.Drasil.Chunk.Concept.Core

Methods

term :: Lens' ConceptChunk NP Source #

ConceptDomain ConceptChunk Source #

Finds the domain of UIDs of a ConceptChunk.

Instance details

Defined in Language.Drasil.Chunk.Concept.Core

Methods

cdom :: ConceptChunk -> [UID] Source #

Definition ConceptChunk Source #

Finds definition of a ConceptChunk.

Instance details

Defined in Language.Drasil.Chunk.Concept.Core

Generic ConceptChunk Source # 
Instance details

Defined in Language.Drasil.Chunk.Concept.Core

Associated Types

type Rep ConceptChunk 
Instance details

Defined in Language.Drasil.Chunk.Concept.Core

Eq ConceptChunk Source #

Equal if UIDs are equal.

Instance details

Defined in Language.Drasil.Chunk.Concept.Core

type Rep ConceptChunk Source # 
Instance details

Defined in Language.Drasil.Chunk.Concept.Core

sDom :: [UID] -> UID Source #

Check if something has one domain. Throws an error if there is more than one.

cncpt Source #

Arguments

:: Concept dom 
=> UID

The UID.

-> NP 
-> Sentence

The definition of the term

-> String

The term's abbreviation.

-> [dom]

The domain the term belongs to.

-> ConceptChunk 

Construct a ConceptChunk.

cncpt' Source #

Arguments

:: Concept dom 
=> UID

The UID.

-> NP

The term being defined.

-> Sentence

The definition of the term

-> [dom]

The domain the term belongs to.

-> ConceptChunk 

Construct a ConceptChunk.

cncpt'' Source #

Arguments

:: UID

The UID.

-> NP

The term being defined.

-> Sentence

The definition of the term

-> String

The term's abbreviation.

-> ConceptChunk 

Construct a ConceptChunk.

cncpt''' Source #

Arguments

:: UID

The UID.

-> NP

The term being defined.

-> Sentence

The definition of the term

-> ConceptChunk 

Construct a ConceptChunk.

cw :: Concept c => c -> ConceptChunk Source #

Deprecated: Chunk down-casting is strongly discouraged. If you want to construct a ConceptChunk, use one of its normal constructors.

For projecting out to the ConceptChunk data-type.

Quantities and Units

data QDefinition e Source #

A QDefinition is a representation of a formula relating a DefinedQuantityDict with an arbitrary expression e given a (possibly empty) list of input variables.

Ex:

  1. F = ma (with symbol F, space Real and unit Newtons)
  2. f(t) = t^2 (with symbol f [displayed as f(t)], space Real and unit seconds^2)

A QDefinition can be thought of as a MultiDefn with only a single formula.

Instances

Instances details
DefiningExpr QDefinition Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

Methods

defnExpr :: Lens' (QDefinition e) e Source #

HasChunkRefs (QDefinition e) Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

Methods

chunkRefs :: QDefinition e -> Set UID #

HasUID (QDefinition e) Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

Methods

uid :: Getter (QDefinition e) UID #

DefinesQuantity (QDefinition e) Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

Idea (QDefinition e) Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

NamedIdea (QDefinition e) Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

Methods

term :: Lens' (QDefinition e) NP Source #

MayHaveUnit (QDefinition e) Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

Definition (QDefinition e) Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

Methods

defn :: Lens' (QDefinition e) Sentence Source #

Express e => Express (QDefinition e) Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

HasSpace (QDefinition e) Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

Methods

typ :: Getter (QDefinition e) Space Source #

HasSymbol (QDefinition e) Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

Eq (QDefinition e) Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

RequiresChecking (QDefinition Expr) Expr Space Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

fromEqn :: String -> NP -> Sentence -> Symbol -> Space -> UnitDefn -> e -> QDefinition e Source #

Create a QDefinition with a UID (as a String), term (NP), definition (Sentence), Symbol, Space, unit, and defining expression.

fromEqn' :: String -> NP -> Sentence -> Symbol -> Space -> e -> QDefinition e Source #

Same as fromEqn, but has no units.

fromEqnSt :: UID -> NP -> Sentence -> (Stage -> Symbol) -> Space -> UnitDefn -> e -> QDefinition e Source #

Same as fromEqn, but symbol depends on stage.

fromEqnSt' :: UID -> NP -> Sentence -> (Stage -> Symbol) -> Space -> e -> QDefinition e Source #

Same as fromEqn, but symbol depends on stage and has no units.

fromEqnSt'' :: String -> NP -> Sentence -> (Stage -> Symbol) -> Space -> e -> QDefinition e Source #

Same as fromEqnSt', but takes a String instead of a UID.

mkQDefSt :: UID -> NP -> Sentence -> (Stage -> Symbol) -> Space -> Maybe UnitDefn -> e -> QDefinition e Source #

Wrapper for fromEqnSt and fromEqnSt'

mkQuantDef :: (Quantity c, MayHaveUnit c, Concept c) => c -> e -> QDefinition e Source #

Used to help make QDefinitions when UID, term, and Symbol come from the same source.

mkQuantDef' :: (Quantity c, MayHaveUnit c) => c -> NP -> e -> QDefinition e Source #

Used to help make QDefinitions when UID and Symbol come from the same source, with the term separate.

ec :: (Quantity c, MayHaveUnit c) => c -> e -> QDefinition e Source #

Deprecated: ec is an unsafe chunk constructor that encourages UID double-use.

Smart constructor for QDefinitions. Requires a quantity and its defining equation.

mkFuncDef :: (IsChunk f, HasSymbol f, HasSpace f, IsChunk i, HasSymbol i, HasSpace i) => f -> NP -> Sentence -> UnitDefn -> [i] -> e -> QDefinition e Source #

Create a QDefinition function with a symbol, name, term, list of inputs, resultant units, and a defining Expr

mkFuncDef' :: (IsChunk f, HasSymbol f, HasSpace f, IsChunk i, HasSymbol i, HasSpace i) => f -> NP -> Sentence -> [i] -> e -> QDefinition e Source #

Create a QDefinition function with a symbol, name, term, list of inputs, and a defining Expr

mkFuncDefByQ :: (Quantity c, MayHaveUnit c, HasSpace c, Quantity i, HasSpace i) => c -> [i] -> e -> QDefinition e Source #

Create a QDefinition functions using a symbol, list of inputs, and a defining Expr

data DefinedQuantityDict Source #

DefinedQuantityDict is a representation of a future value with information about its type (Space), unit (when applicable, UnitDefn), and symbol (in different Stage contexts, Symbol). Additionally, it contains a reference to the general concept the value is an instance of (ConceptChunk).

Ex. A pendulum arm can be defined as a concept with a symbol (l), space (Real numbers), and units (cm, m, etc.).

Instances

Instances details
HasChunkRefs DefinedQuantityDict Source # 
Instance details

Defined in Language.Drasil.Chunk.DefinedQuantity

HasUID DefinedQuantityDict Source #

Finds the UID of the ConceptChunk used to make the DefinedQuantityDict.

Instance details

Defined in Language.Drasil.Chunk.DefinedQuantity

Methods

uid :: Getter DefinedQuantityDict UID #

Idea DefinedQuantityDict Source #

Finds the idea contained in the ConceptChunk used to make the DefinedQuantityDict.

Instance details

Defined in Language.Drasil.Chunk.DefinedQuantity

NamedIdea DefinedQuantityDict Source #

Finds the term (NP) of the ConceptChunk used to make the DefinedQuantityDict.

Instance details

Defined in Language.Drasil.Chunk.DefinedQuantity

MayHaveUnit DefinedQuantityDict Source #

Finds the units of the DefinedQuantityDict.

Instance details

Defined in Language.Drasil.Chunk.DefinedQuantity

Definition DefinedQuantityDict Source #

Finds the definition contained in the ConceptChunk used to make the DefinedQuantityDict.

Instance details

Defined in Language.Drasil.Chunk.DefinedQuantity

Express DefinedQuantityDict Source #

Convert the symbol of the DefinedQuantityDict to a ModelExpr.

Instance details

Defined in Language.Drasil.Chunk.DefinedQuantity

HasSpace DefinedQuantityDict Source #

Finds the Space of the DefinedQuantityDict.

Instance details

Defined in Language.Drasil.Chunk.DefinedQuantity

HasSymbol DefinedQuantityDict Source #

Finds the Stage -> Symbol of the DefinedQuantityDict.

Instance details

Defined in Language.Drasil.Chunk.DefinedQuantity

Eq DefinedQuantityDict Source #

Equal if UIDs are equal.

Instance details

Defined in Language.Drasil.Chunk.DefinedQuantity

quant Source #

Arguments

:: UID

The UID.

-> NP

The quantity being defined.

-> Sentence

The definition of the quantity.

-> Symbol

The Symbol used for the quantity.

-> Space

The Space of the quantity.

-> UnitDefn

The unit of the quantity.

-> DefinedQuantityDict 

Construct a DefinedQuantityDict (with a unit)

quant' Source #

Arguments

:: UID

The UID.

-> NP

The quantity being defined.

-> Sentence

The definition of the quantity.

-> (Stage -> Symbol)

The Symbol used for the quantity, dependent on the Stage.

-> Space

The Space of the quantity.

-> UnitDefn

The unit of the quantity.

-> DefinedQuantityDict 

Construct a DefinedQuantityDict (with a unit and a symbol dependent on stage)

quantAU Source #

Arguments

:: UID

The UID.

-> NP

The quantity being defined.

-> Sentence

The definition of the quantity.

-> Maybe String

The (optional) abbreviation for the quantity.

-> (Stage -> Symbol)

The Symbol used for the quantity, dependent on the Stage.

-> Space

The Space of the quantity.

-> Maybe UnitDefn

The (optional) unit of the quantity.

-> DefinedQuantityDict 

Construct a DefinedQuantityDict (with an optional unit, optional abbreviation and a symbol dependent on stage)

quantNoUnit Source #

Arguments

:: UID

The UID.

-> NP

The quantity being defined.

-> Sentence

The definition of the quantity.

-> Symbol

The Symbol used for the quantity.

-> Space

The Space of the quantity.

-> DefinedQuantityDict 

Construct a DefinedQuantityDict (without a unit)

quantNoUnit' Source #

Arguments

:: UID

The UID.

-> NP

The quantity being defined.

-> Sentence

The definition of the quantity.

-> (Stage -> Symbol)

The Symbol used for the quantity, dependent on the Stage.

-> Space

The Space of the quantity.

-> DefinedQuantityDict 

Construct a DefinedQuantityDict (wihout a unit and with a symbol dependent on stage)

dqd :: ConceptChunk -> Symbol -> Space -> UnitDefn -> DefinedQuantityDict Source #

Deprecated: Smart constructors allow externally-known chunk nesting; use one of `quant, quant', quantNoUnit, quantNoUnit'` instead.

Smart constructor that creates a DefinedQuantityDict with a ConceptChunk, a Symbol independent of Stage, a Space, and a unit.

dqd' :: ConceptChunk -> (Stage -> Symbol) -> Space -> Maybe UnitDefn -> DefinedQuantityDict Source #

Deprecated: Smart constructors allow externally-known chunk nesting; use one of `quant, quant', quantNoUnit, quantNoUnit'` instead.

Similar to dqd, but the Symbol is now dependent on the Stage.

dqdNoUnit :: ConceptChunk -> Symbol -> Space -> DefinedQuantityDict Source #

Deprecated: Smart constructors allow externally-known chunk nesting; use one of `quant, quant', quantNoUnit, quantNoUnit'` instead.

Similar to dqd, but without any units.

dqdNoUnit' :: ConceptChunk -> (Stage -> Symbol) -> Space -> DefinedQuantityDict Source #

Deprecated: Smart constructors allow externally-known chunk nesting; use one of `quant, quant', quantNoUnit, quantNoUnit'` instead.

dqdWr :: (Quantity c, Concept c, MayHaveUnit c) => c -> DefinedQuantityDict Source #

When the input already has all the necessary information. A projection operator from some a type with instances of listed classes to a DefinedQuantityDict.

class DefinesQuantity d where Source #

Methods

defLhs :: Getter d DefinedQuantityDict Source #

Instances

Instances details
DefinesQuantity (QDefinition e) Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

implVar :: UID -> NP -> String -> Space -> Symbol -> DefinedQuantityDict Source #

Makes a variable that is implementation-only.

implVar' :: UID -> NP -> Sentence -> Space -> Symbol -> DefinedQuantityDict Source #

Similar to implVar, but takes in a Sentence for the description rather than a String.

implVarAU' :: UID -> NP -> Sentence -> Maybe String -> Space -> Symbol -> Maybe UnitDefn -> DefinedQuantityDict Source #

Similar to implVarAU but takes a Sentence for the description rather than a String.

data UnitDefn Source #

For defining units. It has a ConceptChunk (that defines what kind of unit it is), a unit symbol, maybe another (when it is a synonym), perhaps a definition, and a list of UID of the units that make up the definition.

Ex. Meter is a unit of length defined by the symbol (m).

Constructors

UD 

Fields

Instances

Instances details
HasChunkRefs UnitDefn Source # 
Instance details

Defined in Language.Drasil.Chunk.UnitDefn

Methods

chunkRefs :: UnitDefn -> Set UID #

HasUID UnitDefn Source #

Finds UID of the ConceptChunk used to make the UnitDefn.

Instance details

Defined in Language.Drasil.Chunk.UnitDefn

Methods

uid :: Getter UnitDefn UID #

Idea UnitDefn Source #

Finds the idea contained in the ConceptChunk used to make the UnitDefn.

Instance details

Defined in Language.Drasil.Chunk.UnitDefn

NamedIdea UnitDefn Source #

Finds term (NP) of the ConceptChunk used to make the UnitDefn.

Instance details

Defined in Language.Drasil.Chunk.UnitDefn

Methods

term :: Lens' UnitDefn NP Source #

Definition UnitDefn Source #

Finds definition of the ConceptChunk used to make the UnitDefn.

Instance details

Defined in Language.Drasil.Chunk.UnitDefn

Methods

defn :: Lens' UnitDefn Sentence Source #

HasUnitSymbol UnitDefn Source #

Finds unit symbol of the ConceptChunk used to make the UnitDefn.

Instance details

Defined in Language.Drasil.Chunk.UnitDefn

Methods

usymb :: UnitDefn -> USymb Source #

IsUnit UnitDefn Source #

Gets the UnitDefn and contributing units.

Instance details

Defined in Language.Drasil.Chunk.UnitDefn

Methods

udefn :: UnitDefn -> Maybe UDefn

getUnits :: UnitDefn -> [UID] Source #

Eq UnitDefn Source #

Equal if Symbols are equal.

Instance details

Defined in Language.Drasil.Chunk.UnitDefn

fromUDefn :: UDefn -> USymb Source #

Generates a default unit symbol.

unitCon :: String -> ConceptChunk Source #

Helper for fundamental unit concept chunk creation. Uses the same String for the identifier, term, and definition.

makeDerU :: ConceptChunk -> UnitEquation -> UnitDefn Source #

Create a derived unit chunk from a concept and a unit equation.

(^:) :: UnitDefn -> Integer -> UnitEquation Source #

Combinator for raising a unit to a power.

(/:) :: UnitDefn -> UnitDefn -> UnitEquation Source #

Combinator for dividing one unit by another.

(*:) :: UnitDefn -> UnitDefn -> UnitEquation Source #

Combinator for multiplying two units together.

(*$) :: UnitDefn -> UnitEquation -> UnitEquation Source #

Combinator for multiplying a unit and a symbol.

(/$) :: UnitDefn -> UnitEquation -> UnitEquation Source #

Combinator for dividing a unit and a symbol.

(^$) :: UnitEquation -> UnitEquation -> UnitEquation Source #

Combinator for mulitiplying two unit equations.

newUnit :: String -> UnitEquation -> UnitDefn Source #

Smart constructor for new derived units from existing units.

scale :: IsUnit s => Double -> s -> UDefn Source #

Combinator for scaling one unit by some number.

shift :: IsUnit s => Double -> s -> UDefn Source #

Combinator for shifting one unit by some number.

derUC :: String -> String -> String -> Symbol -> UDefn -> UnitDefn Source #

Create a derived unit chunk from a UID, term (String), definition, Symbol, and unit equation.

Uses self-plural term.

derUC' :: String -> String -> String -> Symbol -> UDefn -> UnitDefn Source #

Create a derived unit chunk from a UID, term (String), definition, Symbol, and unit equation.

Uses term that pluralizes by adding "s" to the end.

derUC'' :: String -> NP -> String -> Symbol -> UDefn -> UnitDefn Source #

Create a derived unit chunk from a UID, term (NP), definition, Symbol, and unit equation.

fund :: String -> String -> String -> UnitDefn Source #

Smart constructor for a "fundamental" unit.

fund' :: String -> String -> Symbol -> UnitDefn Source #

Variant of the fund, useful for degree.

compUnitDefn :: UnitDefn -> UnitDefn -> Ordering Source #

We don't want an Ord on units, but this still allows us to compare them.

derCUC :: String -> String -> String -> Symbol -> UnitEquation -> UnitDefn Source #

Create a SI_Unit with two Symbol representations. The created NP is self-plural.

derCUC' :: String -> String -> String -> Symbol -> UnitEquation -> UnitDefn Source #

Similar to derCUC, but the created NP has the AddS plural rule.

derCUC'' :: String -> NP -> String -> Symbol -> UnitEquation -> UnitDefn Source #

Create a derived unit chunk from a UID, term (NP), definition, Symbol, and unit equation.

getCu :: UnitEquation -> [UID] Source #

Get a list of UID of the units that make up the UnitEquation.

class MayHaveUnit u where Source #

Types may contain a unit (UnitDefn).

Methods

getUnit :: u -> Maybe UnitDefn Source #

Instances

Instances details
MayHaveUnit CodeChunk Source #

Finds the units of the DefinedQuantityDict used to make the CodeChunk.

Instance details

Defined in Drasil.Code.CodeVar

MayHaveUnit CodeFuncChunk Source #

Finds the units of the CodeChunk used to make the CodeFuncChunk.

Instance details

Defined in Drasil.Code.CodeVar

MayHaveUnit CodeVarChunk Source #

Finds the units of the CodeChunk used to make the CodeVarChunk.

Instance details

Defined in Drasil.Code.CodeVar

MayHaveUnit ConstrConcept Source #

Finds the units of the DefinedQuantityDict used to make the ConstrConcept.

Instance details

Defined in Language.Drasil.Chunk.Constrained

MayHaveUnit DefinedQuantityDict Source #

Finds the units of the DefinedQuantityDict.

Instance details

Defined in Language.Drasil.Chunk.DefinedQuantity

MayHaveUnit UncertQ Source #

Finds the units of the DefinedQuantityDict used to make the UncertQ.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

MayHaveUnit (QDefinition e) Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

Constrained and Uncertain Values

data ConstraintReason Source #

The reason behind the constraint's existence.

Constructors

Physical 
Software 

data Constraint a where Source #

Holds constraints. May occur between an interval of Expr, a list of Doubles, or a list of Strings.

Constructors

Range :: forall a. ConstraintReason -> RealInterval a a -> Constraint a

By default, physical and software constraints are ranges.

Elem :: forall a. ConstraintReason -> a -> Constraint a 

physRange :: RealInterval Expr Expr -> ConstraintE Source #

Smart constructor for range of Physical constraints between two given expressions.

sfwrRange :: RealInterval Expr Expr -> ConstraintE Source #

Smart constructor for range of Software constraints between two given expressions.

isPhysC :: Constraint e -> Bool Source #

Helpful for filtering for Physical constraints. True if constraint is Physical.

isSfwrC :: Constraint e -> Bool Source #

Helpful for filtering for Software constraints. True if constraint is Software.

data ConstrConcept Source #

ConstrConcepts are conceptual symbolic quantities (DefinedQuantityDict) with Constraints and maybe a reasonable value.

Ex. Measuring the length of a pendulum arm could be a concept that has some reasonable value (between 1 cm and 2 m) and the constraint that the length cannot be a negative value.

Instances

Instances details
HasChunkRefs ConstrConcept Source # 
Instance details

Defined in Language.Drasil.Chunk.Constrained

HasUID ConstrConcept Source #

Finds UID of the DefinedQuantityDict used to make the ConstrConcept.

Instance details

Defined in Language.Drasil.Chunk.Constrained

Methods

uid :: Getter ConstrConcept UID #

Idea ConstrConcept Source #

Finds the idea contained in the DefinedQuantityDict used to make the ConstrConcept.

Instance details

Defined in Language.Drasil.Chunk.Constrained

NamedIdea ConstrConcept Source #

Finds term (NP) of the DefinedQuantityDict used to make the ConstrConcept.

Instance details

Defined in Language.Drasil.Chunk.Constrained

Methods

term :: Lens' ConstrConcept NP Source #

MayHaveUnit ConstrConcept Source #

Finds the units of the DefinedQuantityDict used to make the ConstrConcept.

Instance details

Defined in Language.Drasil.Chunk.Constrained

Constrained ConstrConcept Source #

Finds the Constraints of a ConstrConcept.

Instance details

Defined in Language.Drasil.Chunk.Constrained

Definition ConstrConcept Source #

Finds definition of the DefinedQuantityDict used to make the ConstrConcept.

Instance details

Defined in Language.Drasil.Chunk.Constrained

HasReasVal ConstrConcept Source #

Finds a reasonable value for the ConstrConcept.

Instance details

Defined in Language.Drasil.Chunk.Constrained

Express ConstrConcept Source #

Convert the symbol of the ConstrConcept to a ModelExpr.

Instance details

Defined in Language.Drasil.Chunk.Constrained

HasSpace ConstrConcept Source #

Finds the Space of the DefinedQuantityDict used to make the ConstrConcept.

Instance details

Defined in Language.Drasil.Chunk.Constrained

Methods

typ :: Getter ConstrConcept Space Source #

HasSymbol ConstrConcept Source #

Finds the Symbol of the DefinedQuantityDict used to make the ConstrConcept.

Instance details

Defined in Language.Drasil.Chunk.Constrained

Eq ConstrConcept Source #

Equal if UIDs are equal.

Instance details

Defined in Language.Drasil.Chunk.Constrained

constrained' :: (Concept c, MayHaveUnit c, Quantity c) => c -> [ConstraintE] -> Expr -> ConstrConcept Source #

Creates a ConstrConcept with a quantitative concept, a list of Constraints and an Expr.

constrainedWithRationale :: (Concept c, MayHaveUnit c, Quantity c) => c -> [ConstraintE] -> Expr -> Sentence -> ConstrConcept Source #

Similar to constrained', but with a rationale Sentence explaining the reasonable value.

cuc' :: String -> NP -> String -> Symbol -> UnitDefn -> Space -> [ConstraintE] -> Expr -> ConstrConcept Source #

Creates a constrained unitary chunk from a UID, term (NP), description (String), Symbol, unit, Space, Constraints, and an Expr.

cuc'' :: String -> NP -> String -> (Stage -> Symbol) -> UnitDefn -> Space -> [ConstraintE] -> Expr -> ConstrConcept Source #

Similar to cuc', but Symbol is dependent on Stage.

cucNoUnit' :: String -> NP -> String -> Symbol -> Space -> [ConstraintE] -> Expr -> ConstrConcept Source #

Similar to cuc', but does not include a unit.

cnstrw' :: (Quantity c, Concept c, Constrained c, HasReasVal c, MayHaveUnit c) => c -> ConstrConcept Source #

Similar to cnstrw, but types must also have a Concept.

data ReasonableValue Source #

Represents a reasonable value (Expr) with an optional rationale ('Maybe Sentence').

A reasonable value is an example of a value that is physically admissible.

data UncertQ Source #

UncertQs are conceptual symbolic quantities with constraints and an Uncertainty. Contains the same information as a ConstrConcept with an added Uncertainty.

Ex. Measuring the length of a pendulum arm may be recorded with an uncertainty value.

Instances

Instances details
HasChunkRefs UncertQ Source # 
Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

Methods

chunkRefs :: UncertQ -> Set UID #

HasUID UncertQ Source #

Finds UID of the DefinedQuantityDict used to make the UncertQ.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

Methods

uid :: Getter UncertQ UID #

Idea UncertQ Source #

Finds the idea contained in the DefinedQuantityDict used to make the UncertQ.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

NamedIdea UncertQ Source #

Finds term (NP) of the DefinedQuantityDict used to make the UncertQ.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

Methods

term :: Lens' UncertQ NP Source #

MayHaveUnit UncertQ Source #

Finds the units of the DefinedQuantityDict used to make the UncertQ.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

Constrained UncertQ Source #

Finds the Constraints of a UncertQ.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

Definition UncertQ Source #

Finds definition of the DefinedQuantityDict used to make the UncertQ.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

Methods

defn :: Lens' UncertQ Sentence Source #

HasReasVal UncertQ Source #

Finds a reasonable value for the UncertQ.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

Express UncertQ Source #

Convert the symbol of the UncertQ to a ModelExpr.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

HasSpace UncertQ Source #

Finds the Space of the DefinedQuantityDict used to make the UncertQ.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

Methods

typ :: Getter UncertQ Space Source #

HasSymbol UncertQ Source #

Finds the Symbol of the DefinedQuantityDict used to make the UncertQ.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

Methods

symbol :: UncertQ -> Stage -> Symbol Source #

HasUncertainty UncertQ Source #

Finds the uncertainty of an UncertQ.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

Methods

unc :: Lens' UncertQ Uncertainty Source #

Eq UncertQ Source #

Equal if UIDs are equal.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

Methods

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

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

uq :: (Quantity c, Constrained c, Concept c, HasReasVal c, MayHaveUnit c) => c -> Uncertainty -> UncertQ Source #

Smart constructor that requires a Quantity, a percentage, and a reasonable value with an Uncertainty.

uqc :: String -> NP -> String -> Symbol -> UnitDefn -> Space -> [ConstraintE] -> Expr -> Uncertainty -> UncertQ Source #

Uncertainty quantity (uq) but with a constraint.

uqcND :: String -> NP -> Symbol -> UnitDefn -> Space -> [ConstraintE] -> Expr -> Uncertainty -> UncertQ Source #

Uncertainty quantity constraint (uqc) without a description.

uqDirect :: ConstrConcept -> Uncertainty -> UncertQ Source #

Directly wraps a ConstrConcept with an Uncertainty, preserving all fields (including rationale).

data Uncertainty Source #

Something that may contain an uncertainty value and a precision value.

Instances

Instances details
HasChunkRefs Uncertainty Source # 
Instance details

Defined in Language.Drasil.Uncertainty

Generic Uncertainty Source # 
Instance details

Defined in Language.Drasil.Uncertainty

Associated Types

type Rep Uncertainty 
Instance details

Defined in Language.Drasil.Uncertainty

type Rep Uncertainty = D1 ('MetaData "Uncertainty" "Language.Drasil.Uncertainty" "drasil-lang-0.1.60.0-1HMwkmtaiHpDlCGzFv9lso" 'False) (C1 ('MetaCons "Uncert" 'PrefixI 'True) (S1 ('MetaSel ('Just "_uncert") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Double)) :*: S1 ('MetaSel ('Just "_prec") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Int))))
type Rep Uncertainty Source # 
Instance details

Defined in Language.Drasil.Uncertainty

type Rep Uncertainty = D1 ('MetaData "Uncertainty" "Language.Drasil.Uncertainty" "drasil-lang-0.1.60.0-1HMwkmtaiHpDlCGzFv9lso" 'False) (C1 ('MetaCons "Uncert" 'PrefixI 'True) (S1 ('MetaSel ('Just "_uncert") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Double)) :*: S1 ('MetaSel ('Just "_prec") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Int))))

uncty :: Double -> Maybe Int -> Uncertainty Source #

Smart constructor for values with uncertainty.

class HasUncertainty c where Source #

HasUncertainty is just a chunk with some uncertainty associated to it. This uncertainty is represented as a decimal value between 0 and 1 (percentage).

Methods

unc :: Lens' c Uncertainty Source #

Provides the Lens to an Uncertainty.

Instances

Instances details
HasUncertainty UncertQ Source #

Finds the uncertainty of an UncertQ.

Instance details

Defined in Language.Drasil.Chunk.UncertainQuantity

Methods

unc :: Lens' UncertQ Uncertainty Source #

defaultUncrt :: Uncertainty Source #

The default uncertainty is set to 0.1.

uncVal :: HasUncertainty x => x -> Double Source #

Accessor for uncertainty value from something that has an uncertainty.

uncPrec :: HasUncertainty x => x -> Maybe Int Source #

Accessor for precision value from something that has an uncertainty.

exact :: Uncertainty Source #

Smart constructor for exact values (no uncertainty).

data Month Source #

Custom type for months (abbreviated).

Constructors

Jan 
Feb 
Mar 
Apr 
May 
Jun 
Jul 
Aug 
Sep 
Oct 
Nov 
Dec 

Instances

Instances details
HasChunkRefs Month Source # 
Instance details

Defined in Language.Drasil.Data.Date

Methods

chunkRefs :: Month -> Set UID #

Generic Month Source # 
Instance details

Defined in Language.Drasil.Data.Date

Associated Types

type Rep Month 
Instance details

Defined in Language.Drasil.Data.Date

type Rep Month = D1 ('MetaData "Month" "Language.Drasil.Data.Date" "drasil-lang-0.1.60.0-1HMwkmtaiHpDlCGzFv9lso" 'False) (((C1 ('MetaCons "Jan" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Feb" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Mar" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Apr" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "May" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Jun" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "Jul" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Aug" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Sep" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Oct" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Nov" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Dec" 'PrefixI 'False) (U1 :: Type -> Type)))))

Methods

from :: Month -> Rep Month x #

to :: Rep Month x -> Month #

Show Month Source # 
Instance details

Defined in Language.Drasil.Data.Date

Methods

showsPrec :: Int -> Month -> ShowS #

show :: Month -> String #

showList :: [Month] -> ShowS #

Eq Month Source # 
Instance details

Defined in Language.Drasil.Data.Date

Methods

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

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

Ord Month Source # 
Instance details

Defined in Language.Drasil.Data.Date

Methods

compare :: Month -> Month -> Ordering #

(<) :: Month -> Month -> Bool #

(<=) :: Month -> Month -> Bool #

(>) :: Month -> Month -> Bool #

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

max :: Month -> Month -> Month #

min :: Month -> Month -> Month #

type Rep Month Source # 
Instance details

Defined in Language.Drasil.Data.Date

type Rep Month = D1 ('MetaData "Month" "Language.Drasil.Data.Date" "drasil-lang-0.1.60.0-1HMwkmtaiHpDlCGzFv9lso" 'False) (((C1 ('MetaCons "Jan" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Feb" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Mar" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Apr" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "May" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Jun" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "Jul" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Aug" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Sep" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Oct" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Nov" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Dec" 'PrefixI 'False) (U1 :: Type -> Type)))))

type People = [Person] Source #

People is a synonymn for many Persons.

data Person Source #

A person can have a given name, middle name(s), and surname, as well as the naming convention they use.

Instances

Instances details
HasChunkRefs Person Source # 
Instance details

Defined in Language.Drasil.People

Methods

chunkRefs :: Person -> Set UID #

HasName Person Source #

Gets the name of a Person. Adds a dot after any initials.

Instance details

Defined in Language.Drasil.People

Generic Person Source # 
Instance details

Defined in Language.Drasil.People

Associated Types

type Rep Person 
Instance details

Defined in Language.Drasil.People

type Rep Person

Methods

from :: Person -> Rep Person x #

to :: Rep Person x -> Person #

Eq Person Source # 
Instance details

Defined in Language.Drasil.People

Methods

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

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

type Rep Person Source # 
Instance details

Defined in Language.Drasil.People

type Rep Person

person :: String -> String -> Person Source #

Constructor for a person using Western naming conventions. Used for a person with only a given name and surname. Arguments are in the order: given name, surname.

class HasName p Source #

Members of this class must have a name.

Minimal complete definition

nameStr

Instances

Instances details
HasName Person Source #

Gets the name of a Person. Adds a dot after any initials.

Instance details

Defined in Language.Drasil.People

fullName :: HasName n => n -> String Source #

Gets the name of a Person. Adds a dot after any initials.

person' :: String -> String -> Person Source #

Constructor for a person using Eastern naming conventions. Used for a person with only a given name and surname. Arguments are in the order: surname, given name.

personWM :: String -> [String] -> String -> Person Source #

Constructor for a person using Western naming conventions. Similar to the person constructor, except the middle argument is a list of middle names.

personWM' :: String -> [String] -> String -> Person Source #

Constructor for a person using Eastern naming conventions. Similar to the person' constructor, except the middle argument is a list of middle names.

mononym :: String -> Person Source #

Constructor for a person with a mononym (only one name).

nameStr :: HasName p => p -> String Source #

Provides the ability to hold a name.

rendPersLFM :: Person -> String Source #

Gets a Person's name in the form: Last, First Middle.

rendPersLFM' :: Person -> String Source #

Gets a Person's name in the form: Last, F. M.

rendPersLFM'' :: Person -> String Source #

Gets a Person's name in the form: Last, First M.

comparePeople :: [Person] -> [Person] -> Ordering Source #

Orderes different groups of Persons. If two lists are the same up to a point, the citation with more Persons will go last.

Sentences

Things like expressions and terms are displayed by using Sentences. We also use NounPhrases to record the proper pluralization and capitalization of terms.

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

SyCh :: forall t. (IsChunk t, Idea t, HasSpace t, HasSymbol t) => UIDRef t -> Sentence

A branch of Ch dedicated to SymbolStyle only.

Sy :: USymb -> Sentence

Converts a unit symbol into a usable Sentence form.

NP :: NP -> Sentence

Directly embeds a NP

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

FIXME: Attempting to convert this UID into a UIDRef creates a mess of a cyclic dependency between Reference, ShortName, and this file.

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
HasChunkRefs Sentence Source # 
Instance details

Defined in Language.Drasil.Sentence

Methods

chunkRefs :: Sentence -> Set UID #

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

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

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 

Instances

Instances details
HasChunkRefs RefInfo Source # 
Instance details

Defined in Language.Drasil.Sentence

Methods

chunkRefs :: RefInfo -> Set UID #

Generic RefInfo Source # 
Instance details

Defined in Language.Drasil.Sentence

Associated Types

type Rep RefInfo 
Instance details

Defined in Language.Drasil.Sentence

type Rep RefInfo = D1 ('MetaData "RefInfo" "Language.Drasil.Sentence" "drasil-lang-0.1.60.0-1HMwkmtaiHpDlCGzFv9lso" 'False) ((C1 ('MetaCons "None" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Equation" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [Int]))) :+: (C1 ('MetaCons "Page" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [Int])) :+: C1 ('MetaCons "RefNote" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 String))))

Methods

from :: RefInfo -> Rep RefInfo x #

to :: Rep RefInfo x -> RefInfo #

type Rep RefInfo Source # 
Instance details

Defined in Language.Drasil.Sentence

type Rep RefInfo = D1 ('MetaData "RefInfo" "Language.Drasil.Sentence" "drasil-lang-0.1.60.0-1HMwkmtaiHpDlCGzFv9lso" 'False) ((C1 ('MetaCons "None" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Equation" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [Int]))) :+: (C1 ('MetaCons "Page" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [Int])) :+: C1 ('MetaCons "RefNote" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 String))))

(+:+) :: 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.

ch :: (IsChunk t, Idea t, HasSpace t, HasSymbol t) => t -> 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.

fterms :: (NamedIdea c, NamedIdea d) => (NP -> NP -> t) -> c -> d -> t Source #

Apply a binary function to the terms of two named ideas, instead of to the named ideas themselves. Ex. fterms compoundPhrase t1 t2 instead of compoundPhrase (t1 ^. term) (t2 ^. term).

getTandS :: Quantity a => a -> Sentence Source #

Used when you want to say a term followed by its symbol. ex. "...using the Force F in...".

checkValidStr :: String -> String -> Either String String Source #

Uses an Either type to check if a String is valid - Left with error message if there is an invalid Char in String, else Right with String.

class NounPhrase n where Source #

Methods

phraseNP :: n -> NPStruct Source #

Retrieves singular form of term. Ex. "the quick brown fox".

pluralNP :: n -> PluralForm Source #

Retrieves plural form of term. Ex. "the quick brown foxes".

sentenceCase :: n -> (NP -> NPStruct) -> Capitalization Source #

Retrieves the singular form and applies a captalization rule (usually capitalizes the first word) to produce a 'NPStruct. Ex. "The quick brown fox".

titleCase :: n -> (NP -> NPStruct) -> Capitalization Source #

Retrieves the singular form and applies a captalization rule (usually capitalizes all words) to produce a 'NPStruct. Ex. "The Quick Brown Fox".

Instances

Instances details
NounPhrase NP Source #

Defines NP as a NounPhrase. Default capitalization rules for proper and common nouns are CapFirst for sentence case and CapWords for title case. Also accepts a Phrase where the capitalization case may be specified.

Instance details

Defined in Language.Drasil.NaturalLanguage.English.NounPhrase

Methods

phraseNP :: NP -> NPStruct Source #

pluralNP :: NP -> PluralForm Source #

sentenceCase :: NP -> (NP -> NPStruct) -> Capitalization Source #

titleCase :: NP -> (NP -> NPStruct) -> Capitalization Source #

data NP Source #

For nouns and NounPhrases. May be constructed from a proper noun, common noun, or phrase (Sentence) and their respective pluralization and capitalization rules.

Instances

Instances details
HasChunkRefs NP Source #

Gather the chunk references mentioned within an NP.

Instance details

Defined in Language.Drasil.NaturalLanguage.English.NounPhrase.Core

Methods

chunkRefs :: NP -> Set UID #

NounPhrase NP Source #

Defines NP as a NounPhrase. Default capitalization rules for proper and common nouns are CapFirst for sentence case and CapWords for title case. Also accepts a Phrase where the capitalization case may be specified.

Instance details

Defined in Language.Drasil.NaturalLanguage.English.NounPhrase

Methods

phraseNP :: NP -> NPStruct Source #

pluralNP :: NP -> PluralForm Source #

sentenceCase :: NP -> (NP -> NPStruct) -> Capitalization Source #

titleCase :: NP -> (NP -> NPStruct) -> Capitalization Source #

pn :: String -> NP Source #

Constructs a Proper Noun, it is always capitalized as written.

Self plural.

pn' :: String -> NP Source #

Constructs a Proper Noun, it is always capitalized as written.

Plural form simply adds "s" (ex. Henderson -> Hendersons).

pn'' :: String -> NP Source #

Constructs a Proper Noun, it is always capitalized as written.

Plural form adds "e".

pn''' :: String -> NP Source #

Constructs a Proper Noun, it is always capitalized as written.

Plural form adds "es" (ex. Bush -> Bushes).

pnIrr :: String -> PluralRule -> NP Source #

Constructs a ProperNoun with a custom plural rule (using IrregPlur from PluralRule). First argument is the String representing the noun, second is the rule.

cn :: String -> NP Source #

Constructs a common noun which capitalizes the first letter of the first word at the beginning of a sentence.

Self plural.

cn' :: String -> NP Source #

Constructs a common noun which capitalizes the first letter of the first word at the beginning of a sentence.

Plural form simply adds "s" (ex. dog -> dogs).

cn'' :: String -> NP Source #

Constructs a common noun which capitalizes the first letter of the first word at the beginning of a sentence.

Plural form adds "e" (ex. formula -> formulae).

cn''' :: String -> NP Source #

Constructs a common noun which capitalizes the first letter of the first word at the beginning of a sentence.

Plural form adds "es" (ex. bush -> bushes).

cnIP :: String -> PluralRule -> NP Source #

Constructs a common noun that allows you to specify the pluralization rule (as in pnIrr).

cnIrr :: String -> PluralRule -> CapitalizationRule -> NP Source #

Common noun that allows you to specify both the pluralization rule and the capitalization rule for sentence case (if the noun is used at the beginning of a sentence).

cnIES :: String -> NP Source #

Constructs a common noun that pluralizes by dropping the last letter and adding an "ies" ending (ex. body -> bodies).

cnICES :: String -> NP Source #

Construct a common noun that pluralizes by dropping the last two letters and adding an "ices" ending (ex. matrix -> matrices).

cnIS :: String -> NP Source #

Constructs a common noun that pluralizes by dropping the last two letters and adding "es" (ex. analysis -> analyses).

cnUM :: String -> NP Source #

Constructs a common noun that pluralizes by dropping the last two letters and adding "a" (ex. datum -> data).

nounPhrase :: String -> PluralString -> NP Source #

Creates a NP with a given singular and plural form (as Strings) that capitalizes the first letter of the first word for sentence case.

nounPhrase' :: String -> PluralString -> CapitalizationRule -> NP Source #

Similar to nounPhrase, but takes a specified capitalization rule for the sentence case.

data CapitalizationRule Source #

Capitalization rules.

Constructors

CapFirst

Capitalize the first letter of the first word only.

CapWords

Capitalize the first letter of each word.

Replace NPStruct

Replace the noun phrase with the given NPStruct. Used for custom capitalization.

CapNothing 

atStartNP :: NounPhrase n => n -> Capitalization Source #

Helper function for getting the sentence case of a noun phrase.

Singular sentence case.

atStartNP' :: NounPhrase n => n -> Capitalization Source #

Helper function for getting the sentence case of a noun phrase.

Plural sentence case.

data PluralRule Source #

Pluralization rules.

Constructors

AddS

Add "s" to the end of the noun phrase.

AddE

Add "e" to the end of the noun phrase.

AddES

Add "es" to the end of the noun phrase.

SelfPlur

The noun phrase is already plural.

IrregPlur (String -> String)

Apply the given function to the noun phrase to get the plural.

compoundPhrase :: (NounPhrase a, NounPhrase b) => a -> b -> NP Source #

Combine two noun phrases. The singular form becomes phrase from t1 followed by phrase of t2. The plural becomes phrase of t1 followed by plural of t2. Uses standard CapFirst sentence case and CapWords title case. For example: compoundPhrase system constraint will have singular form "system constraint" and plural "system constraints".

compoundPhrase' :: NP -> NP -> NP Source #

Similar to compoundPhrase, but the sentence case is the same as the title case (CapWords).

compoundPhrase'' :: (NP -> NPStruct) -> (NP -> NPStruct) -> NP -> NP -> NP Source #

Similar to compoundPhrase', but accepts two functions that will be used to construct the plural form. For example, compoundPhrase'' plural phrase system constraint would have the plural form "systems constraint".

compoundPhrase''' :: (NP -> NPStruct) -> NP -> NP -> NP Source #

Similar to compoundPhrase, but used when you need a special function applied to the first term of both singular and pluralcases (eg. short or plural).

compoundPhraseP1 :: NP -> NP -> NP Source #

Similar to compoundPhrase, but pluralizes the first NP for both singular and plural cases.

titleizeNP :: NounPhrase n => n -> Capitalization Source #

Helper function for getting the title case of a noun phrase.

Singular title case.

titleizeNP' :: NounPhrase n => n -> Capitalization Source #

Helper function for getting the title case of a noun phrase.

Plural title case.

nounPhrase'' :: NPStruct -> PluralForm -> CapitalizationRule -> CapitalizationRule -> NP Source #

Custom noun phrase constructor that takes a singular form ('NPStruct), plural form ('NPStruct), sentence case capitalization rule, and title case capitalization rule.

nounPhraseSP :: String -> NP Source #

For things that should not be pluralized (or are self-plural). Works like nounPhrase, but with only the first argument.

nounPhraseSent :: NPStruct -> NP Source #

Similar to nounPhrase, except it only accepts one 'NPStruct. Plural case is just AddS.

introduceAbb :: Idea n => n -> Sentence Source #

Introduce a noun phrase and its (parenthesized) abbreviation.

introduceAbbPlrl :: Idea n => n -> Sentence Source #

Introduce a plural noun phrase and its (parenthesized) abbreviation.

phrase :: NamedIdea n => n -> Sentence Source #

Helper for getting the phrase from a NamedIdea using it's UID.

plural :: NamedIdea n => n -> Sentence Source #

Helper for getting the plural of a phrase from a NamedIdea.

phrasePoss :: NamedIdea n => n -> Sentence Source #

Helper for getting the possesive cases from the term of a NamedIdea.

Singular possesive function

pluralPoss :: NamedIdea n => n -> Sentence Source #

Helper for getting the possesive cases from the term of a NamedIdea.

Plural possesive function

atStart :: NamedIdea n => n -> Sentence Source #

Helper function for getting the sentence case of a noun phrase from a NamedIdea.

Singular sentence case.

atStart' :: NamedIdea n => n -> Sentence Source #

Helper function for getting the sentence case of a noun phrase from a NamedIdea.

Plural sentence case.

titleize :: NamedIdea n => n -> Sentence Source #

Helper function for getting the title case of a noun phrase from a NamedIdea.

Singular title case.

titleize' :: NamedIdea n => n -> Sentence Source #

Helper function for getting the title case of a noun phrase from a NamedIdea.

Plural title case.

short :: Idea c => c -> Sentence Source #

Get short form (if it exists), else get term of an Idea. Uses the UID of the Idea in a Ch Sentence constructor to get the short form using getA. getA may return Nothing, in which case lookupS uses the term, where lookupS is the main helper for looking up the short form of a Ch Sentence.

Sentence Fold-type utilities.

From Utils.Drasil.Fold. Defines many general fold functions for use with Drasil-related types.

Folding Options as Types

data EnumType Source #

Type that helps determine enumeration method. Can use either numbers, uppercase letters, or lowercase letters.

Constructors

Numb 
Upper 
Lower 

data WrapType Source #

Type to help wrap a sentence with parenthesis or to add a period at the end.

Constructors

Parens 
Period 

data SepType Source #

Type to help separate words with commas or semicolons.

Constructors

Comma 
SemiCol 

data FoldType Source #

Type to help fold differently between listed items, or if there are options (ex. using "and" or "or" at the end of a list of words).

Constructors

List 
Options 

Folding functions

Sentence-related

foldlEnumList :: EnumType -> WrapType -> SepType -> FoldType -> [Sentence] -> Sentence Source #

Creates a list of elements with "enumerators" in "wrappers" using foldlList.

foldlList :: SepType -> FoldType -> [Sentence] -> Sentence Source #

Creates a list of elements separated by a "separator", ending with "and" or "or".

foldlSent :: [Sentence] -> Sentence Source #

Partial function application of foldle for sentences specifically. Folds with spaces and adds a period (".") at the end.

foldlSent_ :: [Sentence] -> Sentence Source #

foldlSent but does not add a period.

foldlSentCol :: [Sentence] -> Sentence Source #

foldlSent but ends with colon.

foldOpts :: [Sentence] -> Sentence Source #

Folds a list of elements separated forward slashes ("/").

foldNums :: String -> [Int] -> Sentence Source #

Parses a list of integers into a nice sentence (ie. S "1, 4-7, and 13").

numList :: String -> [Int] -> [String] Source #

Parses a list of integers into a list of strings (ie. ["1", "4-7", "13"]).

Symbols, Stages, Spaces

Used for rendering mathematical symbols in Drasil.

data Space Source #

The difference kinds of spaces that may exist. This type holds numerical spaces (such as the set of integers, rationals, etc.), a space for booleans, a space for characters, dimensional spaces (vectors, arrays, etc.), a space for Actors, discrete sets (both for numbers and strings), and a void space.

data RealInterval a b where Source #

A RealInterval is a subset of Real (as a Space). These come in different flavours. For now, we embed Expr for the bounds, but that will change as well.

Constructors

Bounded 

Fields

UpTo 

Fields

UpFrom 

Fields

data Inclusive Source #

Inclusive or exclusive bounds.

Constructors

Inc 
Exc 

data DomainDesc (tplgy :: RTopology) a b where Source #

Describes the domain of a Symbol given a topology. Can be bounded or encase all of the domain.

Constructors

BoundedDD :: forall a b. Symbol -> RTopology -> a -> b -> DomainDesc 'Discrete a b 
AllDD :: forall a b. Symbol -> RTopology -> DomainDesc 'Continuous a b 

data RTopology Source #

Topology of a subset of reals.

Constructors

Continuous 
Discrete 

getActorName :: Space -> String Source #

Gets the name of an Actor.

getInnerSpace :: Space -> Space Source #

Gets the inner Space of a vector or set.

data Decoration Source #

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

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)
  • Special characters (ex. unicode)
  • Decorated symbols using Atop
  • Concatenations of symbols, including subscripts and superscripts
  • Empty! (this is to give this a monoid-like flavour)

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 #

newtype USymb Source #

Language of units (how to build them up into a unit symbol). Of the form (Symbol ^ Integer). The Integer may be negative, but should not be zero.

Constructors

US [(Symbol, Integer)] 

Instances

Instances details
Eq USymb Source # 
Instance details

Defined in Language.Drasil.UnitLang

Methods

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

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

data Stage Source #

Stages are what part of the development process we are in. There are currently two: 1) The Equational stage (should be called Specification) 2) The Implemenation stage

The point is that information may be rendered differently depending at what stage we're at. Being able to talk about stages lets us also attach different display information.

Constructors

Equational 
Implementation 

Instances

Instances details
Show Stage Source #

For better error messages.

Instance details

Defined in Language.Drasil.Stages

Methods

showsPrec :: Int -> Stage -> ShowS #

show :: Stage -> String #

showList :: [Stage] -> ShowS #

eqSymb :: HasSymbol q => q -> Symbol Source #

Helper function for getting a symbol in the Equational Stage.

codeSymb :: HasSymbol q => q -> Symbol Source #

Helper function for getting a symbol in the Implementation Stage.

hasStageSymbol :: HasSymbol q => q -> Stage -> Bool Source #

Finds if a Stage symbol is real or Empty. True if real.

sortBySymbol :: HasSymbol a => [a] -> [a] Source #

Sorts a list of HasSymbols by Symbol.

sortBySymbolTuple :: HasSymbol a => [(a, b)] -> [(a, b)] Source #

Sorts a tuple list of HasSymbols by first Symbol in the tuple.

autoStage :: Symbol -> Stage -> Symbol Source #

Helper for creating a symbol with Unicode in it.

hat :: Symbol -> Symbol Source #

Helper for creating a symbol with a hat ("^") atop it.

prime :: Symbol -> Symbol Source #

Helper for creating a Vector symbol.

staged :: Symbol -> Symbol -> Stage -> Symbol Source #

Helper for creating a symbol that depends on the stage.

sub :: Symbol -> Symbol -> Symbol Source #

Helper for creating a symbol with a subscript to the right. Arguments: Base symbol, then subscripted symbol.

subStr :: Symbol -> String -> Symbol Source #

Helper for a common case of subscript, with a string Arguments: Base symbol, then subscript String.

sup :: Symbol -> Symbol -> Symbol Source #

Helper for creating a symbol with a superscript to the right. Arguments: Base symbol, then superscripted symbol.

unicodeConv :: Symbol -> Symbol Source #

Helper for autoStage that applies unicodeString to all Symbols with Strings.

upperLeft :: Symbol -> Symbol -> Symbol Source #

Helper for creating a symbol with a superscript on the left side of the symbol. Arguments: Base symbol, then superscripted symbol.

vec :: Symbol -> Symbol Source #

Helper for creating a Vector symbol.

label :: String -> Symbol Source #

Label smart constructor, requires non-empty labels

variable :: String -> Symbol Source #

Variable smart constructor, requires non-empty variables

Type Synonyms

type ConstQDef = QDefinition Literal Source #

Commonly used type for QDefinitions containing Literals.

type SimpleQDef = QDefinition Expr Source #

Commonly used type for QDefinitions containing Exprs.

type ModelQDef = QDefinition ModelExpr Source #

Commonly used type for QDefinitions containing ModelExprs.

type PExpr = forall r. (ExprC r, LiteralC r) => r Source #

Type systems

type TypingContext t = Map UID t Source #

We can only type check UIDs within a type context relating UIDs to types since they don't carry any type information.

inferFromContext :: TypingContext t -> UID -> Either TypeError t Source #

Look for a known type of a specific UID.

class (Eq t, Show t) => Typed e t where Source #

Build a bidirectional type checker for your expression language, e, with respect to a specific type universe, t.

Methods

infer :: TypingContext t -> e -> Either TypeError t Source #

Given a typing context and an expression, infer a unique type or explain what went awry.

check :: TypingContext t -> e -> t -> Either TypeError t Source #

Given a typing context, an expression, and an expected type, check if the expression can satisfy the expectation.

class Typed e t => RequiresChecking c e t where Source #

For all containers, c, which contain typed expressions, e, against a specific type universe, t, expose all expressions and relations that need to be type-checked.

Methods

requiredChecks :: c -> [(e, t)] Source #

All things that need type checking.

Instances

Instances details
RequiresChecking (QDefinition Expr) Expr Space Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

temporaryIndent :: String -> String -> String Source #

A temporary, hacky, indentation function. It should be removed when we switch to using something else for error messages, which can be later formatted nicely.