Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
The Drasil language, including expressions, chunks, sentences, references, classes, datatypes, and generally useful functions. Re-exports modules to simplify external use.
Synopsis
- data Expr
- class ExprC r where
- lit :: Literal -> r
- ($=), ($!=) :: r -> r -> r
- ($<), ($>), ($<=), ($>=) :: r -> r -> r
- ($.) :: r -> r -> r
- addI :: r -> r -> r
- addRe :: r -> r -> r
- mulI :: r -> r -> r
- mulRe :: r -> r -> r
- ($-), ($/), ($^) :: r -> r -> r
- ($=>), ($<=>) :: r -> r -> r
- ($&&), ($||) :: r -> r -> r
- abs_ :: r -> r
- neg :: r -> r
- log :: r -> r
- ln :: r -> r
- sqrt :: r -> r
- sin :: r -> r
- cos :: r -> r
- tan :: r -> r
- sec :: r -> r
- csc :: r -> r
- cot :: r -> r
- arcsin :: r -> r
- arccos :: r -> r
- arctan :: r -> r
- exp :: r -> r
- dim :: r -> r
- norm :: r -> r
- negVec :: r -> r
- not_ :: r -> r
- idx :: r -> r -> r
- defint, defsum, defprod :: Symbol -> r -> r -> r -> r
- realInterval :: HasUID c => c -> RealInterval r r -> r
- euclidean :: [r] -> r
- cross :: r -> r -> r
- vScale :: r -> r -> r
- vAdd :: r -> r -> r
- vSub :: r -> r -> r
- completeCase :: [(r, r)] -> r
- incompleteCase :: [(r, r)] -> r
- matrix :: [[r]] -> r
- apply :: (HasUID f, HasSymbol f) => f -> [r] -> r
- sy :: (HasUID c, HasSymbol c) => c -> r
- frac :: (ExprC r, LiteralC r) => Integer -> Integer -> r
- recip_ :: (ExprC r, LiteralC r) => r -> r
- square :: (ExprC r, LiteralC r) => r -> r
- half :: (ExprC r, LiteralC r) => r -> r
- oneHalf :: (ExprC r, LiteralC r) => r
- oneThird :: (ExprC r, LiteralC r) => r
- apply1 :: (ExprC r, HasUID f, HasSymbol f, HasUID a, HasSymbol a) => f -> a -> r
- apply2 :: (ExprC r, HasUID f, HasSymbol f, HasUID a, HasSymbol a, HasUID b, HasSymbol b) => f -> a -> b -> r
- m2x2 :: ExprC r => r -> r -> r -> r -> r
- vec2D :: ExprC r => r -> r -> r
- dgnl2x2 :: (ExprC r, LiteralC r) => r -> r -> r
- rowVec :: ExprC r => [r] -> r
- columnVec :: ExprC r => [r] -> r
- data Completeness
- type Relation = Expr
- data Literal
- class LiteralC r where
- data ModelExpr
- data DerivType
- class ModelExprC r where
- data CodeExpr
- class CodeExprC r where
- new :: (Callable f, HasUID f, CodeIdea f) => f -> [r] -> r
- newWithNamedArgs :: (Callable f, HasUID f, CodeIdea f, HasUID a, IsArgumentName a) => f -> [r] -> [(a, r)] -> r
- msg :: (Callable f, HasUID f, CodeIdea f, HasUID c, HasSpace c, CodeIdea c) => c -> f -> [r] -> r
- msgWithNamedArgs :: (Callable f, HasUID f, CodeIdea f, HasUID c, HasSpace c, CodeIdea c, HasUID a, IsArgumentName a) => c -> f -> [r] -> [(a, r)] -> r
- field :: CodeVarChunk -> CodeVarChunk -> r
- applyWithNamedArgs :: (HasUID f, HasSymbol f, HasUID a, IsArgumentName a) => f -> [r] -> [(a, r)] -> r
- data Special = Circle
- class RenderSpecial r where
- class HasUID c where
- class HasSymbol c where
- class HasUID c => NamedIdea c where
- class NamedIdea c => Idea c where
- class NamedIdea c => CommonIdea c where
- class Definition c where
- class ConceptDomain c where
- type Concept c = (Idea c, Definition c, ConceptDomain c)
- class HasSpace c where
- class HasUnitSymbol u where
- class (Idea c, HasSpace c, HasSymbol c) => Quantity c
- class HasReasVal c where
- class Constrained c where
- constraints :: Lens' c [ConstraintE]
- class HasAdditionalNotes c where
- class MayHaveDerivation c where
- derivations :: Lens' c (Maybe Derivation)
- class (Idea u, Definition u, HasUnitSymbol u) => IsUnit u where
- class DefiningExpr c where
- defnExpr :: Lens' (c e) e
- class Express c where
- class HasRefAddress b where
- class (HasUID s, HasRefAddress s) => Referable s where
- class HasReference c where
- getReferences :: Lens' c [Reference]
- class HasSymbol c => Callable c
- class HasSymbol c => IsArgumentName c
- data UID
- mkUid :: String -> UID
- nsUid :: String -> UID -> UID
- (+++) :: HasUID a => a -> String -> UID
- (+++.) :: UID -> String -> UID
- (+++!) :: (HasUID a, HasUID b) => a -> b -> UID
- nc :: String -> NP -> IdeaDict
- ncUID :: UID -> NP -> IdeaDict
- data IdeaDict
- mkIdea :: String -> NP -> Maybe String -> IdeaDict
- nw :: Idea c => c -> IdeaDict
- class CodeIdea c where
- data CodeChunk = CodeC {
- _qc :: QuantityDict
- kind :: VarOrFunc
- data CodeVarChunk = CodeVC {}
- newtype CodeFuncChunk = CodeFC {}
- data VarOrFunc
- obv :: Lens' CodeVarChunk (Maybe CodeChunk)
- qc :: Lens' CodeChunk QuantityDict
- ccf :: Iso' CodeFuncChunk CodeChunk
- ccv :: Lens' CodeVarChunk CodeChunk
- listToArray :: CodeVarChunk -> CodeVarChunk
- programName :: CommonIdea c => c -> String
- funcPrefix :: String
- class CodeIdea c => DefiningCodeExpr c where
- data CI
- commonIdea :: String -> NP -> String -> [UID] -> CI
- getAcc :: CI -> Sentence
- commonIdeaWithDict :: String -> NP -> String -> [IdeaDict] -> CI
- prependAbrv :: CommonIdea c => c -> String -> String
- data ConceptChunk
- data ConceptInstance
- sDom :: [UID] -> UID
- dcc :: String -> NP -> String -> ConceptChunk
- dccWDS :: String -> NP -> Sentence -> ConceptChunk
- cc :: Idea c => c -> String -> ConceptChunk
- cc' :: Idea c => c -> Sentence -> ConceptChunk
- ccs :: (Idea c, Concept d) => c -> Sentence -> [d] -> ConceptChunk
- cw :: Concept c => c -> ConceptChunk
- cic :: Concept c => String -> Sentence -> String -> c -> ConceptInstance
- data RelationConcept
- makeRC :: Express e => String -> NP -> Sentence -> e -> RelationConcept
- addRelToCC :: (Express e, Concept c) => c -> String -> e -> RelationConcept
- data DifferentialModel = SystemOfLinearODEs {
- _indepVar :: UnitalChunk
- _depVar :: ConstrConcept
- _coefficients :: [[Expr]]
- _unknowns :: [Unknown]
- _dmConstants :: [Expr]
- _dmconc :: ConceptChunk
- data ODESolverFormat = X' {
- coeffVects :: [[Expr]]
- unknownVect :: [Integer]
- constantVect :: [Expr]
- data InitialValueProblem = IVP {}
- ($^^) :: ConstrConcept -> Integer -> Unknown
- ($*) :: Expr -> Unknown -> Term
- ($+) :: [Term] -> Term -> LHS
- makeAODESolverFormat :: DifferentialModel -> ODESolverFormat
- makeAIVP :: Expr -> Expr -> [Expr] -> InitialValueProblem
- formEquations :: [[Expr]] -> [Unknown] -> [Expr] -> ConstrConcept -> [Expr]
- makeASystemDE :: UnitalChunk -> ConstrConcept -> [[Expr]] -> [Unknown] -> [Expr] -> String -> NP -> Sentence -> DifferentialModel
- makeASingleDE :: UnitalChunk -> ConstrConcept -> LHS -> Expr -> String -> NP -> Sentence -> DifferentialModel
- data QuantityDict
- class DefinesQuantity d where
- defLhs :: Getter d QuantityDict
- qw :: (Quantity q, MayHaveUnit q) => q -> QuantityDict
- mkQuant :: String -> NP -> Symbol -> Space -> Maybe UnitDefn -> Maybe String -> QuantityDict
- mkQuant' :: String -> NP -> Maybe String -> Space -> (Stage -> Symbol) -> Maybe UnitDefn -> QuantityDict
- codeVC :: Idea c => c -> Symbol -> Space -> QuantityDict
- implVar :: String -> NP -> Space -> Symbol -> QuantityDict
- implVar' :: String -> NP -> Maybe String -> Space -> Symbol -> Maybe UnitDefn -> QuantityDict
- implVarUID :: UID -> NP -> Space -> Symbol -> QuantityDict
- implVarUID' :: UID -> NP -> Maybe String -> Space -> Symbol -> Maybe UnitDefn -> QuantityDict
- vc :: String -> NP -> Symbol -> Space -> QuantityDict
- vc'' :: Idea c => c -> Symbol -> Space -> QuantityDict
- vcSt :: String -> NP -> (Stage -> Symbol) -> Space -> QuantityDict
- vcUnit :: String -> NP -> Symbol -> Space -> UnitDefn -> QuantityDict
- data QDefinition e
- fromEqn :: IsUnit u => String -> NP -> Sentence -> Symbol -> Space -> u -> e -> QDefinition e
- fromEqn' :: String -> NP -> Sentence -> Symbol -> Space -> e -> QDefinition e
- fromEqnSt :: IsUnit u => UID -> NP -> Sentence -> (Stage -> Symbol) -> Space -> u -> e -> QDefinition e
- fromEqnSt' :: UID -> NP -> Sentence -> (Stage -> Symbol) -> Space -> e -> QDefinition e
- fromEqnSt'' :: String -> NP -> Sentence -> (Stage -> Symbol) -> Space -> e -> QDefinition e
- mkQDefSt :: UID -> NP -> Sentence -> (Stage -> Symbol) -> Space -> Maybe UnitDefn -> e -> QDefinition e
- mkQuantDef :: (Quantity c, MayHaveUnit c) => c -> e -> QDefinition e
- mkQuantDef' :: (Quantity c, MayHaveUnit c) => c -> NP -> e -> QDefinition e
- ec :: (Quantity c, MayHaveUnit c) => c -> e -> QDefinition e
- mkFuncDef :: (HasUID f, HasSymbol f, HasSpace f, HasUID i, HasSymbol i, HasSpace i, IsUnit u) => f -> NP -> Sentence -> u -> [i] -> e -> QDefinition e
- mkFuncDef' :: (HasUID f, HasSymbol f, HasSpace f, HasUID i, HasSymbol i, HasSpace i) => f -> NP -> Sentence -> [i] -> e -> QDefinition e
- mkFuncDefByQ :: (Quantity c, MayHaveUnit c, HasSpace c, Quantity i, HasSpace i) => c -> [i] -> e -> QDefinition e
- class Quantity c => Unitary c where
- data UnitaryChunk
- unitary :: IsUnit u => String -> NP -> Symbol -> u -> Space -> UnitaryChunk
- unitary' :: IsUnit u => String -> NP -> (Stage -> Symbol) -> u -> Space -> UnitaryChunk
- mkUnitary :: (Unitary u, MayHaveUnit u) => u -> UnitaryChunk
- unit_symb :: Unitary c => c -> USymb
- data DefinedQuantityDict
- dqd :: IsUnit u => ConceptChunk -> Symbol -> Space -> u -> DefinedQuantityDict
- dqd' :: ConceptChunk -> (Stage -> Symbol) -> Space -> Maybe UnitDefn -> DefinedQuantityDict
- dqdNoUnit :: ConceptChunk -> Symbol -> Space -> DefinedQuantityDict
- dqdQd :: (Quantity c, MayHaveUnit c) => c -> ConceptChunk -> DefinedQuantityDict
- dqdWr :: (Quantity c, Concept c, MayHaveUnit c) => c -> DefinedQuantityDict
- data UnitalChunk = UC {}
- uc :: (Concept c, IsUnit u) => c -> Symbol -> Space -> u -> UnitalChunk
- uc' :: IsUnit u => String -> NP -> Sentence -> Symbol -> Space -> u -> UnitalChunk
- ucStaged :: (Concept c, IsUnit u) => c -> (Stage -> Symbol) -> Space -> u -> UnitalChunk
- ucStaged' :: IsUnit u => String -> NP -> Sentence -> (Stage -> Symbol) -> Space -> u -> UnitalChunk
- ucuc :: (Quantity c, Concept c, MayHaveUnit c) => c -> UnitDefn -> UnitalChunk
- ucw :: (Unitary c, Concept c, MayHaveUnit c) => c -> UnitalChunk
- data UnitDefn = UD {
- _vc :: ConceptChunk
- _cas :: UnitSymbol
- _cu :: [UID]
- fromUDefn :: UDefn -> USymb
- unitCon :: String -> ConceptChunk
- makeDerU :: ConceptChunk -> UnitEquation -> UnitDefn
- (^:) :: UnitDefn -> Integer -> UnitEquation
- (/:) :: UnitDefn -> UnitDefn -> UnitEquation
- (*:) :: UnitDefn -> UnitDefn -> UnitEquation
- (*$) :: UnitDefn -> UnitEquation -> UnitEquation
- (/$) :: UnitDefn -> UnitEquation -> UnitEquation
- (^$) :: UnitEquation -> UnitEquation -> UnitEquation
- newUnit :: String -> UnitEquation -> UnitDefn
- scale :: IsUnit s => Double -> s -> UDefn
- shift :: IsUnit s => Double -> s -> UDefn
- derUC :: String -> String -> String -> Symbol -> UDefn -> UnitDefn
- derUC' :: String -> String -> String -> Symbol -> UDefn -> UnitDefn
- derUC'' :: String -> NP -> String -> Symbol -> UDefn -> UnitDefn
- fund :: String -> String -> String -> UnitDefn
- fund' :: String -> String -> Symbol -> UnitDefn
- compUnitDefn :: UnitDefn -> UnitDefn -> Ordering
- derCUC :: String -> String -> String -> Symbol -> UnitEquation -> UnitDefn
- derCUC' :: String -> String -> String -> Symbol -> UnitEquation -> UnitDefn
- derCUC'' :: String -> NP -> String -> Symbol -> UnitEquation -> UnitDefn
- unitWrapper :: IsUnit u => u -> UnitDefn
- getCu :: UnitEquation -> [UID]
- class MayHaveUnit u where
- data ConstraintReason
- data Constraint a where
- Range :: ConstraintReason -> RealInterval a a -> Constraint a
- type ConstraintE = Constraint Expr
- physc :: RealInterval Expr Expr -> ConstraintE
- sfwrc :: RealInterval Expr Expr -> ConstraintE
- isPhysC :: Constraint e -> Bool
- isSfwrC :: Constraint e -> Bool
- data ConstrainedChunk = ConstrainedChunk {
- _qd :: QuantityDict
- _constr :: [ConstraintE]
- _reasV :: Maybe Expr
- data ConstrConcept = ConstrConcept {
- _defq :: DefinedQuantityDict
- _constr' :: [ConstraintE]
- _reasV' :: Maybe Expr
- cuc :: IsUnit u => String -> NP -> Symbol -> u -> Space -> [ConstraintE] -> Expr -> ConstrainedChunk
- cvc :: String -> NP -> Symbol -> Space -> [ConstraintE] -> Maybe Expr -> ConstrainedChunk
- constrained' :: (Concept c, MayHaveUnit c, Quantity c) => c -> [ConstraintE] -> Expr -> ConstrConcept
- cuc' :: IsUnit u => String -> NP -> String -> Symbol -> u -> Space -> [ConstraintE] -> Expr -> ConstrConcept
- cuc'' :: IsUnit u => String -> NP -> String -> (Stage -> Symbol) -> u -> Space -> [ConstraintE] -> Expr -> ConstrConcept
- constrainedNRV' :: (Concept c, MayHaveUnit c, Quantity c) => c -> [ConstraintE] -> ConstrConcept
- cnstrw :: (Quantity c, Constrained c, HasReasVal c, MayHaveUnit c) => c -> ConstrainedChunk
- cnstrw' :: (Quantity c, Concept c, Constrained c, HasReasVal c, MayHaveUnit c) => c -> ConstrConcept
- data UncertainChunk = UCh {}
- data UncertQ
- uq :: (Quantity c, Constrained c, Concept c, HasReasVal c, MayHaveUnit c) => c -> Uncertainty -> UncertQ
- uqc :: IsUnit u => String -> NP -> String -> Symbol -> u -> Space -> [ConstraintE] -> Expr -> Uncertainty -> UncertQ
- uqcND :: IsUnit u => String -> NP -> Symbol -> u -> Space -> [ConstraintE] -> Expr -> Uncertainty -> UncertQ
- uncrtnChunk :: (Quantity c, Constrained c, HasReasVal c, MayHaveUnit c) => c -> Uncertainty -> UncertainChunk
- uvc :: String -> NP -> Symbol -> Space -> [ConstraintE] -> Expr -> Uncertainty -> UncertainChunk
- uncrtnw :: (HasUncertainty c, Quantity c, Constrained c, HasReasVal c, MayHaveUnit c) => c -> UncertainChunk
- data Uncertainty
- uncty :: Double -> Maybe Int -> Uncertainty
- class HasUncertainty c where
- unc :: Lens' c Uncertainty
- defaultUncrt :: Uncertainty
- uncVal :: HasUncertainty x => x -> Double
- uncPrec :: HasUncertainty x => x -> Maybe Int
- exact :: Uncertainty
- getAdd :: LblType -> String
- prepend :: String -> IRefProg
- data LblType
- data IRefProg
- data Reference = Reference UID LblType ShortName
- ref :: (HasUID r, HasRefAddress r, HasShortName r) => r -> Reference
- refS :: (HasUID r, HasRefAddress r, HasShortName r) => r -> Sentence
- namedRef :: (HasUID r, HasRefAddress r, HasShortName r) => r -> Sentence -> Sentence
- complexRef :: (HasUID r, HasRefAddress r, HasShortName r) => r -> RefInfo -> Sentence
- namedComplexRef :: (HasUID r, HasRefAddress r, HasShortName r) => r -> Sentence -> RefInfo -> Sentence
- data DecRef
- dRefInfo :: (HasUID r, HasRefAddress r, HasShortName r) => r -> RefInfo -> DecRef
- dRef :: (HasUID r, HasRefAddress r, HasShortName r) => r -> DecRef
- class HasDecRef c where
- getDecRefs :: Lens' c [DecRef]
- type EntryID = String
- data Citation
- type BibRef = [Citation]
- class HasCitation c where
- getCitations :: Lens' c [Citation]
- class HasFields c where
- citeID :: Lens' Citation UID
- citeKind :: Lens' Citation CitationKind
- cArticle :: People -> String -> String -> Int -> [CiteField] -> String -> Citation
- cBookA :: People -> String -> String -> Int -> [CiteField] -> String -> Citation
- cBookE :: People -> String -> String -> Int -> [CiteField] -> String -> Citation
- cBooklet :: String -> [CiteField] -> String -> Citation
- cInBookACP :: People -> String -> Int -> [Int] -> String -> Int -> [CiteField] -> String -> Citation
- cInBookECP :: People -> String -> Int -> [Int] -> String -> Int -> [CiteField] -> String -> Citation
- cInBookAC :: People -> String -> Int -> String -> Int -> [CiteField] -> String -> Citation
- cInBookEC :: People -> String -> Int -> String -> Int -> [CiteField] -> String -> Citation
- cInBookAP :: People -> String -> [Int] -> String -> Int -> [CiteField] -> String -> Citation
- cInBookEP :: People -> String -> [Int] -> String -> Int -> [CiteField] -> String -> Citation
- cInCollection :: People -> String -> String -> String -> Int -> [CiteField] -> String -> Citation
- cInProceedings :: People -> String -> String -> Int -> [CiteField] -> String -> Citation
- cManual :: String -> [CiteField] -> String -> Citation
- cMThesis :: People -> String -> String -> Int -> [CiteField] -> String -> Citation
- cMisc :: [CiteField] -> String -> Citation
- cPhDThesis :: People -> String -> String -> Int -> [CiteField] -> String -> Citation
- cProceedings :: String -> Int -> [CiteField] -> String -> Citation
- cTechReport :: People -> String -> String -> Int -> [CiteField] -> String -> Citation
- cUnpublished :: People -> String -> String -> [CiteField] -> String -> Citation
- data Month
- data CiteField
- = Address String
- | Author People
- | BookTitle String
- | Chapter Int
- | Edition Int
- | Editor People
- | HowPublished HP
- | Institution String
- | Journal String
- | Month Month
- | Note String
- | Number Int
- | Organization String
- | Pages [Int]
- | Publisher String
- | School String
- | Series String
- | Title String
- | Type String
- | Volume Int
- | Year Int
- data HP
- data CitationKind
- author :: People -> CiteField
- editor :: People -> CiteField
- address :: String -> CiteField
- bookTitle :: String -> CiteField
- howPublished :: String -> CiteField
- howPublishedU :: String -> CiteField
- institution :: String -> CiteField
- journal :: String -> CiteField
- note :: String -> CiteField
- organization :: String -> CiteField
- publisher :: String -> CiteField
- school :: String -> CiteField
- series :: String -> CiteField
- title :: String -> CiteField
- typeField :: String -> CiteField
- chapter :: Int -> CiteField
- edition :: Int -> CiteField
- number :: Int -> CiteField
- volume :: Int -> CiteField
- year :: Int -> CiteField
- pages :: [Int] -> CiteField
- month :: Month -> CiteField
- type People = [Person]
- data Person
- person :: String -> String -> Person
- class HasName p
- name :: HasName n => n -> String
- person' :: String -> String -> Person
- personWM :: String -> [String] -> String -> Person
- personWM' :: String -> [String] -> String -> Person
- mononym :: String -> Person
- nameStr :: HasName p => p -> String
- rendPersLFM :: Person -> String
- rendPersLFM' :: Person -> String
- rendPersLFM'' :: Person -> String
- comparePeople :: [Person] -> [Person] -> Ordering
- data Sentence where
- Ch :: SentenceStyle -> TermCapitalization -> UID -> Sentence
- SyCh :: UID -> Sentence
- Sy :: USymb -> Sentence
- S :: String -> Sentence
- P :: Symbol -> Sentence
- E :: ModelExpr -> Sentence
- Ref :: UID -> Sentence -> RefInfo -> Sentence
- Quote :: Sentence -> Sentence
- Percent :: Sentence
- (:+:) :: Sentence -> Sentence -> Sentence
- EmptyS :: Sentence
- data SentenceStyle
- data TermCapitalization
- data RefInfo
- (+:+) :: Sentence -> Sentence -> Sentence
- (+:+.) :: Sentence -> Sentence -> Sentence
- (+:) :: Sentence -> Sentence -> Sentence
- (!.) :: Sentence -> Sentence
- capSent :: Sentence -> Sentence
- headSent :: Int -> Sentence -> Sentence
- ch :: (HasUID c, HasSymbol c) => c -> Sentence
- eS :: ModelExpr -> Sentence
- eS' :: Express t => t -> Sentence
- sC :: Sentence -> Sentence -> Sentence
- sDash :: Sentence -> Sentence -> Sentence
- sParen :: Sentence -> Sentence
- class NounPhrase n where
- data NP
- pn :: String -> NP
- pn' :: String -> NP
- pn'' :: String -> NP
- pn''' :: String -> NP
- pnIrr :: String -> PluralRule -> NP
- cn :: String -> NP
- cn' :: String -> NP
- cn'' :: String -> NP
- cn''' :: String -> NP
- cnIP :: String -> PluralRule -> NP
- cnIrr :: String -> PluralRule -> CapitalizationRule -> NP
- cnIES :: String -> NP
- cnICES :: String -> NP
- cnIS :: String -> NP
- cnUM :: String -> NP
- nounPhrase :: String -> PluralString -> NP
- nounPhrase' :: String -> PluralString -> CapitalizationRule -> NP
- data CapitalizationRule
- atStartNP :: NounPhrase n => n -> Capitalization
- atStartNP' :: NounPhrase n => n -> Capitalization
- data PluralRule
- compoundPhrase :: (NounPhrase a, NounPhrase b) => a -> b -> NP
- compoundPhrase' :: NP -> NP -> NP
- compoundPhrase'' :: (NP -> Sentence) -> (NP -> Sentence) -> NP -> NP -> NP
- compoundPhrase''' :: (NP -> Sentence) -> NP -> NP -> NP
- compoundPhraseP1 :: NP -> NP -> NP
- titleizeNP :: NounPhrase n => n -> Capitalization
- titleizeNP' :: NounPhrase n => n -> Capitalization
- nounPhrase'' :: Sentence -> PluralForm -> CapitalizationRule -> CapitalizationRule -> NP
- nounPhraseSP :: String -> NP
- nounPhraseSent :: Sentence -> NP
- introduceAbb :: Idea n => n -> Sentence
- phrase :: NamedIdea n => n -> Sentence
- plural :: NamedIdea n => n -> Sentence
- phrasePoss :: NamedIdea n => n -> Sentence
- pluralPoss :: NamedIdea n => n -> Sentence
- atStart :: NamedIdea n => n -> Sentence
- atStart' :: NamedIdea n => n -> Sentence
- titleize :: NamedIdea n => n -> Sentence
- titleize' :: NamedIdea n => n -> Sentence
- short :: Idea c => c -> Sentence
- data ShortName
- shortname' :: Sentence -> ShortName
- getSentSN :: ShortName -> Sentence
- class HasShortName s where
- data Derivation = Derivation Sentence [Sentence]
- mkDeriv :: Sentence -> [Sentence] -> Derivation
- mkDerivName :: Sentence -> [Sentence] -> Derivation
- mkDerivNoHeader :: [Sentence] -> Derivation
- data EnumType
- data WrapType
- data SepType
- data FoldType
- foldConstraints :: Quantity c => c -> [ConstraintE] -> Sentence
- foldlEnumList :: EnumType -> WrapType -> SepType -> FoldType -> [Sentence] -> Sentence
- foldlList :: SepType -> FoldType -> [Sentence] -> Sentence
- foldlSP :: [Sentence] -> Contents
- foldlSP_ :: [Sentence] -> Contents
- foldlSPCol :: [Sentence] -> Contents
- foldlSent :: [Sentence] -> Sentence
- foldlSent_ :: [Sentence] -> Sentence
- foldlSentCol :: [Sentence] -> Sentence
- foldlsC :: [Sentence] -> Sentence
- foldNums :: String -> [Int] -> Sentence
- numList :: String -> [Int] -> [String]
- data Document
- = Document Title Author ShowTableOfContents [Section]
- | Notebook Title Author [Section]
- data ShowTableOfContents
- data DType
- data Section = Section {}
- data Contents
- data SecCons
- data ListType
- data ItemType
- type ListTuple = (Title, ItemType, Maybe String)
- data LabelledContent = LblC {
- _ref :: Reference
- _ctype :: RawContent
- newtype UnlabelledContent = UnlblC {}
- extractSection :: Document -> [Section]
- mkParagraph :: Sentence -> Contents
- mkRawLC :: RawContent -> Reference -> LabelledContent
- checkToC :: Document -> Document
- llcc :: Reference -> RawContent -> LabelledContent
- ulcc :: RawContent -> UnlabelledContent
- section :: Sentence -> [Contents] -> [Section] -> Reference -> Section
- fig :: Lbl -> Filepath -> RawContent
- figWithWidth :: Lbl -> Filepath -> MaxWidthPercent -> RawContent
- type MaxWidthPercent = Float
- class HasContents c where
- accessContents :: Lens' c RawContent
- data RawContent
- = Table [Sentence] [[Sentence]] Title Bool
- | Paragraph Sentence
- | EqnBlock ModelExpr
- | DerivBlock Sentence [RawContent]
- | Enumeration ListType
- | Defini DType [(Identifier, [Contents])]
- | Figure Lbl Filepath MaxWidthPercent
- | Bib BibRef
- | Graph [(Sentence, Sentence)] (Maybe Width) (Maybe Height) Lbl
- | CodeBlock CodeExpr
- mkFig :: Reference -> RawContent -> Contents
- makeTabRef :: String -> Reference
- makeFigRef :: String -> Reference
- makeSecRef :: String -> Sentence -> Reference
- makeEqnRef :: String -> Reference
- makeURI :: String -> String -> ShortName -> Reference
- makeTabRef' :: UID -> Reference
- makeFigRef' :: UID -> Reference
- makeSecRef' :: UID -> Sentence -> Reference
- makeEqnRef' :: UID -> Reference
- makeURI' :: UID -> String -> ShortName -> Reference
- enumBullet :: Reference -> [Sentence] -> LabelledContent
- enumBulletU :: [Sentence] -> Contents
- enumSimple :: Reference -> Integer -> Sentence -> [Sentence] -> LabelledContent
- enumSimpleU :: Integer -> Sentence -> [Sentence] -> Contents
- mkEnumSimpleD :: (Referable c, HasShortName c, Definition c) => [c] -> [Contents]
- lbldExpr :: ModelExpr -> Reference -> LabelledContent
- unlbldExpr :: ModelExpr -> Contents
- unlbldCode :: CodeExpr -> Contents
- chgsStart :: (HasShortName x, Referable x) => x -> Sentence -> Sentence
- definedIn :: (Referable r, HasShortName r, DefinesQuantity r) => r -> Sentence
- definedIn' :: (Referable r, HasShortName r, DefinesQuantity r) => r -> Sentence -> Sentence
- definedIn'' :: (Referable r, HasShortName r) => r -> Sentence
- definedIn''' :: (HasSymbol q, HasUID q, Referable r, HasShortName r) => q -> r -> Sentence
- eqnWSource :: (Referable r, HasShortName r) => ModelExpr -> r -> Sentence
- fromReplace :: (Referable r, HasShortName r) => r -> UnitalChunk -> Sentence
- fromSource :: (Referable r, HasShortName r) => r -> Sentence
- fromSources :: (Referable r, HasShortName r) => [r] -> Sentence
- fmtU :: MayHaveUnit a => Sentence -> a -> Sentence
- follows :: (Referable r, HasShortName r) => Sentence -> r -> Sentence
- makeListRef :: [a] -> Section -> [Sentence]
- addPercent :: Show a => a -> Sentence
- displayStrConstrntsAsSet :: Quantity a => a -> [String] -> Sentence
- displayDblConstrntsAsSet :: Quantity a => a -> [Double] -> Sentence
- eqN :: Int -> Sentence
- checkValidStr :: String -> String -> Either String String
- getTandS :: Quantity a => a -> Sentence
- maybeChanged :: Sentence -> Sentence -> Sentence
- maybeExpanded :: Sentence -> Sentence -> Sentence
- maybeWOVerb :: Sentence -> Sentence -> Sentence
- showingCxnBw :: NamedIdea c => c -> Sentence -> Sentence
- substitute :: (Referable r, HasShortName r, DefinesQuantity r) => [r] -> Sentence
- typUncr :: HasUncertainty c => c -> Sentence
- underConsidertn :: ConceptChunk -> Sentence
- unwrap :: Maybe UnitDefn -> Sentence
- fterms :: (NamedIdea c, NamedIdea d) => (NP -> NP -> t) -> c -> d -> t
- bulletFlat :: [Sentence] -> ListType
- bulletNested :: [Sentence] -> [ListType] -> ListType
- itemRefToSent :: String -> Sentence -> Sentence
- makeTMatrix :: Eq a => [Sentence] -> [[a]] -> [a] -> [[Sentence]]
- mkEnumAbbrevList :: Integer -> Sentence -> [Sentence] -> [(Sentence, ItemType)]
- mkTableFromColumns :: [(Sentence, [Sentence])] -> ([Sentence], [[Sentence]])
- noRefs :: [ItemType] -> [(ItemType, Maybe String)]
- refineChain :: NamedIdea c => [(c, Section)] -> Sentence
- sortBySymbol :: HasSymbol a => [a] -> [a]
- sortBySymbolTuple :: HasSymbol a => [(a, b)] -> [(a, b)]
- tAndDOnly :: Concept s => s -> ItemType
- tAndDWAcc :: Concept s => s -> ItemType
- tAndDWSym :: (Concept s, Quantity a) => s -> a -> ItemType
- zipSentList :: [[Sentence]] -> [Sentence] -> [[Sentence]] -> [[Sentence]]
- data Space
- data RealInterval a b where
- Bounded :: (Inclusive, a) -> (Inclusive, b) -> RealInterval a b
- UpTo :: (Inclusive, a) -> RealInterval a b
- UpFrom :: (Inclusive, b) -> RealInterval a b
- data Inclusive
- data DomainDesc (tplgy :: RTopology) a b where
- BoundedDD :: Symbol -> RTopology -> a -> b -> DomainDesc 'Discrete a b
- AllDD :: Symbol -> RTopology -> DomainDesc 'Continuous a b
- data RTopology
- type ContinuousDomainDesc a b = DomainDesc 'Continuous a b
- type DiscreteDomainDesc a b = DomainDesc 'Discrete a b
- getActorName :: Space -> String
- getInnerSpace :: Space -> Space
- mkFunction :: [Primitive] -> Primitive -> Space
- type Primitive = Space
- data Decoration
- data Symbol
- newtype USymb = US [(Symbol, Integer)]
- mkTable :: [a -> b] -> [a] -> [[b]]
- data Stage
- eqSymb :: HasSymbol q => q -> Symbol
- codeSymb :: HasSymbol q => q -> Symbol
- hasStageSymbol :: HasSymbol q => q -> Stage -> Bool
- autoStage :: Symbol -> Stage -> Symbol
- hat :: Symbol -> Symbol
- prime :: Symbol -> Symbol
- staged :: Symbol -> Symbol -> Stage -> Symbol
- sub :: Symbol -> Symbol -> Symbol
- subStr :: Symbol -> String -> Symbol
- sup :: Symbol -> Symbol -> Symbol
- unicodeConv :: Symbol -> Symbol
- upperLeft :: Symbol -> Symbol -> Symbol
- vec :: Symbol -> Symbol
- label :: String -> Symbol
- variable :: String -> Symbol
- type ConstQDef = QDefinition Literal
- type SimpleQDef = QDefinition Expr
- type ModelQDef = QDefinition ModelExpr
- type PExpr = forall r. (ExprC r, LiteralC r) => r
- type TypingContext t = Map UID t
- type TypeError = String
- inferFromContext :: TypingContext t -> UID -> Either t TypeError
- class (Eq t, Show t) => Typed e t where
- infer :: TypingContext t -> e -> Either t TypeError
- check :: TypingContext t -> e -> t -> Either t TypeError
- class Typed e t => RequiresChecking c e t where
- requiredChecks :: c -> [(e, t)]
- temporaryIndent :: String -> String -> String
The Drasil Expression Language
Encodes mathematical and display related expressions. To see the code-related expressions, look in Language.Drasil.Code.
Base Expression Language
Defines the expression types and common operators.
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
($=) :: r -> r -> r infixr 4 Source #
Smart constructor for ordering two equations.
Smart constructor for ordering two equations.
Smart constructor for ordering two equations.
Smart constructor for ordering two equations.
Smart constructor for the dot product of two equations.
Add two expressions (Integers).
Add two expressions (Real numbers).
Multiply two expressions (Integers).
Multiply two expressions (Real numbers).
($/) :: r -> r -> r infixl 7 Source #
($^) :: r -> r -> r infixr 8 Source #
($<=>) :: r -> r -> r Source #
($&&) :: r -> r -> r infixr 9 Source #
($||) :: r -> r -> r infixr 9 Source #
Smart constructor for taking the absolute value of an expression.
Smart constructor for negating an expression.
Smart constructor to take the log of an expression.
Smart constructor to take the ln of an expression.
Smart constructor to take the square root of an expression.
Smart constructor to apply sin to an expression.
Smart constructor to apply cos to an expression.
Smart constructor to apply tan to an expression.
Smart constructor to apply sec to an expression.
Smart constructor to apply csc to an expression.
Smart constructor to apply cot to an expression.
Smart constructor to apply arcsin to an expression.
Smart constructor to apply arccos to an expression.
Smart constructor to apply arctan to an expression.
Smart constructor for the exponential (base e) function.
Smart constructor for calculating the dimension of a vector.
Smart constructor for calculating the normal form of a vector.
Smart constructor for negating vectors.
Smart constructor for applying logical negation to an expression.
Smart constructor for indexing.
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 :: HasUID 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.
Smart constructor to cross product two expressions.
vScale :: r -> r -> r Source #
Smart constructor for vector scaling
Vector Addition
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.
Create a matrix.
apply :: (HasUID f, HasSymbol f) => f -> [r] -> r Source #
Applies a given function with a list of parameters.
Instances
recip_ :: (ExprC r, LiteralC r) => r -> r Source #
Smart constructor for rational expressions (only in 1/x form).
apply2 :: (ExprC r, HasUID f, HasSymbol f, HasUID a, HasSymbol a, HasUID b, HasSymbol b) => f -> a -> b -> r Source #
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] ]
data Completeness Source #
For case expressions (either complete or incomplete).
Instances
Eq Completeness Source # | |
Defined in Language.Drasil.Expr.Lang (==) :: Completeness -> Completeness -> Bool # (/=) :: Completeness -> Completeness -> Bool # |
Literals Language
Expression Modelling Language
Defines display-related expression functions. Used in models.
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.
Instances
Determines the type of the derivative (either a partial derivative or a total derivative).
class ModelExprC r where Source #
deriv :: (HasUID c, HasSymbol c) => r -> c -> r Source #
pderiv :: (HasUID c, HasSymbol c) => r -> c -> r Source #
nthderiv :: (HasUID c, HasSymbol c) => Integer -> r -> c -> r Source #
nthpderiv :: (HasUID c, HasSymbol c) => Integer -> r -> c -> r Source #
defines :: r -> r -> r Source #
One expression is "defined" by another.
Space literals.
isIn :: r -> Space -> r Source #
Check if a value belongs to a Space.
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.
Instances
ModelExprC ModelExpr Source # | |
Defined in Language.Drasil.ModelExpr.Class deriv :: (HasUID c, HasSymbol c) => ModelExpr -> c -> ModelExpr Source # pderiv :: (HasUID c, HasSymbol c) => ModelExpr -> c -> ModelExpr Source # nthderiv :: (HasUID c, HasSymbol c) => Integer -> ModelExpr -> c -> ModelExpr Source # nthpderiv :: (HasUID c, HasSymbol c) => Integer -> ModelExpr -> c -> ModelExpr Source # defines :: ModelExpr -> ModelExpr -> ModelExpr Source # space :: Space -> ModelExpr Source # isIn :: ModelExpr -> Space -> ModelExpr Source # equiv :: [ModelExpr] -> ModelExpr Source # intAll :: Symbol -> ModelExpr -> ModelExpr Source # |
Expression language where all terms also denote a term in GOOL (i.e. translation is total and meaning preserving).
Instances
class CodeExprC r where Source #
new :: (Callable f, HasUID f, CodeIdea f) => f -> [r] -> r Source #
Constructs a CodeExpr for actor creation (constructor call)
newWithNamedArgs :: (Callable f, HasUID f, CodeIdea f, HasUID a, IsArgumentName a) => f -> [r] -> [(a, r)] -> r Source #
Constructs a CodeExpr for actor creation (constructor call) that uses named arguments
msg :: (Callable f, HasUID f, CodeIdea f, HasUID c, HasSpace c, CodeIdea c) => c -> f -> [r] -> r Source #
Constructs a CodeExpr for actor messaging (method call)
msgWithNamedArgs :: (Callable f, HasUID f, CodeIdea f, HasUID c, HasSpace c, CodeIdea c, HasUID a, IsArgumentName a) => c -> f -> [r] -> [(a, r)] -> r Source #
Constructs a CodeExpr for actor messaging (method call) that uses named arguments
field :: CodeVarChunk -> CodeVarChunk -> r Source #
Constructs a CodeExpr representing the field of an actor
applyWithNamedArgs :: (HasUID f, HasSymbol f, HasUID a, IsArgumentName a) => f -> [r] -> [(a, r)] -> r Source #
Instances
CodeExprC CodeExpr Source # | |
Defined in Language.Drasil.CodeExpr.Class new :: (Callable f, HasUID f, CodeIdea f) => f -> [CodeExpr] -> CodeExpr Source # newWithNamedArgs :: (Callable f, HasUID f, CodeIdea f, HasUID a, IsArgumentName a) => f -> [CodeExpr] -> [(a, CodeExpr)] -> CodeExpr Source # msg :: (Callable f, HasUID f, CodeIdea f, HasUID c, HasSpace c, CodeIdea c) => c -> f -> [CodeExpr] -> CodeExpr Source # msgWithNamedArgs :: (Callable f, HasUID f, CodeIdea f, HasUID c, HasSpace c, CodeIdea c, HasUID a, IsArgumentName a) => c -> f -> [CodeExpr] -> [(a, CodeExpr)] -> CodeExpr Source # field :: CodeVarChunk -> CodeVarChunk -> CodeExpr Source # applyWithNamedArgs :: (HasUID f, HasSymbol f, HasUID a, IsArgumentName a) => f -> [CodeExpr] -> [(a, CodeExpr)] -> CodeExpr Source # |
Unicode symbols
Some expressions need special unicode characters.
Special characters include partial derivatives and the degree circle.
class RenderSpecial r where Source #
Class for rendering special characters.
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
The most basic item: having a unique identifier key, here a UID.
Instances
class HasSymbol c where Source #
A HasSymbol is anything which has a Symbol
.
Instances
class HasUID c => NamedIdea c where Source #
Instances
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.
Instances
class NamedIdea c => CommonIdea c where Source #
CommonIdea is a NamedIdea
with the additional
constraint that it must have an abbreviation.
class Definition c where Source #
Defines a chunk.
Instances
class ConceptDomain c where Source #
Some concepts have a domain (related information encoded in UID
s to other chunks).
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
type Concept c = (Idea c, Definition c, ConceptDomain c) Source #
Concepts are Idea
s with definitions and domains.
class HasSpace c where Source #
HasSpace is anything which has a Space
.
Instances
class HasUnitSymbol u where Source #
Some chunks store a unit symbol.
Instances
HasUnitSymbol UnitDefn Source # | Finds unit symbol of the |
class (Idea c, HasSpace c, HasSymbol c) => Quantity 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).
Instances
class HasReasVal c where Source #
A Quantity
that could have a reasonable value.
Instances
HasReasVal ConstrConcept Source # | Finds a reasonable value for the |
Defined in Language.Drasil.Chunk.Constrained | |
HasReasVal ConstrainedChunk Source # | Finds a reasonable value for the |
Defined in Language.Drasil.Chunk.Constrained | |
HasReasVal UncertQ Source # | Finds a reasonable value for the |
HasReasVal UncertainChunk Source # | Finds a reasonable value for the |
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.
constraints :: Lens' c [ConstraintE] Source #
Provides a Lens
to the Constraint
s.
Instances
Constrained ConstrConcept Source # | Finds the |
Defined in Language.Drasil.Chunk.Constrained constraints :: Lens' ConstrConcept [ConstraintE] Source # | |
Constrained ConstrainedChunk Source # | Finds the |
Defined in Language.Drasil.Chunk.Constrained constraints :: Lens' ConstrainedChunk [ConstraintE] Source # | |
Constrained UncertQ Source # | Finds the |
Defined in Language.Drasil.Chunk.UncertainQuantity constraints :: Lens' UncertQ [ConstraintE] Source # | |
Constrained UncertainChunk Source # | Finds the |
Defined in Language.Drasil.Chunk.UncertainQuantity constraints :: Lens' UncertainChunk [ConstraintE] Source # |
class HasAdditionalNotes c where Source #
Records any additional notes needed to avoid losing information
class MayHaveDerivation c where Source #
A class that might have a Derivation
.
derivations :: Lens' c (Maybe Derivation) Source #
Provides a Lens
to a possible derivation.
class (Idea u, Definition u, HasUnitSymbol u) => IsUnit u where Source #
Units are Idea
s with a Definition
which store a unit symbol.
They must also be explicitly declared to be instances of IsUnit.
udefn, getUnits
class DefiningExpr c where Source #
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
DefiningExpr QDefinition Source # | |
Defined in Language.Drasil.Chunk.Eq defnExpr :: Lens' (QDefinition e) e Source # |
class Express c where Source #
Data that can be expressed using ModelExpr
.
Instances
References
class HasRefAddress b where Source #
Members must have a reference address.
Instances
HasRefAddress Citation Source # | Gets the reference address of a |
HasRefAddress ConceptInstance Source # | Finds the reference address contained in a |
Defined in Language.Drasil.Chunk.Concept.Core getRefAdd :: ConceptInstance -> LblType Source # | |
HasRefAddress DecRef Source # | Finds the reference address contained in a |
HasRefAddress Section Source # | Finds the reference address of a |
HasRefAddress LabelledContent Source # | Finds the reference address contained in the |
Defined in Language.Drasil.Document.Core getRefAdd :: LabelledContent -> LblType Source # | |
HasRefAddress Reference Source # | Finds the reference address contained in a |
class (HasUID s, HasRefAddress s) => Referable s where Source #
Members of this class have the ability to be referenced.
refAdd :: s -> String Source #
The referencing address (what we're linking to). Only visible in the source (tex/html).
renderRef :: s -> LblType Source #
Alternate form of reference.
Instances
Referable Citation Source # | Gets the reference information of a |
Referable ConceptInstance Source # | Finds the reference information contained in a |
Defined in Language.Drasil.Chunk.Concept.Core refAdd :: ConceptInstance -> String Source # renderRef :: ConceptInstance -> LblType Source # | |
Referable Section Source # | Finds the reference information of a |
Referable LabelledContent Source # | Finds the reference information of |
Defined in Language.Drasil.Document.Core refAdd :: LabelledContent -> String Source # renderRef :: LabelledContent -> LblType Source # |
class HasReference c where Source #
A class that contains a list of Reference
s.
getReferences :: Lens' c [Reference] Source #
Provides a Lens
to the Reference
s.
Programming-related
class HasSymbol c => Callable c Source #
Some chunks can be called like functions.
Instances
Callable CodeFuncChunk Source # | Functions are Callable. |
Defined in Language.Drasil.Chunk.CodeVar |
class HasSymbol c => IsArgumentName c Source #
Members must have a named argument.
Types
Contains helper functions and smart constructors for each type. Similar types are grouped together.
Basic types
A UID
is a 'unique identifier' for things that we will put into our database
of information. We use a newtype wrapper to make sure we are only using
UID
s where desired.
Instances
ToJSON UID Source # | |
Defined in Language.Drasil.UID | |
ToJSONKey UID Source # | |
Defined in Language.Drasil.UID toJSONKey :: ToJSONKeyFunction UID toJSONKeyList :: ToJSONKeyFunction [UID] | |
Generic UID Source # | |
Show UID Source # | |
Eq UID Source # | |
Ord UID Source # | |
type Rep UID Source # | |
Defined in Language.Drasil.UID type Rep UID = D1 ('MetaData "UID" "Language.Drasil.UID" "drasil-lang-0.1.60.0-DBn1BkDBuUQDwx8nbjDO1j" 'False) (C1 ('MetaCons "UID" 'PrefixI 'True) (S1 ('MetaSel ('Just "_namespace") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: S1 ('MetaSel ('Just "_baseName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))) |
(+++) :: HasUID a => a -> String -> UID Source #
For when we need to modify a UID. We first take the base chunk's UID and then append a suffix to it.
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.
Basic chunk representation in the code generation context. Contains a QuantityDict and the kind of code (variable or function).
CodeC | |
|
Instances
Idea CodeChunk Source # | Finds the idea contained in the |
NamedIdea CodeChunk Source # | Finds the term ( |
MayHaveUnit CodeChunk Source # | Finds the units of the |
Quantity CodeChunk Source # | |
Defined in Language.Drasil.Chunk.CodeVar | |
HasSpace CodeChunk Source # | Finds the |
HasSymbol CodeChunk Source # | Finds the |
HasUID CodeChunk Source # | Finds the |
Eq CodeChunk Source # | Equal if |
data CodeVarChunk Source #
Chunk representing a variable. The obv
field represents the object containing
this variable, if it is an object field.
Instances
newtype CodeFuncChunk Source #
Chunk representing a function.
Instances
qc :: Lens' CodeChunk QuantityDict Source #
ccf :: Iso' CodeFuncChunk CodeChunk Source #
ccv :: Lens' CodeVarChunk CodeChunk Source #
programName :: CommonIdea c => c -> String Source #
Convert an abbreviation into one deemed 'code-friendly', removing spaces, and replacing special characters with underscores.
FIXME: This should NOT be treated as a getter
, but something we cache
local to something that has a 'program name'.
funcPrefix :: String Source #
Used when a function name needs to be distinguishable from a variable name.
class CodeIdea c => DefiningCodeExpr c where Source #
A DefiningCodeExpr
must have it's underlying chunk
defined in the CodeExpr language.
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.
commonIdeaWithDict :: String -> NP -> String -> [IdeaDict] -> CI Source #
Similar to commonIdea
, but takes a list of IdeaDict
(often a domain).
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 an idea (IdeaDict
),
a definition (Sentence
), 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
Idea ConceptChunk Source # | Finds the idea contained in the |
Defined in Language.Drasil.Chunk.Concept.Core | |
NamedIdea ConceptChunk Source # | Finds term ( |
Defined in Language.Drasil.Chunk.Concept.Core term :: Lens' ConceptChunk NP Source # | |
ConceptDomain ConceptChunk Source # | Finds the domain of |
Defined in Language.Drasil.Chunk.Concept.Core cdom :: ConceptChunk -> [UID] Source # | |
Definition ConceptChunk Source # | Finds definition of a |
Defined in Language.Drasil.Chunk.Concept.Core defn :: Lens' ConceptChunk Sentence Source # | |
HasUID ConceptChunk Source # | Finds |
Defined in Language.Drasil.Chunk.Concept.Core uid :: Lens' ConceptChunk UID Source # | |
Eq ConceptChunk Source # | Equal if |
Defined in Language.Drasil.Chunk.Concept.Core (==) :: ConceptChunk -> ConceptChunk -> Bool # (/=) :: ConceptChunk -> ConceptChunk -> Bool # |
data ConceptInstance Source #
Contains a ConceptChunk
, reference address, and a ShortName
.
It is a concept that can be referred to, or rather, a instance of where a concept is applied.
Often used in Goal Statements, Assumptions, Requirements, etc.
Ex. Something like the assumption that gravity is 9.81 m/s. When we write our equations, we can then link this assumption so that we do not have to explicitly define that assumption when needed to verify our work.
Instances
Check if something has one domain. Throws an error if there is more than one.
cc :: Idea c => c -> String -> ConceptChunk Source #
Constructor for projecting an idea into a ConceptChunk
. Takes the definition of the
ConceptChunk
as a String
. Does not allow concept domain tagging.
ccs :: (Idea c, Concept d) => c -> Sentence -> [d] -> ConceptChunk Source #
Similar to cc'
, but allows explicit domain tagging.
cw :: Concept c => c -> ConceptChunk Source #
For projecting out to the ConceptChunk
data-type.
cic :: Concept c => String -> Sentence -> String -> c -> ConceptInstance Source #
Constructor for a ConceptInstance
. Takes in the
Reference Address (String
), a definition (Sentence
),
a short name (String
), and a domain (for explicit tagging).
data RelationConcept Source #
For a concept (ConceptChunk
) that also has a Relation
(ModelExpr
) attached.
Ex. We can describe a pendulum arm and then apply an associated equation so that we know its behaviour.
Instances
makeRC :: Express e => String -> NP -> Sentence -> e -> RelationConcept Source #
Create a RelationConcept
from a given UID
, term (NP
), definition (Sentence
), and Relation
.
addRelToCC :: (Express e, Concept c) => c -> String -> e -> RelationConcept Source #
Create a new RelationConcept
from an old Concept
. Takes a Concept
, new UID
and relation.
data DifferentialModel Source #
Describe the structural content of a system of linear ODEs with six necessary fields
SystemOfLinearODEs | |
|
Instances
data ODESolverFormat Source #
Acceptable format for ODE solvers, represent the structure of X' = AX + B X' is a column vector of first-order unknowns
X' | |
|
data InitialValueProblem Source #
Information for solving an initial value problem
($^^) :: ConstrConcept -> Integer -> Unknown Source #
Operation connect the dependent variable and the order
makeAODESolverFormat :: DifferentialModel -> ODESolverFormat Source #
Construct an ODESolverFormat for solving the ODE.
formEquations :: [[Expr]] -> [Unknown] -> [Expr] -> ConstrConcept -> [Expr] Source #
Form well-formatted ODE equations which the ODE solvers can solve.
makeASystemDE :: UnitalChunk -> ConstrConcept -> [[Expr]] -> [Unknown] -> [Expr] -> String -> NP -> Sentence -> DifferentialModel Source #
Create a DifferentialModel
by giving a independent variable, a dependent variable a canonical matrix form, and conceptChuck.
makeASingleDE :: UnitalChunk -> ConstrConcept -> LHS -> Expr -> String -> NP -> Sentence -> DifferentialModel Source #
Create a DifferentialModel
by the input language
Quantities and Units
data QuantityDict Source #
QuantityDict is a combination of an IdeaDict
with a quantity.
Contains an IdeaDict
, Space
, a function from
Stage
-> Symbol
, and Maybe
a UnitDefn
.
Ex. A pendulum arm does not necessarily have to be defined as a concept before we assign a space (Real numbers), a symbol (l), or units (cm, m, etc.).
Instances
class DefinesQuantity d where Source #
defLhs :: Getter d QuantityDict Source #
Instances
DefinesQuantity (QDefinition e) Source # | |
Defined in Language.Drasil.Chunk.Eq defLhs :: Getter (QDefinition e) QuantityDict Source # |
qw :: (Quantity q, MayHaveUnit q) => q -> QuantityDict Source #
Smart constructor for a QuantityDict
from another Quantity
with units.
mkQuant :: String -> NP -> Symbol -> Space -> Maybe UnitDefn -> Maybe String -> QuantityDict Source #
mkQuant' :: String -> NP -> Maybe String -> Space -> (Stage -> Symbol) -> Maybe UnitDefn -> QuantityDict Source #
codeVC :: Idea c => c -> Symbol -> Space -> QuantityDict Source #
Makes a QuantityDict
from an Idea
, Symbol
, and Space
.
Symbol
is implementation-only.
implVar :: String -> NP -> Space -> Symbol -> QuantityDict Source #
Makes a variable that is implementation-only.
implVar' :: String -> NP -> Maybe String -> Space -> Symbol -> Maybe UnitDefn -> QuantityDict Source #
Similar to implVar
but allows specification of abbreviation and unit.
implVarUID :: UID -> NP -> Space -> Symbol -> QuantityDict Source #
implVarUID' :: UID -> NP -> Maybe String -> Space -> Symbol -> Maybe UnitDefn -> QuantityDict Source #
vc :: String -> NP -> Symbol -> Space -> QuantityDict Source #
Creates a QuantityDict
from a UID
, term (NP
), Symbol
, and Space
.
vc'' :: Idea c => c -> Symbol -> Space -> QuantityDict Source #
Creates a QuantityDict
from an Idea
, Symbol
, and Space
.
vcSt :: String -> NP -> (Stage -> Symbol) -> Space -> QuantityDict Source #
Similar to vc
, but creates a QuantityDict
from something that knows about Stage
s.
data QDefinition e Source #
Instances
fromEqn :: IsUnit u => String -> NP -> Sentence -> Symbol -> Space -> u -> e -> QDefinition e Source #
fromEqn' :: String -> NP -> Sentence -> Symbol -> Space -> e -> QDefinition e Source #
Same as fromEqn
, but has no units.
fromEqnSt :: IsUnit u => UID -> NP -> Sentence -> (Stage -> Symbol) -> Space -> u -> 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 Space
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) => c -> e -> QDefinition e Source #
Used to help make QDefinition
s 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 QDefinition
s when UID
and Symbol
come from the same source, with the term separate.
ec :: (Quantity c, MayHaveUnit c) => c -> e -> QDefinition e Source #
Smart constructor for QDefinitions. Requires a quantity and its defining equation.
mkFuncDef :: (HasUID f, HasSymbol f, HasSpace f, HasUID i, HasSymbol i, HasSpace i, IsUnit u) => f -> NP -> Sentence -> u -> [i] -> e -> QDefinition e Source #
Create a QDefinition
function with a symbol, name, term, list of inputs,
resultant units, and a defining Expr
mkFuncDef' :: (HasUID f, HasSymbol f, HasSpace f, HasUID 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
class Quantity c => Unitary c where Source #
A Unitary is a Quantity
that must have a unit.
Instances
Unitary UnitalChunk Source # | Finds the unit definition of a |
Defined in Language.Drasil.Chunk.Unital unit :: UnitalChunk -> UnitDefn Source # | |
Unitary UnitaryChunk Source # | Finds the unit definition of a |
Defined in Language.Drasil.Chunk.Unitary unit :: UnitaryChunk -> UnitDefn Source # |
data UnitaryChunk Source #
UnitaryChunks are for ideas with quantities that must have units. Contains a QuantityDict
and a UnitDefn
.
Ex. A pendulum arm is an idea associated with a symbol (l) and units (cm, m, etc.).
Instances
unitary :: IsUnit u => String -> NP -> Symbol -> u -> Space -> UnitaryChunk Source #
Builds the QuantityDict
part from the UID
, term (NP
), Symbol
, and Space
.
Assumes there's no abbreviation.
mkUnitary :: (Unitary u, MayHaveUnit u) => u -> UnitaryChunk Source #
Makes a UnitaryChunk
from a quantity with a unit.
unit_symb :: Unitary c => c -> USymb Source #
Helper for getting the unit's Symbol
from a chunk,
as opposed to the symbols of the chunk itself.
data DefinedQuantityDict Source #
DefinedQuantityDict is the combination of a Concept
and a Quantity
.
Contains a ConceptChunk
, a Symbol
dependent on Stage
, a Space
, and maybe a UnitDefn
.
Used when we want to assign a quantity to a concept. Includes the space, symbol, and units for that quantity.
Ex. A pendulum arm can be defined as a concept with a symbol (l), space (Real numbers), and units (cm, m, etc.).
Instances
dqd :: IsUnit u => ConceptChunk -> Symbol -> Space -> u -> DefinedQuantityDict Source #
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 #
dqdNoUnit :: ConceptChunk -> Symbol -> Space -> DefinedQuantityDict Source #
Similar to dqd
, but without any units.
dqdQd :: (Quantity c, MayHaveUnit c) => c -> ConceptChunk -> DefinedQuantityDict Source #
When we want to merge a quantity and a concept. This is suspicious.
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
.
data UnitalChunk Source #
Similar to a DefinedQuantityDict
, UnitalChunks are concepts
with quantities that must have a unit definition.
Contains DefinedQuantityDict
s and a UnitDefn
.
Ex. A pendulum arm is a tangible object with a symbol (l) and units (cm, m, etc.).
Instances
uc :: (Concept c, IsUnit u) => c -> Symbol -> Space -> u -> UnitalChunk Source #
Used to create a UnitalChunk
from a Concept
, Symbol
, and Unit
.
uc' :: IsUnit u => String -> NP -> Sentence -> Symbol -> Space -> u -> UnitalChunk Source #
Similar to uc
, except it builds the Concept
portion of the UnitalChunk
from a given UID
, term, and definition (as a Sentence
) which are its first three arguments.
ucStaged' :: IsUnit u => String -> NP -> Sentence -> (Stage -> Symbol) -> Space -> u -> UnitalChunk Source #
ucuc :: (Quantity c, Concept c, MayHaveUnit c) => c -> UnitDefn -> UnitalChunk Source #
Attach units to a chunk that has a symbol and definition.
ucw :: (Unitary c, Concept c, MayHaveUnit c) => c -> UnitalChunk Source #
Constructs a UnitalChunk from a Concept
with Units
.
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).
Instances
Idea UnitDefn Source # | Finds the idea contained in the |
NamedIdea UnitDefn Source # | Finds term ( |
ConceptDomain UnitDefn Source # | Finds the domain contained in the |
Definition UnitDefn Source # | Finds definition of the |
HasUnitSymbol UnitDefn Source # | Finds unit symbol of the |
IsUnit UnitDefn Source # | Gets the UnitDefn and contributing units. |
HasUID UnitDefn Source # | Finds |
Eq UnitDefn Source # | Equal if |
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 -> 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.
compUnitDefn :: UnitDefn -> UnitDefn -> Ordering Source #
We don't want an Ord on units, but this still allows us to compare them.
unitWrapper :: IsUnit u => u -> UnitDefn Source #
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
).
Instances
Constrained and Uncertain Values
data Constraint a where Source #
Range :: ConstraintReason -> RealInterval a a -> Constraint a | By default, physical and software constraints are ranges. |
type ConstraintE = Constraint Expr Source #
Type synonym for ConstraintE
physc :: RealInterval Expr Expr -> ConstraintE Source #
Smart constructor for range of Physical
constraints between two given expressions.
sfwrc :: 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 ConstrainedChunk Source #
ConstrainedChunks are symbolic quantities (QuantityDict
)
with Constraint
s and maybe a typical value (Maybe
Expr
).
Ex. Measuring the length of a pendulum would have some reasonable value (between 1 cm and 2 m) and the constraint that the length cannot be a negative value.
ConstrainedChunk | |
|
Instances
data ConstrConcept Source #
ConstrConcepts are conceptual symbolic quantities (DefinedQuantityDict
)
with Constraint
s and maybe a reasonable value (no units!).
Similar to ConstrainedChunk
but includes a definition and domain.
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.
ConstrConcept | |
|
Instances
cuc :: IsUnit u => String -> NP -> Symbol -> u -> Space -> [ConstraintE] -> Expr -> ConstrainedChunk Source #
constrained' :: (Concept c, MayHaveUnit c, Quantity c) => c -> [ConstraintE] -> Expr -> ConstrConcept Source #
Creates a ConstrConcept
with a quantitative concept, a list of Constraint
s and an Expr
.
cuc' :: IsUnit u => String -> NP -> String -> Symbol -> u -> Space -> [ConstraintE] -> Expr -> ConstrConcept Source #
cuc'' :: IsUnit u => String -> NP -> String -> (Stage -> Symbol) -> u -> Space -> [ConstraintE] -> Expr -> ConstrConcept Source #
constrainedNRV' :: (Concept c, MayHaveUnit c, Quantity c) => c -> [ConstraintE] -> ConstrConcept Source #
Similar to constrained'
, but defaults Maybe
Expr
to Nothing
.
cnstrw :: (Quantity c, Constrained c, HasReasVal c, MayHaveUnit c) => c -> ConstrainedChunk Source #
Creates a new ConstrainedChunk from either a ConstrainedChunk
, ConstrConcept
, UncertainChunk
, or an UncertQ
.
cnstrw' :: (Quantity c, Concept c, Constrained c, HasReasVal c, MayHaveUnit c) => c -> ConstrConcept Source #
data UncertainChunk Source #
UncertainChunk is a symbolic quantity with constraints, a typical value, and an uncertainty.
Contains a ConstrainedChunk
and an Uncertainty
.
Ex. Measuring the length of a pendulum arm may be recorded with an uncertainty value.
Instances
UncertQs are conceptual symbolic quantities with constraints and an Uncertainty
.
Contains a ConstrConcept
and an Uncertainty
.
Ex. Measuring the length of a pendulum arm may be recorded with an uncertainty value.
Instances
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 typical value with an Uncertainty
.
uqc :: IsUnit u => String -> NP -> String -> Symbol -> u -> Space -> [ConstraintE] -> Expr -> Uncertainty -> UncertQ Source #
Uncertainty quantity (uq
) but with a constraint.
uqcND :: IsUnit u => String -> NP -> Symbol -> u -> Space -> [ConstraintE] -> Expr -> Uncertainty -> UncertQ Source #
Uncertainty quantity constraint (uqc
) without a description.
uncrtnChunk :: (Quantity c, Constrained c, HasReasVal c, MayHaveUnit c) => c -> Uncertainty -> UncertainChunk Source #
Smart constructor that can project to an UncertainChunk
(also given an Uncertainty
).
uvc :: String -> NP -> Symbol -> Space -> [ConstraintE] -> Expr -> Uncertainty -> UncertainChunk Source #
Creates an uncertain variable chunk. Takes UID
, term (NP
),
Symbol
, Space
, Constrains
, Expr
, and Uncertainty
.
uncrtnw :: (HasUncertainty c, Quantity c, Constrained c, HasReasVal c, MayHaveUnit c) => c -> UncertainChunk Source #
Projection function into an UncertainChunk
from UncertQ
or an UncertainChunk
.
data Uncertainty Source #
Something that may contain an uncertainty value and a precision value.
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).
unc :: Lens' c Uncertainty Source #
Provides the Lens
to an Uncertainty
.
Instances
HasUncertainty UncertQ Source # | Finds the uncertainty of an |
Defined in Language.Drasil.Chunk.UncertainQuantity unc :: Lens' UncertQ Uncertainty Source # | |
HasUncertainty UncertainChunk Source # | Finds the uncertainty of an |
Defined in Language.Drasil.Chunk.UncertainQuantity unc :: Lens' UncertainChunk 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).
Referencing
Applying different pieces of information for a reference. An RP is a decorated internal reference. Citation is a citation. URI is for URLs and other external links.
Created for different forms of references. Used in LblType
.
A Reference contains the identifier (UID
), a reference address (LblType
),
a human-readable shortname (ShortName
), and any extra information about the reference (RefInfo
).
ref :: (HasUID r, HasRefAddress r, HasShortName r) => r -> Reference Source #
Projector function that creates a Reference
from something Referable
.
refS :: (HasUID r, HasRefAddress r, HasShortName r) => r -> Sentence Source #
namedRef :: (HasUID r, HasRefAddress r, HasShortName r) => r -> Sentence -> Sentence Source #
complexRef :: (HasUID r, HasRefAddress r, HasShortName r) => r -> RefInfo -> Sentence Source #
Takes a Reference
with additional display info. Uses the internal shortname for its display name.
namedComplexRef :: (HasUID r, HasRefAddress r, HasShortName r) => r -> Sentence -> RefInfo -> Sentence Source #
For holding a Reference
that is decorated with extra information (ex. page numbers, equation sources, etc.).
Instances
dRefInfo :: (HasUID r, HasRefAddress r, HasShortName r) => r -> RefInfo -> DecRef Source #
dRef :: (HasUID r, HasRefAddress r, HasShortName r) => r -> DecRef Source #
class HasDecRef c where Source #
A class that contains a list of decorated references (DecRef
s).
getDecRefs :: Lens' c [DecRef] Source #
Provides a Lens
to the DecRef
s.
Citations
All citations require a unique identifier used by the Drasil chunk.
We will re-use the UID
part as an EntryID (String
) used for creating reference links.
Finally we will have the reference information (CitationKind
, CiteField
s, and a ShortName
).
Ex. A reference to a thesis paper like Koothoor's "Document driven approach to certifying scientific computing software" would include the affiliated university, publishing year, and city.
class HasCitation c where Source #
Some documents, as well as some pieces of knowledge, have citations.
getCitations :: Lens' c [Citation] Source #
Provides a Lens
to the citations.
citeKind :: Lens' Citation CitationKind Source #
cArticle :: People -> String -> String -> Int -> [CiteField] -> String -> Citation Source #
Article citation requires author(s), title, journal, year. Optional fields can be: volume, number, pages, month, and note. Implicitly uses the EntryID as the chunk id.
cBookA :: People -> String -> String -> Int -> [CiteField] -> String -> Citation Source #
Book citation by author.
Book citation requires author or editor, title, publisher, year. Optional fields can be volume or number, series, address, edition, month, and note. Implicitly uses the EntryID as the chunk id.
cBookE :: People -> String -> String -> Int -> [CiteField] -> String -> Citation Source #
Book citation by editor.
Book citation requires author or editor, title, publisher, year. Optional fields can be volume or number, series, address, edition, month, and note. Implicitly uses the EntryID as the chunk id.
cBooklet :: String -> [CiteField] -> String -> Citation Source #
Booklet citation requires title. Optional fields can be author, how published, address, month, year, note. Implicitly uses the EntryID as the chunk id.
cInBookACP :: People -> String -> Int -> [Int] -> String -> Int -> [CiteField] -> String -> Citation Source #
InBook citation by author.
InBook citation requires author or editor, title, chapter and/or pages, publisher, year. Optional fields can be volume or number, series, type, address, edition, month, and note. Implicitly uses the EntryID as the chunk id. This smart constructor includes both chapter and page numbers.
cInBookECP :: People -> String -> Int -> [Int] -> String -> Int -> [CiteField] -> String -> Citation Source #
InBook citation by editor.
InBook citation requires author or editor, title, chapter and/or pages, publisher, year. Optional fields can be volume or number, series, type, address, edition, month, and note. Implicitly uses the EntryID as the chunk id. This smart constructor includes both chapter and page numbers.
cInBookAC :: People -> String -> Int -> String -> Int -> [CiteField] -> String -> Citation Source #
Otherwise identical to cInBookACP
.
InBook citation excluding page numbers.
cInBookEC :: People -> String -> Int -> String -> Int -> [CiteField] -> String -> Citation Source #
Otherwise identical to cInBookECP
.
InBook citation excluding page numbers.
cInBookAP :: People -> String -> [Int] -> String -> Int -> [CiteField] -> String -> Citation Source #
Otherwise identical to cInBookACP
.
InBook citation excluding chapter.
cInBookEP :: People -> String -> [Int] -> String -> Int -> [CiteField] -> String -> Citation Source #
Otherwise identical to cInBookECP
.
InBook citation excluding chapter.
cInCollection :: People -> String -> String -> String -> Int -> [CiteField] -> String -> Citation Source #
InCollection citation requires author, title, bookTitle, publisher, year. Optional fields can be editor, volume or number, series, type, chapter, pages, address, edition, month, and note. Implicitly uses the EntryID as the chunk id.
cInProceedings :: People -> String -> String -> Int -> [CiteField] -> String -> Citation Source #
InProceedings citation requires author, title, bookTitle, year. Optional fields can be editor, volume or number, series, pages, address, month, organization, publisher, and note. Implicitly uses the EntryID as the chunk id.
cManual :: String -> [CiteField] -> String -> Citation Source #
Manual (technical documentation) citation requires title. Optional fields can be author, organization, address, edition, month, year, and note. Implicitly uses the EntryID as the chunk id.
cMThesis :: People -> String -> String -> Int -> [CiteField] -> String -> Citation Source #
Master's Thesis citation requires author, title, school, and year. Optional fields can be type, address, month, and note. Implicitly uses the EntryID as the chunk id.
cMisc :: [CiteField] -> String -> Citation Source #
Misc citation requires nothing. Optional fields can be author, title, howpublished, month, year, and note. Implicitly uses the EntryID as the chunk id.
cPhDThesis :: People -> String -> String -> Int -> [CiteField] -> String -> Citation Source #
PhD Thesis citation requires author, title, school, and year. Optional fields can be type, address, month, and note. Implicitly uses the EntryID as the chunk id.
cProceedings :: String -> Int -> [CiteField] -> String -> Citation Source #
Proceedings citation requires title and year. Optional fields can be editor, volume or number, series, address, publisher, note, month, and organization. Implicitly uses the EntryID as the chunk id.
cTechReport :: People -> String -> String -> Int -> [CiteField] -> String -> Citation Source #
Technical Report citation requires author, title, institution, and year. Optional fields can be type, number, address, month, and note. Implicitly uses the EntryID as the chunk id.
cUnpublished :: People -> String -> String -> [CiteField] -> String -> Citation Source #
Unpublished citation requires author, title, and note. Optional fields can be month and year. Implicitly uses the EntryID as the chunk id.
Custom type for months (abbreviated).
Fields used in citations.
Address String | |
Author People | |
BookTitle String | Used for |
Chapter Int | |
Edition Int | |
Editor People | |
HowPublished HP | Can be published via URL or something else. |
Institution String | |
Journal String | |
Month Month | |
Note String | |
Number Int | |
Organization String | |
Pages [Int] | Range of pages (ex1. 1-32; ex2. 7,31,52-55). |
Publisher String | |
School String | |
Series String | |
Title String | |
Type String | BibTeX "type" field. |
Volume Int | |
Year Int |
How something is published. Necessary for URLs to work properly.
data CitationKind Source #
External references come in many flavours. Articles, Books, etc. (we are using the types available in Bibtex).
howPublishedU :: String -> CiteField Source #
URL version of howPublished
.
Smart field constructor for a CiteField
.
A person can have a given name, middle name(s), and surname, as well as the naming convention they use.
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.
Members of this class must have a name.
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.
Sentences
Things like expressions and terms are displayed by using Sentence
s.
We also use NounPhrase
s to record the proper pluralization and capitalization of terms.
For writing Sentence
s via combining smaller elements.
Sentence
s are made up of some known vocabulary of things:
- units (their visual representation)
- words (via
String
s) - special characters
- accented letters
- references to specific layout objects
Ch :: SentenceStyle -> TermCapitalization -> UID -> Sentence | Ch looks up the term for a given |
SyCh :: UID -> Sentence | A branch of Ch dedicated to SymbolStyle only. |
Sy :: USymb -> Sentence | Converts a unit symbol into a usable Sentence form. |
S :: String -> Sentence | Constructor for |
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 |
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. |
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 #
Holds any extra information needed for a Reference
, be it an equation, pages, a note, or nothing.
(+:+) :: Sentence -> Sentence -> Sentence Source #
Helper for concatenating two Sentence
s with a space between them.
(+:) :: 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).
headSent :: Int -> Sentence -> Sentence Source #
Helper which creates a Header with size s of the Sentence
.
sC :: Sentence -> Sentence -> Sentence Source #
Helper for concatenating two Sentence
s with a comma and space between them.
sDash :: Sentence -> Sentence -> Sentence Source #
Helper for concatenating two Sentence
s with a space-surrounded dash between them.
class NounPhrase n where Source #
phraseNP :: n -> Sentence 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 -> Sentence) -> Capitalization Source #
Retrieves the singular form and applies a captalization
rule (usually capitalizes the first word) to produce a Sentence
.
Ex. "The quick brown fox".
titleCase :: n -> (NP -> Sentence) -> Capitalization Source #
Retrieves the singular form and applies a captalization
rule (usually capitalizes all words) to produce a Sentence
.
Ex. "The Quick Brown Fox".
For nouns and NounPhrase
s. May be constructed from a
proper noun, common noun, or phrase (Sentence
) and their
respective pluralization and capitalization rules.
Self plural.
Constructs a Proper Noun, it is always capitalized as written.
Plural form simply adds "s" (ex. Henderson -> Hendersons).
Constructs a Proper Noun, it is always capitalized as written.
Plural form adds "e".
Constructs a Proper Noun, it is always capitalized as written.
pn''' :: String -> NP Source #
Plural form adds "es" (ex. Bush -> Bushes).
Constructs a Proper Noun, it is always capitalized as written.
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.
Self plural.
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).
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).
Constructs a common noun which capitalizes the first letter of the first word at the beginning of a sentence.
cn''' :: String -> NP Source #
Plural form adds "es" (ex. bush -> bushes).
Constructs a common noun which capitalizes the first letter of the first word at the beginning of a sentence.
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).
Constructs a common noun that pluralizes by dropping the last two letters and adding "es" (ex. analysis -> analyses).
Constructs a common noun that pluralizes by dropping the last two letters and adding "a" (ex. datum -> data).
nounPhrase :: String -> PluralString -> NP Source #
nounPhrase' :: String -> PluralString -> CapitalizationRule -> NP Source #
Similar to nounPhrase
, but takes a specified capitalization rule for the sentence case.
data CapitalizationRule Source #
Capitalization rules.
atStartNP :: NounPhrase n => n -> Capitalization Source #
Singular sentence case.
Helper function for getting the sentence case of a noun phrase.
atStartNP' :: NounPhrase n => n -> Capitalization Source #
Plural sentence case.
Helper function for getting the sentence case of a noun phrase.
data PluralRule Source #
Pluralization rules.
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 -> Sentence) -> (NP -> Sentence) -> 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 -> Sentence) -> 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 #
Singular title case.
Helper function for getting the title case of a noun phrase.
titleizeNP' :: NounPhrase n => n -> Capitalization Source #
Plural title case.
Helper function for getting the title case of a noun phrase.
nounPhrase'' :: Sentence -> PluralForm -> CapitalizationRule -> CapitalizationRule -> NP Source #
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 :: Sentence -> NP Source #
introduceAbb :: Idea n => n -> Sentence Source #
Helper for common pattern of introducing the title-case version of a noun phrase (from an Idea) followed by its abbreviation in parentheses.
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 #
Singular possesive function
Helper for getting the possesive cases from the term of a NamedIdea
.
pluralPoss :: NamedIdea n => n -> Sentence Source #
Plural possesive function
Helper for getting the possesive cases from the term of a NamedIdea
.
atStart :: NamedIdea n => n -> Sentence Source #
Singular sentence case.
Helper function for getting the sentence case of a noun phrase from a
NamedIdea
.
atStart' :: NamedIdea n => n -> Sentence Source #
Plural sentence case.
Helper function for getting the sentence case of a noun phrase from a
NamedIdea
.
titleize :: NamedIdea n => n -> Sentence Source #
Singular title case.
Helper function for getting the title case of a noun phrase from a
NamedIdea
.
titleize' :: NamedIdea n => n -> Sentence Source #
Plural title case.
Helper function for getting the title case of a noun phrase from a
NamedIdea
.
shortname' :: Sentence -> ShortName Source #
class HasShortName s where Source #
A ShortName
is the text to be displayed for a link.
Used for referencing within a document that can include symbols and whatnot if required. Visible in the typeset documents (pdf).
Instances
HasShortName Citation Source # | |
HasShortName ConceptInstance Source # | Finds the |
Defined in Language.Drasil.Chunk.Concept.Core shortname :: ConceptInstance -> ShortName Source # | |
HasShortName DecRef Source # | Finds the shortname of the reference address used for the |
HasShortName Section Source # | Finds the short name of a |
HasShortName LabelledContent Source # | Find the shortname of the reference address used for the |
Defined in Language.Drasil.Document.Core shortname :: LabelledContent -> ShortName Source # | |
HasShortName Reference Source # | Finds the shortname of the reference address used for the |
data Derivation Source #
Derivations are an ordered list of sentences and expressions. They are rendered in order as paragraphs and equation blocks to display the derivation.
mkDeriv :: Sentence -> [Sentence] -> Derivation Source #
Smart constructor for creating a Derivation
.
mkDerivName :: Sentence -> [Sentence] -> Derivation Source #
Similar to mkDeriv
, but prepends "Detailed derivation of" to the header.
mkDerivNoHeader :: [Sentence] -> Derivation Source #
Sentence Fold-type utilities.
From Utils.Drasil.Fold. Defines many general fold functions for use with Drasil-related types.
Folding Options as Types
Type that helps determine enumeration method. Can use either numbers, uppercase letters, or lowercase letters.
Type to help wrap a sentence with parenthesis or to add a period at the end.
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).
Folding functions
Expression-related
foldConstraints :: Quantity c => c -> [ConstraintE] -> Sentence Source #
Helper for formatting a list of constraints.
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".
foldlSPCol :: [Sentence] -> Contents Source #
Same as foldlSP
but uses foldlSentCol
.
foldlSent :: [Sentence] -> Sentence Source #
Partial function application of foldle
for sentences specifically.
Folds with spaces and adds a period (".") at the end.
foldlsC :: [Sentence] -> Sentence Source #
Folds a list of elements separated by commas, including the last element.
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"]).
Basic Document Language
Holds all the types and helper functions needed especially in drasil-docLang
Language.Drasil.Document
A Document has a Title (Sentence
), Author(s) (Sentence
), and Section
s
which hold the contents of the document.
Document Title Author ShowTableOfContents [Section] | |
Notebook Title Author [Section] |
data ShowTableOfContents Source #
Determines whether or not the table of contents appears on the generated artifacts.
Types of definitions (general, instance, theory, or data).
Contents may be labelled or unlabelled.
Instances
HasContents Contents Source # | Access the |
Defined in Language.Drasil.Document.Core accessContents :: Lens' Contents RawContent Source # |
Section Contents are split into subsections or contents, where contents
are standard layout objects (see Contents
).
Denotes the different possible types that can be used as a list.
Bullet [(ItemType, Maybe String)] | Bulleted list. |
Numeric [(ItemType, Maybe String)] | Enumerated list. |
Simple [ListTuple] | Simple list with items denoted by |
Desc [ListTuple] | Descriptive list, renders as "Title: Item" (see |
Definitions [ListTuple] | Renders a list of " |
Denotes how something should behave in a list (ListType
).
data LabelledContent Source #
Contains a Reference
and RawContent
.
LblC | |
|
Instances
newtype UnlabelledContent Source #
Only contains RawContent
.
Instances
HasContents UnlabelledContent Source # | Access the |
Defined in Language.Drasil.Document.Core accessContents :: Lens' UnlabelledContent RawContent Source # |
extractSection :: Document -> [Section] Source #
mkParagraph :: Sentence -> Contents Source #
Smart constructor that wraps UnlabelledContent
into Contents
.
mkRawLC :: RawContent -> Reference -> LabelledContent Source #
Smart constructor similar to llcc
, but takes in RawContent
first.
checkToC :: Document -> Document Source #
Manually removes the first section of a document (table of contents section). temp fix for Notebook (see if we need this in notebook later)
llcc :: Reference -> RawContent -> LabelledContent Source #
Smart constructor for labelled content chunks.
ulcc :: RawContent -> UnlabelledContent Source #
Smart constructor for unlabelled content chunks (no Reference
).
fig :: Lbl -> Filepath -> RawContent Source #
Figure
smart constructor with a Lbl
and a Filepath
. Assumes 100% of page width as max width.
figWithWidth :: Lbl -> Filepath -> MaxWidthPercent -> RawContent Source #
Figure
smart constructor that allows for customized max widths.
type MaxWidthPercent = Float Source #
MaxWidthPercent should be kept in the range 1-100.
Values outside this range may have unexpected results.
Used for specifying max figure width as
pagewidth*MaxWidthPercent/100
.
class HasContents c where Source #
Members of this class must have RawContent
.
accessContents :: Lens' c RawContent Source #
Provides a Lens
to the RawContent
.
Instances
HasContents Contents Source # | Access the |
Defined in Language.Drasil.Document.Core accessContents :: Lens' Contents RawContent Source # | |
HasContents LabelledContent Source # | Access the |
Defined in Language.Drasil.Document.Core accessContents :: Lens' LabelledContent RawContent Source # | |
HasContents UnlabelledContent Source # | Access the |
Defined in Language.Drasil.Document.Core accessContents :: Lens' UnlabelledContent RawContent Source # |
data RawContent Source #
Types of layout objects we deal with explicitly.
Table [Sentence] [[Sentence]] Title Bool | table has: header-row, data(rows), label/caption, and a bool that determines whether or not to show label. |
Paragraph Sentence | Paragraphs are just sentences. |
EqnBlock ModelExpr | Block of Equations holds an expression. |
DerivBlock Sentence [RawContent] | Grants the ability to label a group of |
Enumeration ListType | For enumerated lists. |
Defini DType [(Identifier, [Contents])] | Defines something with a type, identifier, and |
Figure Lbl Filepath MaxWidthPercent | For creating figures in a document. Should use relative file path. |
Bib BibRef | Grants the ability to reference something. |
Graph [(Sentence, Sentence)] (Maybe Width) (Maybe Height) Lbl | Contain a graph with coordinates ( |
CodeBlock CodeExpr | Block for codes TODO: Fill this one in. |
mkFig :: Reference -> RawContent -> Contents Source #
Smart constructor that wraps LabelledContent
into Contents
.
makeTabRef :: String -> Reference Source #
Create a reference for a table. Takes in the name of a table (which will also be used for its shortname).
makeFigRef :: String -> Reference Source #
Create a reference for a figure. Takes in the name of a figure (which will also be used for its shortname).
makeSecRef :: String -> Sentence -> Reference Source #
Create a reference for a section. Takes in the name of a section and a shortname for the section.
makeEqnRef :: String -> Reference Source #
Create a reference for a equation. Takes in the name of the equation (which will also be used for its shortname).
makeTabRef' :: UID -> Reference Source #
Variants of makeTabRef
that takes a UID
instead of a String
.
makeFigRef' :: UID -> Reference Source #
Variants of makeFigRef
that takes a UID
instead of a String
.
makeSecRef' :: UID -> Sentence -> Reference Source #
Variants of makeSecRef
that takes a UID
instead of a String
.
makeEqnRef' :: UID -> Reference Source #
Variants of makeEqnRef
that takes a UID
instead of a String
.
Language.Drasil.Document.Contents
enumBullet :: Reference -> [Sentence] -> LabelledContent Source #
Creates a bulleted list.
enumBulletU :: [Sentence] -> Contents Source #
Same as enumBullet
but unlabelled.
enumSimple :: Reference -> Integer -> Sentence -> [Sentence] -> LabelledContent Source #
Currently Unused. Creates a simple bulleted list that labels things with a title and number:
- lb - Reference,
- s - start index for the enumeration,
- t - title of the list,
- l - list to be enumerated.
For example, if we want to create a list of data definitions, we could call the function as follows:
enumSimple _ 2 (S "DD") [def1, def2, ...]
And the resulting LabelledContent
would be rendered as:
- DD2: def1
- DD3: def2
- DD4: def3 ...
enumSimpleU :: Integer -> Sentence -> [Sentence] -> Contents Source #
Same as enumSimple
but unlabelled.
mkEnumSimpleD :: (Referable c, HasShortName c, Definition c) => [c] -> [Contents] Source #
Convenience function for transforming referable concepts into a bulleted list.
Used in drasil-docLang in making the assumptions, goals, and requirements sections.
Output is of the kind Concept Name: definition of concept
.
lbldExpr :: ModelExpr -> Reference -> LabelledContent Source #
Displays a given expression and attaches a Reference
to it.
unlbldExpr :: ModelExpr -> Contents Source #
Same as eqUnR
except content is unlabelled (does not attach a Reference
).
unlbldCode :: CodeExpr -> Contents Source #
Unlabelled code expression
Document combinators
From Language.Drasil.Document.Combinators. General sorting functions, useful combinators, and various functions to work with Drasil Chunk types.
Reference-related functions
chgsStart :: (HasShortName x, Referable x) => x -> Sentence -> Sentence Source #
Output is of the form "reference - sentence
".
definedIn :: (Referable r, HasShortName r, DefinesQuantity r) => r -> Sentence Source #
definedIn' :: (Referable r, HasShortName r, DefinesQuantity r) => r -> Sentence -> Sentence Source #
definedIn'' :: (Referable r, HasShortName r) => r -> Sentence Source #
definedIn''' :: (HasSymbol q, HasUID q, Referable r, HasShortName r) => q -> r -> Sentence Source #
Takes a Symbol
and its Reference
(does not append a period at the end!). Outputs as "symbol
is defined in source
".
eqnWSource :: (Referable r, HasShortName r) => ModelExpr -> r -> Sentence Source #
Takes an expression and a Referable
and outputs as a Sentence "expression (source)".
fromReplace :: (Referable r, HasShortName r) => r -> UnitalChunk -> Sentence Source #
Takes a Referable
source and a UnitalChunk
and outputs as a Sentence
: "From source
we can replace symbol
:".
fromSource :: (Referable r, HasShortName r) => r -> Sentence Source #
Wraps "from reference
" in parentheses.
fromSources :: (Referable r, HasShortName r) => [r] -> Sentence Source #
Similar to fromSource
but takes a list of references instead of one.
fmtU :: MayHaveUnit a => Sentence -> a -> Sentence Source #
Takes an amount as a Sentence
and appends a unit to it.
follows :: (Referable r, HasShortName r) => Sentence -> r -> Sentence Source #
Appends "following reference
" to the end of a Sentence
.
makeListRef :: [a] -> Section -> [Sentence] Source #
Takes a list and a Section
, then generates a list of that section's reference to
match the length of the list.
Sentence-related functions
See Reference-related functions as well.
displayStrConstrntsAsSet :: Quantity a => a -> [String] -> Sentence Source #
Produces a Sentence
that displays the constraints in a set {}.
displayDblConstrntsAsSet :: Quantity a => a -> [Double] -> Sentence Source #
Produces a Sentence
that displays the constraints in a set {}.
getTandS :: Quantity a => a -> Sentence Source #
Used when you want to say a term followed by its symbol. ex. "...using the Force F in...".
maybeChanged :: Sentence -> Sentence -> Sentence Source #
Helper functions for making likely change statements. Uses form
.likelyFrame
parameter1 _ parameter2
maybeExpanded :: Sentence -> Sentence -> Sentence Source #
Helper functions for making likely change statements. Uses form
.likelyFrame
parameter1 _ parameter2
maybeWOVerb :: Sentence -> Sentence -> Sentence Source #
Helper functions for making likely change statements. Uses form
.likelyFrame
parameter1 _ parameter2
substitute :: (Referable r, HasShortName r, DefinesQuantity r) => [r] -> Sentence Source #
typUncr :: HasUncertainty c => c -> Sentence Source #
Extracts the typical uncertainty to be displayed from something that has an uncertainty.
underConsidertn :: ConceptChunk -> Sentence Source #
Returns the Sentence
"The chunk
under consideration is chunkDefinition
".
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)
.
List-related functions
makeTMatrix :: Eq a => [Sentence] -> [[a]] -> [a] -> [[Sentence]] Source #
Makes a traceability matrix from a list of row titles, a list of rows of "checked" columns, and a list of columns.
mkTableFromColumns :: [(Sentence, [Sentence])] -> ([Sentence], [[Sentence]]) Source #
Helper for making a table from a columns.
noRefs :: [ItemType] -> [(ItemType, Maybe String)] Source #
Converts lists of simple ItemType
s into a list which may be used
in Contents
but is not directly referable.
refineChain :: NamedIdea c => [(c, Section)] -> Sentence Source #
Create a list in the pattern of "The __ are refined to the __". Note: Order matters!
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.
tAndDOnly :: Concept s => s -> ItemType Source #
Helpful combinators for making Sentence
s into Terminologies with Definitions.
Returns of the form: "term - termDefinition
".
tAndDWAcc :: Concept s => s -> ItemType Source #
Helpful combinators for making Sentence
s into Terminologies with Definitions.
Returns of the form: "term (abbreviation) - termDefinition
".
tAndDWSym :: (Concept s, Quantity a) => s -> a -> ItemType Source #
Helpful combinators for making Sentence
s into Terminologies with Definitions.
Returns of the form: "term (symbol) - termDefinition
".
zipSentList :: [[Sentence]] -> [Sentence] -> [[Sentence]] -> [[Sentence]] Source #
Distributes a list of Sentences by prepending individual Sentences once to an existing list of Sentences.
For example:
>>>
zipSentList [S "Hi", S "Hey", S "Hi"] [[S "Hello"], [S "World"], [S "Hello", S "World"]]
[[S "Hi", S "Hello"], [S "Hey", S "World"], [S "Hi", S "Hello", S "World"]]
Symbols, Stages, Spaces
Used for rendering mathematical symbols in Drasil.
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.
Integer | |
Rational | |
Real | |
Natural | |
Boolean | |
Char | |
String | |
Vect Space | |
Matrix Int Int Space | |
Array Space | |
Actor String | |
DiscreteD [Double] | |
DiscreteS [String] | |
Function (NonEmpty Primitive) Primitive | |
Void |
Instances
Show Space Source # | |
Eq Space Source # | |
Typed Expr Space Source # | |
Typed Literal Space Source # | |
RequiresChecking DifferentialModel Expr Space Source # | |
Defined in Language.Drasil.Chunk.DifferentialModel requiredChecks :: DifferentialModel -> [(Expr, Space)] Source # | |
RequiresChecking (QDefinition Expr) Expr Space Source # | |
Defined in Language.Drasil.Chunk.Eq requiredChecks :: QDefinition Expr -> [(Expr, Space)] Source # |
data RealInterval a b where Source #
A RealInterval is a subset of Space
(as a Space
).
These come in different flavours.
For now, we embed Expr
for the bounds, but that will change as well.
Bounded | |
| |
UpTo | |
| |
UpFrom | |
|
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.
BoundedDD :: Symbol -> RTopology -> a -> b -> DomainDesc 'Discrete a b | |
AllDD :: Symbol -> RTopology -> DomainDesc 'Continuous a b |
type ContinuousDomainDesc a b = DomainDesc 'Continuous a b Source #
type DiscreteDomainDesc a b = DomainDesc 'Discrete a b Source #
data Decoration Source #
Decorations on symbols/characters such as hats or Vector representations (determines bolding, italics, etc).
Instances
Eq Decoration Source # | |
Defined in Language.Drasil.Symbol (==) :: Decoration -> Decoration -> Bool # (/=) :: Decoration -> Decoration -> Bool # | |
Ord Decoration Source # | |
Defined in Language.Drasil.Symbol compare :: Decoration -> Decoration -> Ordering # (<) :: Decoration -> Decoration -> Bool # (<=) :: Decoration -> Decoration -> Bool # (>) :: Decoration -> Decoration -> Bool # (>=) :: Decoration -> Decoration -> Bool # max :: Decoration -> Decoration -> Decoration # min :: Decoration -> Decoration -> Decoration # |
A Symbol
is actually going to be a graphical description of what gets
rendered as a (unique) symbol. This is actually NOT based on semantics at
all, but just a description of how things look.
Symbols can be:
(string such as "x" that represent a value that can vary)Variable
(strings such as "max" or "target" that represent a single idea)Label
characters (ex. unicode)Symbol
Decorated
symbols usingAtop
Concatenations
of symbols, including subscripts and superscripts
! (this is to give this a monoid-like flavour)Empty
mkTable :: [a -> b] -> [a] -> [[b]] Source #
Create a table body (not including header row) by applying the given functions to the column elements of the table rows (in order). The first argument is a list of functions to be applied (one per column). This essentially creates the rows. The second argument is a list of elements apply the functions to.
For example, mkTable [id, *5] [1,2,3]
should produce a table:
| 1 | 5 | | 2 | 10 | | 3 | 15 |
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.
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.
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 #
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.
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 systems
type TypingContext t = Map UID t Source #
inferFromContext :: TypingContext t -> UID -> Either t TypeError 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.
infer :: TypingContext t -> e -> Either t TypeError Source #
Given a typing context and an expression, infer a unique type or explain what went awry.
check :: TypingContext t -> e -> t -> Either t TypeError 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.
requiredChecks :: c -> [(e, t)] Source #
All things that need type checking.
Instances
RequiresChecking DifferentialModel Expr Space Source # | |
Defined in Language.Drasil.Chunk.DifferentialModel requiredChecks :: DifferentialModel -> [(Expr, Space)] Source # | |
RequiresChecking (QDefinition Expr) Expr Space Source # | |
Defined in Language.Drasil.Chunk.Eq requiredChecks :: QDefinition Expr -> [(Expr, Space)] Source # |