drasil-code-0.1.9.0: A framework for code and document generation for scientific software - Code SubPackage
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Drasil.Code

Description

Re-export code-related smart constructors for external code writing and generation.

Synopsis

Documentation

makeCode :: [FileData] -> [AuxData] -> Code Source #

Makes code from FileData (FilePaths with module data) and AuxData (FilePaths with auxiliary document information).

createCodeFiles :: Code -> IO () Source #

Creates the requested Code by producing files.

generator :: Lang -> String -> [Expr] -> Choices -> CodeSpec -> DrasilState Source #

Initializes the generator's DrasilState. Space parameter is a string representing the date. \['Expr'\] parameter is the sample input values provided by the user.

generateCode :: (OOProg progRepr, PackageSym packRepr) => Lang -> (progRepr (Program progRepr) -> ProgData) -> (packRepr (Package packRepr) -> PackData) -> DrasilState -> IO () Source #

Generates a package with the given DrasilState. The passed un-representation functions determine which target language the package will be generated in.

readWithDataDesc :: FilePath -> DataDesc' -> IO [Expr] Source #

Reads data from a file and converts the values to Exprs. The file must be formatted according to the DataDesc' passed as a parameter.

sampleInputDD :: [CodeVarChunk] -> DataDesc' Source #

Defines the DataDesc for the file containing a sample data set, which a user must supply if they want to generate a sample input file.

data Choices Source #

The instruction indicates how the generated program should be written down. Full details of Choices documentation https://github.com/JacquesCarette/Drasil/wiki/The-Code-Generator

Constructors

Choices 

Fields

  • lang :: [Lang]

    Target languages. Choosing multiple means program will be generated in multiple languages.

  • architecture :: Architecture

    Architecture of the program, include modularity and implementation type

  • dataInfo :: DataInfo

    Data structure and represent

  • maps :: Maps

    Maps for 'Drasil concepts' to 'code concepts' or Space to a 'CodeType

  • optFeats :: OptionalFeatures

    Setting for Softifacts that can be added to the program or left it out

  • srsConstraints :: Constraints

    Constraint violation behaviour. Exception or Warning.

  • extLibs :: [ExtLib]

    List of external libraries what to utilize

  • folderVal :: Int

    Number of folders to go up in order to obtain the image

data Comments Source #

Comment implementation options.

Constructors

CommentFunc

Function/method-level comments.

CommentClass

Class-level comments.

CommentMod

File/Module-level comments.

Instances

Instances details
Eq Comments Source # 
Instance details

Defined in Language.Drasil.Choices

data Verbosity Source #

Doxygen file verbosity options.

Constructors

Verbose 
Quiet 

data ConstraintBehaviour Source #

Constraint behaviour options within program.

Constructors

Warning

Print warning when constraint violated.

Exception

Throw exception when constraint violated.

makeArchit :: Modularity -> ImplementationType -> Architecture Source #

Constructor to create a Architecture

data Architecture Source #

Architecture of a program

Constructors

Archt 

Fields

data DataInfo Source #

Data of a program - how information should be encoded.

Constructors

DataInfo 

Fields

makeData :: Structure -> ConstantStructure -> ConstantRepr -> DataInfo Source #

Constructor to create a DataInfo

data Maps Source #

Maps for Concepts and Space

Constructors

Maps 

Fields

makeMaps :: ConceptMatchMap -> SpaceMatch -> Maps Source #

Constructor to create a Maps

spaceToCodeType :: Space -> [CodeType] Source #

Default mapping between Space and CodeType.

makeConstraints :: ConstraintBehaviour -> ConstraintBehaviour -> Constraints Source #

Constructor to create a Constraints

makeODE :: [ODEInfo] -> [ODELibPckg] -> ODE Source #

Constructor to create an ODE

makeDocConfig :: [Comments] -> Verbosity -> Visibility -> DocConfig Source #

Constructor to create a DocConfig

makeLogConfig :: [Logging] -> FilePath -> LogConfig Source #

Constructor to create a LogConfig

data LogConfig Source #

Log Configuration

Constructors

LogConfig 

Fields

data OptionalFeatures Source #

Constructors

OptFeats 

Fields

makeOptFeats :: DocConfig -> LogConfig -> [AuxFile] -> OptionalFeatures Source #

Constructor to create a OptionalFeatures

newtype ExtLib Source #

External Library Options

Constructors

Math ODE 

data ImplementationType Source #

Program implementation options.

Constructors

Library

Generated code does not include Controller.

Program

Generated code includes Controller.

data Logging Source #

Logging options for function calls and variable assignments. Eq instances required for Logging and Comments because generator needs to check membership of these elements in lists

Constructors

LogFunc

Log messages generated for function calls.

LogVar

Log messages generated for variable assignments.

Instances

Instances details
Eq Logging Source # 
Instance details

Defined in Language.Drasil.Choices

Methods

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

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

data Modularity Source #

Modularity of a program.

Constructors

Modular InputModule

Different modules. For controller, input, calculations, output.

Unmodular

All generated code is in one module/file.

data Structure Source #

Variable structure options.

Constructors

Unbundled

Individual variables

Bundled

Variables bundled in a class

data ConstantStructure Source #

Constants options.

Constructors

Inline

Inline values for constants.

WithInputs

Store constants with inputs.

Store Structure

Store constants separately from inputs, whether bundled or unbundled.

data ConstantRepr Source #

Options for representing constants in a program.

Constructors

Var

Constants represented as regular variables.

Const

Use target language's mechanism for defining constants.

data InputModule Source #

Options for input modules.

Constructors

Combined

Input-related functions combined in one module.

Separated

Input-related functions each in own module.

data CodeConcept Source #

Code concepts. For now, just pi.

Constructors

Pi 

Instances

Instances details
Eq CodeConcept Source # 
Instance details

Defined in Language.Drasil.Choices

matchConcepts :: HasUID c => [(c, [CodeConcept])] -> ConceptMatchMap Source #

Builds a ConceptMatchMap from an association list of chunks and CodeConcepts.

type SpaceMatch = Space -> [CodeType] Source #

Specifies which CodeType should be used to represent each mathematical Space. [CodeType] is preferentially-ordered, first CodeType that does not conflict with other choices will be selected.

matchSpaces :: [(Space, [CodeType])] -> SpaceMatch Source #

Builds a SpaceMatch from an association list of Spaces and CodeTypes.

data AuxFile Source #

Currently we only support two kind of auxiliary files: sample input file, readme. To generate a sample input file compatible with the generated program, FilePath is the path to the user-provided file containing a sample set of input data.

Constructors

SampleInput FilePath 
ReadME 

Instances

Instances details
Eq AuxFile Source # 
Instance details

Defined in Language.Drasil.Choices

Methods

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

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

getSampleData :: Choices -> Maybe FilePath Source #

Gets the file path to a sample input data set from a Choices structure, if the user chose to generate a sample input file.

data Visibility Source #

Doxygen date-field visibility options.

Constructors

Show 
Hide 

defaultChoices :: Choices Source #

Default choices to be used as the base from which design specifications can be built.

data CodeSpec where Source #

Code specifications. Holds information needed to generate code.

Constructors

CodeSpec 

Fields

  • :: HasName a
     
  • => { pName :: Name

    Program name.

  •    , authors :: [a]

    Authors.

  •    , purpose :: Purpose

    Purpose.

  •    , background :: Background

    Example Background.

  •    , inputs :: [Input]

    All inputs.

  •    , extInputs :: [Input]

    Explicit inputs (values to be supplied by a file).

  •    , derivedInputs :: [Derived]

    Derived inputs (each calculated from explicit inputs in a single step).

  •    , outputs :: [Output]

    All outputs.

  •    , configFiles :: [FilePath]

    List of files that must be in same directory for running the executable.

  •    , execOrder :: [Def]

    Mathematical definitions, ordered so that they form a path from inputs to outputs.

  •    , cMap :: ConstraintCEMap

    Map from UIDs to constraints for all constrained chunks used in the problem.

  •    , constants :: [Const]

    List of all constants used in the problem.

  •    , constMap :: ConstantMap

    Map containing all constants used in the problem.

  •    , mods :: [Mod]

    Additional modules required in the generated code, which Drasil cannot yet automatically define.

  •    , sysinfodb :: ChunkDB

    The database of all chunks used in the problem.

  •    } -> CodeSpec
     

funcUID :: Func -> UID Source #

Get a UID of a chunk corresponding to a Func.

asVC :: Func -> QuantityDict Source #

Convert a Func to an implementation-stage QuantityDict representing the function.

codeSpec :: SystemInformation -> Choices -> [Mod] -> CodeSpec Source #

Defines a CodeSpec based on the SystemInformation, Choices, and Mods defined by the user.

($:=) :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> FuncStmt Source #

Define an assignment statement.

data Mod Source #

Holds module information.

Constructors

Mod Name Description [Import] [Class] [Func] 

data StateVariable Source #

State variables hold attach a ScopeTag to a CodeVarChunk.

data Func Source #

Holds a function definition or function data.

pubStateVar :: CodeVarChunk -> StateVariable Source #

Define a public state variable based on the given CodeVarChunk.

privStateVar :: CodeVarChunk -> StateVariable Source #

Define a private state variable based on the given CodeVarChunk.

fDecDef :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> FuncStmt Source #

Define a declare-define statement.

ffor :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> [FuncStmt] -> FuncStmt Source #

Define a for-loop. Quantity is for the iteration variable, CodeExpr is the upper bound at that variable (the variable will start with a value of 0). [FuncStmt] is for the loop body.

fforRange :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> CodeExpr -> CodeExpr -> [FuncStmt] -> FuncStmt Source #

Define a for-loop. Quantity is for the iteration variable, and 3 CodeExprs for the start, stop, step numbers. [FuncStmt] is for the loop body.

funcData :: Name -> Description -> DataDesc -> Func Source #

Define a function that reads data from a file, according to the given DataDesc.

funcDef :: (Quantity c, MayHaveUnit c) => Name -> Description -> [c] -> Space -> Maybe Description -> [FuncStmt] -> Func Source #

Define a function by providing the FuncStmts for its body. Other parameters are function name, description, list of parameters, space of the returned value, and description of the returned value.

packmod :: Name -> Description -> [Class] -> [Func] -> Mod Source #

Define a Mod with the given Name, Description, Classes, and Functions.

junkLine :: Data Source #

Constructor for junk data.

multiLine :: LinePattern -> Delim -> Data Source #

Constructor for an unknown amount of lines of data.

repeated :: [DataItem] -> LinePattern Source #

Constructor for data with a repeated pattern.

singleLine :: LinePattern -> Delim -> Data Source #

Constructor for a single line of data.

singleton :: DataItem -> Data Source #

Constructor for a single datum.

type ExternalLibrary = [StepGroup] Source #

External library is a group of Steps

data Step Source #

A step can be a call to an external library function or method.

data FunctionInterface Source #

The first item in the Requires list should be where the function being called is defined.

data Argument Source #

An argument may contain a named argument and argument information.

externalLib :: [StepGroup] -> ExternalLibrary Source #

Specifies an external library.

choiceSteps :: [[Step]] -> StepGroup Source #

To be used when there are multiple options for a group of consecutive steps, where a single use-case-specific factor decides which step group to use.

choiceStep :: [Step] -> StepGroup Source #

To be used when there are multiple options for a single step, where a use-case-specific factor decides which step to use.

mandatoryStep :: Step -> StepGroup Source #

Specifies a step which must exist in some form in every use case.

mandatorySteps :: [Step] -> StepGroup Source #

Specifies multiple consecutive steps that all must exist in some form in every use case.

libFunction :: Requires -> CodeFuncChunk -> [Argument] -> FunctionInterface Source #

Specifies a call to an external library function.

libMethod :: Requires -> CodeVarChunk -> CodeFuncChunk -> [Argument] -> FunctionInterface Source #

Specifies a call to an external library method.

libFunctionWithResult :: Requires -> CodeFuncChunk -> [Argument] -> CodeVarChunk -> FunctionInterface Source #

Specifies a call to an external library function, where the result is assigned to a variable.

libMethodWithResult :: Requires -> CodeVarChunk -> CodeFuncChunk -> [Argument] -> CodeVarChunk -> FunctionInterface Source #

Specifies a call to an external library method, where the result is assigned to a variable.

libConstructor :: Requires -> CodeFuncChunk -> [Argument] -> CodeVarChunk -> FunctionInterface Source #

Specifies a call to an external library constructor, where the result is assigned to a variable.

libConstructorMultiReqs :: [Requires] -> CodeFuncChunk -> [Argument] -> CodeVarChunk -> FunctionInterface Source #

Specifies a call to an external library function, where multiple modules from the external library are required, and the result is assigned to a variable.

constructAndReturn :: Requires -> CodeFuncChunk -> [Argument] -> FunctionInterface Source #

Specifies a call to an external library constructor, where the result is returned.

lockedArg :: CodeExpr -> Argument Source #

Specifies an argument that is not use-case-dependent.

lockedNamedArg :: NamedArgument -> CodeExpr -> Argument Source #

Specifies a named argument that is not use-case-dependent.

inlineArg :: Space -> Argument Source #

Specifies a use-case-dependent argument whose value can be inlined in the call.

inlineNamedArg :: NamedArgument -> Space -> Argument Source #

Specifies a use-case-dependent named argument whose value can be inlined in the call.

preDefinedArg :: CodeVarChunk -> Argument Source #

Specifies use-case-dependent argument whose value must be assigned to a variable before being passed in the call.

preDefinedNamedArg :: NamedArgument -> CodeVarChunk -> Argument Source #

Specifies use-case-dependent named argument whose value must be assigned to a variable before being passed in the call.

functionArg :: CodeFuncChunk -> [Parameter] -> Step -> Argument Source #

Specifies a function type argument, where the body consists of a single step.

customObjArg :: [Requires] -> Description -> CodeVarChunk -> CodeFuncChunk -> ClassInfo -> Argument Source #

Specifies an argument that is an object of a class that must be defined in the calling program.

recordArg :: Requires -> CodeFuncChunk -> CodeVarChunk -> [CodeVarChunk] -> Argument Source #

Specifies an argument that is an object of a class from the external library. The list of [CodeVarChunk] represents fields of the object that must be set in the calling program.

lockedParam :: CodeVarChunk -> Parameter Source #

Specifies a use-case-independent parameter.

unnamedParam :: Space -> Parameter Source #

Specifies a parameter whose name depends on the use case.

customClass :: [MethodInfo] -> ClassInfo Source #

Specifies a class that must be implemented in the calling program.

implementation :: String -> [MethodInfo] -> ClassInfo Source #

Specifies an implementation of an interface from the external library.

constructorInfo :: CodeFuncChunk -> [Parameter] -> [Step] -> MethodInfo Source #

Specifies a constructor.

methodInfo :: CodeFuncChunk -> Description -> [Parameter] -> Description -> [Step] -> MethodInfo Source #

Specifies a method.

methodInfoNoReturn :: CodeFuncChunk -> Description -> [Parameter] -> [Step] -> MethodInfo Source #

Specifies a method that does not return anything.

appendCurrSol :: CodeExpr -> Step Source #

Specifies a statement where a current solution is appended to a solution list.

populateSolList :: CodeVarChunk -> CodeVarChunk -> CodeVarChunk -> [Step] Source #

Specifies a statement where a solution list is populated by iterating through a solution array.

assignArrayIndex :: Step Source #

Specifies statements where every index of an array is assigned a value.

assignSolFromObj :: CodeVarChunk -> Step Source #

Specifies a statement where a solution is assigned from the field of an object.

initSolListFromArray :: CodeVarChunk -> Step Source #

Specifies a statement where a solution list is initialized with the first element of an array.

initSolListWithVal :: Step Source #

Specifies a statement where a solution list is initialized with the first value.

solveAndPopulateWhile :: FunctionInterface -> CodeVarChunk -> CodeVarChunk -> FunctionInterface -> CodeVarChunk -> Step Source #

A solve and populate loop. FunctionInterface for loop condition, CodeChunk for solution object, CodeChunk for independent var, FunctionInterface for solving, CodeChunk for soln array to populate with.

returnExprList :: Step Source #

Specifies a statement where a list is returned, where each value of the list is explicitly defined.

fixedReturn :: CodeExpr -> Step Source #

Specifies a use-case-independent statement that returns a fixed value.

fixedReturn' :: Step Source #

Specifies a use-case-dependent statement that returns a non-fixed value.

initSolWithVal :: Step Source #

Specifies a statement where a single solution is initialized with a value.

type ExternalLibraryCall = [StepGroupFill] Source #

External library call holds a group of step groups.

data StepGroupFill Source #

Holds a group of steps (StepFills). The Int is to "choose" from the options in ExternalLibrary.

Constructors

SGF Int [StepFill] 

data StepFill Source #

Mirrors ExternalLibrary's Step. A StepFill can be a call to an external library function or method.

newtype FunctionIntFill Source #

Mirrors ExternalLibrary's FunctionInterface.

Constructors

FIF [ArgumentFill] 

data ArgumentFill Source #

Mirrors ExternalLibrary's ArgumentInfo. Determines the context needed for an argument to work.

Constructors

UserDefinedArgF (Maybe NamedArgument) CodeExpr

For arguments that are completely dependent on use case.

BasicF CodeExpr

A basic function.

FnF [ParameterFill] StepFill

Fills in the names for the unnamed parameters.

ClassF [StateVariable] ClassInfoFill

List of CodeChunk for state variables.

RecordF [CodeExpr]

Fills in the field values.

data ParameterFill Source #

Mirrors ExternalLibrary's Parameter.

Constructors

NameableParamF ParameterChunk 
UserDefined ParameterChunk 

data ClassInfoFill Source #

Mirrors ExternalLibrary's ClassInfo.

data MethodInfoFill Source #

Mirrors ExternalLibrary's MethodInfo.

Constructors

CIF [ParameterFill] [Initializer] [StepFill] 
MIF [ParameterFill] (NonEmpty StepFill) 

externalLibCall :: [StepGroupFill] -> ExternalLibraryCall Source #

Constructs an ExternalLibraryCall specification.

choiceStepsFill :: Int -> [StepFill] -> StepGroupFill Source #

Corresponds to ExternalLibrary's choiceSteps. Provides the index of the steps that should be used for the current use case.

choiceStepFill :: Int -> StepFill -> StepGroupFill Source #

Corresponds to ExternalLibrary's choiceStep. Provides the index of the step that should be used for the current use case.

mandatoryStepFill :: StepFill -> StepGroupFill Source #

Corresponds to ExternalLibrary's mandatorySteps.

mandatoryStepsFill :: [StepFill] -> StepGroupFill Source #

Corresponds to ExternalLibrary's mandatoryStep.

callStepFill :: FunctionIntFill -> StepFill Source #

Corresponds to ExternalLibrary's callStep.

libCallFill :: [ArgumentFill] -> FunctionIntFill Source #

Corresponds to any of ExternalLibrary's FunctionInterface constructors.

userDefinedArgFill :: CodeExpr -> ArgumentFill Source #

Does not correspond to anything in ExternalLibrary. To be used when the presence of an argument is only a consequence of the use case.

basicArgFill :: CodeExpr -> ArgumentFill Source #

Corresponds to ExternalLibrary's inlineArg, inlineNamedArg, preDefinedArg, and preDefinedNamedArg. Provides the CodeExpr for the argument's value.

functionArgFill :: [ParameterFill] -> StepFill -> ArgumentFill Source #

Corresponds to ExternalLibrary's functionArg.

customObjArgFill :: [StateVariable] -> ClassInfoFill -> ArgumentFill Source #

Corresponds to ExternalLibrary's customObjArg. Provides the list of state variables for the class that must be written in the calling program.

recordArgFill :: [CodeExpr] -> ArgumentFill Source #

Corresponds to ExternalLibrary's recordArg. Provides the list of CodeExprs for the values of the fields that must be set by the calling program.

unnamedParamFill :: CodeVarChunk -> ParameterFill Source #

Corresponds to ExternalLibrary's unnamedParam. Provides the CodeVarChunk representing the parameter.

unnamedParamPBVFill :: CodeVarChunk -> ParameterFill Source #

Corresponds to ExternalLibrary's unnamedParam. Provides the CodeVarChunk representing the parameter. Specifies that the parameter is passed by value.

userDefinedParamFill :: CodeVarChunk -> ParameterFill Source #

Does not correspond to anything in ExternalLibrary. To be used when the presence of a parameter is only a consequence of the use case.

customClassFill :: [MethodInfoFill] -> ClassInfoFill Source #

Corresponds to ExternalLibrary's customClass.

implementationFill :: [MethodInfoFill] -> ClassInfoFill Source #

Corresponds to ExternalLibrary's implementation.

constructorInfoFill :: [ParameterFill] -> [Initializer] -> [StepFill] -> MethodInfoFill Source #

Corresponds to ExternalLibrary's constructorInfo. Provides Variable-Value pairs for variables initialized by the constructor.

methodInfoFill :: [ParameterFill] -> [StepFill] -> MethodInfoFill Source #

Corresponds to ExternalLibrary's methodInfo.

appendCurrSolFill :: CodeVarChunk -> StepFill Source #

Corresponds to ExternalLibrary's appendCurrSol. Provides the CodeVarChunk for the solution list.

populateSolListFill :: CodeVarChunk -> [StepFill] Source #

Corresponds to ExternalLibrary's populateSolList. Provides the CodeVarChunk for the solution list.

assignArrayIndexFill :: CodeVarChunk -> [CodeExpr] -> StepFill Source #

Corresponds to ExternalLibrary's assignArrayIndex. Provides the CodeVarChunk for the array variable. Provides the CodeExprs for the values to assign to each array index.

assignSolFromObjFill :: CodeVarChunk -> StepFill Source #

Corresponds to ExternalLibrary's assignSolFromObj. Provides the CodeVarChunk for the variable that the solution should be assigned to.

initSolListFromArrayFill :: CodeVarChunk -> StepFill Source #

Corresponds to ExternalLibrary's initSolListFromArray. Provides the CodeVarChunk for the solution list.

initSolListWithValFill :: CodeVarChunk -> CodeExpr -> StepFill Source #

Corresponds to ExternalLibrary's initSolListWithVal. Provides the CodeVarChunk for the solution list and the CodeExpr for the initial element of the solution list

solveAndPopulateWhileFill :: FunctionIntFill -> CodeExpr -> FunctionIntFill -> CodeVarChunk -> StepFill Source #

Corresponds to ExternalLibrary's solveAndPopulateWhile. Provides the CodeExpr for the upper bound in the while loop condition and the CodeVarChunk for the solution list.

returnExprListFill :: [CodeExpr] -> StepFill Source #

Corresponds to ExternalLibrary's returnExprList. Provides the list of CodeExprs to return.

fixedStatementFill :: StepFill Source #

Corresponds to ExternalLibrary's fixedReturn. No parameters because the statement is not use-case-dependent.

fixedStatementFill' :: CodeExpr -> StepFill Source #

Corresponds to ExternalLibrary's fixedReturn'. use-case-specific a CodeExpr that parameterize the statement.

initSolWithValFill :: CodeVarChunk -> CodeExpr -> StepFill Source #

Corresponds to ExternalLibrary's initSolWithVal. Provides the CodeVarChunk for one solution and one CodeExpr for the initial element of the solution list

data Lang Source #

Various OO languages where code may be generated.

Constructors

Cpp 
CSharp 
Java 
Python 
Swift 

Instances

Instances details
Show Lang Source # 
Instance details

Defined in Language.Drasil.Code.Lang

Methods

showsPrec :: Int -> Lang -> ShowS #

show :: Lang -> String #

showList :: [Lang] -> ShowS #

Eq Lang Source # 
Instance details

Defined in Language.Drasil.Code.Lang

Methods

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

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

class AuxiliarySym r => PackageSym r where Source #

Members of this class must have all the information necessary for the AuxiliarySym in addition to information necessary to create a package.

Associated Types

type Package r Source #

Methods

package :: ProgData -> [r (Auxiliary r)] -> r (Package r) Source #

class AuxiliarySym r where Source #

Members of this class must have a doxygen configuration, ReadMe file, sample input, omptimize doxygen document, information necessary for a makefile, auxiliary helper documents, and auxiliary from data documents.

Associated Types

type Auxiliary r Source #

type AuxHelper r Source #

data AuxData Source #

The underlying data type for auxiliary files in all renderers.

data PackData Source #

The underlying data type for packages in all renderers.

data CodeChunk #

Basic chunk representation in the code generation context. Contains a QuantityDict and the kind of code (variable or function).

Instances

Instances details
CodeIdea CodeChunk Source #

Finds the code name of a CodeChunk.

Instance details

Defined in Language.Drasil.Chunk.Code

Idea CodeChunk

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

Instance details

Defined in Language.Drasil.Chunk.CodeVar

Methods

getA :: CodeChunk -> Maybe String #

NamedIdea CodeChunk

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

Instance details

Defined in Language.Drasil.Chunk.CodeVar

Methods

term :: Lens' CodeChunk NP #

MayHaveUnit CodeChunk

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

Instance details

Defined in Language.Drasil.Chunk.CodeVar

Quantity CodeChunk

CodeChunks have a Quantity.

Instance details

Defined in Language.Drasil.Chunk.CodeVar

HasSpace CodeChunk

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

Instance details

Defined in Language.Drasil.Chunk.CodeVar

Methods

typ :: Getter CodeChunk Space #

HasSymbol CodeChunk

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

Instance details

Defined in Language.Drasil.Chunk.CodeVar

Methods

symbol :: CodeChunk -> Stage -> Symbol #

HasUID CodeChunk

Finds the UID of the QuantityDict used to make the CodeChunk.

Instance details

Defined in Language.Drasil.Chunk.CodeVar

Methods

uid :: Lens' CodeChunk UID #

Eq CodeChunk

Equal if UIDs are equal.

Instance details

Defined in Language.Drasil.Chunk.CodeVar

data CodeVarChunk #

Chunk representing a variable. The obv field represents the object containing this variable, if it is an object field.

Instances

Instances details
CodeIdea CodeVarChunk Source #

Finds the code name and CodeChunk within a CodeVarChunk.

Instance details

Defined in Language.Drasil.Chunk.Code

Idea CodeVarChunk

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

Instance details

Defined in Language.Drasil.Chunk.CodeVar

NamedIdea CodeVarChunk

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

Instance details

Defined in Language.Drasil.Chunk.CodeVar

Methods

term :: Lens' CodeVarChunk NP #

MayHaveUnit CodeVarChunk

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

Instance details

Defined in Language.Drasil.Chunk.CodeVar

Quantity CodeVarChunk

CodeVarChunks have a Quantity.

Instance details

Defined in Language.Drasil.Chunk.CodeVar

HasSpace CodeVarChunk

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

Instance details

Defined in Language.Drasil.Chunk.CodeVar

Methods

typ :: Getter CodeVarChunk Space #

HasSymbol CodeVarChunk

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

Instance details

Defined in Language.Drasil.Chunk.CodeVar

Methods

symbol :: CodeVarChunk -> Stage -> Symbol #

HasUID CodeVarChunk

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

Instance details

Defined in Language.Drasil.Chunk.CodeVar

Methods

uid :: Lens' CodeVarChunk UID #

Eq CodeVarChunk

Equal if UIDs are equal.

Instance details

Defined in Language.Drasil.Chunk.CodeVar

data CodeFuncChunk #

Chunk representing a function.

Instances

Instances details
CodeIdea CodeFuncChunk Source #

Finds the code name and CodeChunk within a CodeFuncChunk.

Instance details

Defined in Language.Drasil.Chunk.Code

Idea CodeFuncChunk

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

Instance details

Defined in Language.Drasil.Chunk.CodeVar

NamedIdea CodeFuncChunk

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

Instance details

Defined in Language.Drasil.Chunk.CodeVar

Methods

term :: Lens' CodeFuncChunk NP #

MayHaveUnit CodeFuncChunk

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

Instance details

Defined in Language.Drasil.Chunk.CodeVar

Callable CodeFuncChunk

Functions are Callable.

Instance details

Defined in Language.Drasil.Chunk.CodeVar

Quantity CodeFuncChunk

CodeFuncChunks have a Quantity.

Instance details

Defined in Language.Drasil.Chunk.CodeVar

HasSpace CodeFuncChunk

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

Instance details

Defined in Language.Drasil.Chunk.CodeVar

Methods

typ :: Getter CodeFuncChunk Space #

HasSymbol CodeFuncChunk

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

Instance details

Defined in Language.Drasil.Chunk.CodeVar

HasUID CodeFuncChunk

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

Instance details

Defined in Language.Drasil.Chunk.CodeVar

Methods

uid :: Lens' CodeFuncChunk UID #

Eq CodeFuncChunk

Equal if UIDs are equal.

Instance details

Defined in Language.Drasil.Chunk.CodeVar

quantvar :: (Quantity c, MayHaveUnit c) => c -> CodeVarChunk Source #

Construct a CodeVarChunk from a Quantity.

ccObjVar :: CodeVarChunk -> CodeVarChunk -> CodeVarChunk Source #

Combine an Object-type CodeChunk with another CodeChunk to create a new CodeChunk which represents a field of the first. ex. ccObjVar obj f = obj.f.

field :: CodeExprC r => CodeVarChunk -> CodeVarChunk -> r #

Constructs a CodeExpr representing the field of an actor

data ODEInfo Source #

Structure to hold ODE information.

Constructors

ODEInfo 

Fields

odeInfo' :: [CodeVarChunk] -> ODEOptions -> DifferentialModel -> InitialValueProblem -> ODEInfo Source #

Create ODEInfo with Other variables, ODEOptions, DifferentialModel, and InitialValueProblem

data ODEOptions Source #

Other parameters for solving the ODE numerically

Constructors

ODEOpts 

Fields

data ODEMethod Source #

Methods for solving ODEs. Includes Runge-Kutta 4-5, Backwards Differentiation Formula, or Adams' method.

Constructors

RK45 
BDF 
Adams 

data ODELibPckg Source #

Holds an ODE library package.

Constructors

ODELib 

Fields

mkODELib :: Name -> Version -> ExternalLibrary -> (ODEInfo -> ExternalLibraryCall) -> FilePath -> [Lang] -> ODELibPckg Source #

Makes an ODELibPckg with the given name, ExternalLibrary specification, ExternalLibraryCall specification parameterized by an ODEInfo, local file path to the library, and list of compatible languages.

mkODELibNoPath :: Name -> Version -> ExternalLibrary -> (ODEInfo -> ExternalLibraryCall) -> [Lang] -> ODELibPckg Source #

Makes an ODELibPckg with the given name, ExternalLibrary specification, ExternalLibraryCall specification parameterized by an ODEInfo, and list of compatible languages.

unPP :: PythonProject a -> a Source #

unJP :: JavaProject a -> a Source #

unCSP :: CSharpProject a -> a Source #

unCPPP :: CppProject a -> a Source #

unSP :: SwiftProject a -> a Source #

data NamedArgument Source #

Any quantity can be a named argument (wrapper for QuantityDict), but with more of a focus on generating code arguments.

Instances

Instances details
Idea NamedArgument Source #

Finds the idea contained in the QuantityDict used to make the NamedArgument.

Instance details

Defined in Language.Drasil.Chunk.NamedArgument

NamedIdea NamedArgument Source #

Finds the term (NP) of the QuantityDict used to make the NamedArgument.

Instance details

Defined in Language.Drasil.Chunk.NamedArgument

Methods

term :: Lens' NamedArgument NP #

MayHaveUnit NamedArgument Source #

Finds the units of the QuantityDict used to make the NamedArgument.

Instance details

Defined in Language.Drasil.Chunk.NamedArgument

IsArgumentName NamedArgument Source #

NamedArguments have an argument name.

Instance details

Defined in Language.Drasil.Chunk.NamedArgument

Quantity NamedArgument Source #

NamedArguments have a Quantity.

Instance details

Defined in Language.Drasil.Chunk.NamedArgument

HasSpace NamedArgument Source #

Finds the Space of the QuantityDict used to make the NamedArgument.

Instance details

Defined in Language.Drasil.Chunk.NamedArgument

Methods

typ :: Getter NamedArgument Space #

HasSymbol NamedArgument Source #

Finds the Symbol of the QuantityDict used to make the NamedArgument.

Instance details

Defined in Language.Drasil.Chunk.NamedArgument

HasUID NamedArgument Source #

Finds the UID of the QuantityDict used to make the NamedArgument.

Instance details

Defined in Language.Drasil.Chunk.NamedArgument

Methods

uid :: Lens' NamedArgument UID #

Eq NamedArgument Source #

Equal if UIDs are equal.

Instance details

Defined in Language.Drasil.Chunk.NamedArgument

narg :: (Quantity q, MayHaveUnit q) => q -> NamedArgument Source #

Smart constructor for NamedArgument .