drasil-code-base-0.1.9.0: A framework for code and document generation for scientific software - Build System SubPackage
Safe HaskellNone
LanguageHaskell2010

Language.Drasil.Chunk.CodeBase

Description

Defines chunk types for use in code generation.

Synopsis

Documentation

class CodeIdea c where Source #

A CodeIdea must include some code and its name.

Methods

codeName :: c -> String Source #

Name of the idea.

codeChunk :: c -> CodeChunk Source #

Code chunk associated with the idea.

class CodeIdea c => DefiningCodeExpr c where Source #

A DefiningCodeExpr must have it's underlying chunk defined in the CodeExpr language.

Methods

codeExpr :: Lens' c CodeExpr Source #

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

Convert the program name to an abbreviated String without any special characters.

funcPrefix :: String Source #

Used when a function name needs to be distinguishable from a variable name.

data VarOrFunc Source #

Details if a piece of code is meant to be a variable or a function.

Constructors

Var 
Func 

data CodeChunk Source #

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

Constructors

CodeC 

Instances

Instances details
Eq CodeChunk Source #

Equal if UIDs are equal.

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Quantity CodeChunk Source #

CodeChunks have a Quantity.

Instance details

Defined in Language.Drasil.Chunk.CodeBase

NamedIdea CodeChunk Source #

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Methods

term :: Lens' CodeChunk NP #

MayHaveUnit CodeChunk Source #

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Idea CodeChunk Source #

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Methods

getA :: CodeChunk -> Maybe String #

HasSpace CodeChunk Source #

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Methods

typ :: Lens' CodeChunk Space #

HasSymbol CodeChunk Source #

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Methods

symbol :: CodeChunk -> Stage -> Symbol #

HasUID CodeChunk Source #

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Methods

uid :: Lens' CodeChunk UID #

data CodeVarChunk Source #

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

Constructors

CodeVC 

Instances

Instances details
Eq CodeVarChunk Source #

Equal if UIDs are equal.

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Quantity CodeVarChunk Source #

CodeVarChunks have a Quantity.

Instance details

Defined in Language.Drasil.Chunk.CodeBase

NamedIdea CodeVarChunk Source #

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Methods

term :: Lens' CodeVarChunk NP #

MayHaveUnit CodeVarChunk Source #

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Idea CodeVarChunk Source #

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

HasSpace CodeVarChunk Source #

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Methods

typ :: Lens' CodeVarChunk Space #

HasSymbol CodeVarChunk Source #

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Methods

symbol :: CodeVarChunk -> Stage -> Symbol #

HasUID CodeVarChunk Source #

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Methods

uid :: Lens' CodeVarChunk UID #

newtype CodeFuncChunk Source #

Chunk representing a function.

Constructors

CodeFC 

Fields

Instances

Instances details
Eq CodeFuncChunk Source #

Equal if UIDs are equal.

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Quantity CodeFuncChunk Source #

CodeFuncChunks have a Quantity.

Instance details

Defined in Language.Drasil.Chunk.CodeBase

NamedIdea CodeFuncChunk Source #

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Methods

term :: Lens' CodeFuncChunk NP #

MayHaveUnit CodeFuncChunk Source #

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Callable CodeFuncChunk Source #

Functions are Callable.

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Idea CodeFuncChunk Source #

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

HasSpace CodeFuncChunk Source #

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Methods

typ :: Lens' CodeFuncChunk Space #

HasSymbol CodeFuncChunk Source #

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

HasUID CodeFuncChunk Source #

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Methods

uid :: Lens' CodeFuncChunk UID #

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

Construct a CodeVarChunk from a Quantity.

codevars :: CodeExpr -> ChunkDB -> [CodeVarChunk] Source #

Get a list of CodeChunks from an equation.

codevars' :: CodeExpr -> ChunkDB -> [CodeVarChunk] Source #

Get a list of CodeChunks from an equation (no functions).