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

Language.Drasil.Chunk.Code

Description

Defines chunk types for use in code generation.

Synopsis

Documentation

class CodeIdea c where #

A CodeIdea must include some code and its name.

Methods

codeName :: c -> String #

Name of the idea.

codeChunk :: c -> CodeChunk #

Code chunk associated with the idea.

Instances

Instances details
CodeIdea CodeFuncChunk Source #

Finds the code name and CodeChunk within a CodeFuncChunk.

Instance details

Defined in Language.Drasil.Chunk.Code

CodeIdea CodeVarChunk Source #

Finds the code name and CodeChunk within a CodeVarChunk.

Instance details

Defined in Language.Drasil.Chunk.Code

CodeIdea CodeChunk Source #

Finds the code name of a CodeChunk.

Instance details

Defined in Language.Drasil.Chunk.Code

CodeIdea ParameterChunk Source #

Finds the code name and CodeChunk of a ParameterChunk.

Instance details

Defined in Language.Drasil.Chunk.Parameter

CodeIdea CodeDefinition Source #

Finds the code name of a CodeDefinition. Function CodeDefinitions are named with the function prefix to distinguish them from the corresponding variable version.

Instance details

Defined in Language.Drasil.Chunk.CodeDefinition

data CodeChunk #

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

Equal if UIDs are equal.

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Quantity CodeChunk

CodeChunks have a Quantity.

Instance details

Defined in Language.Drasil.Chunk.CodeBase

CodeIdea CodeChunk Source #

Finds the code name of a CodeChunk.

Instance details

Defined in Language.Drasil.Chunk.Code

NamedIdea CodeChunk

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

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Idea CodeChunk

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

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

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

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 #

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

Equal if UIDs are equal.

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Quantity CodeVarChunk

CodeVarChunks have a Quantity.

Instance details

Defined in Language.Drasil.Chunk.CodeBase

CodeIdea CodeVarChunk Source #

Finds the code name and CodeChunk within a CodeVarChunk.

Instance details

Defined in Language.Drasil.Chunk.Code

NamedIdea CodeVarChunk

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

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Idea CodeVarChunk

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

HasSpace CodeVarChunk

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

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

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 #

Chunk representing a function.

Constructors

CodeFC 

Fields

Instances

Instances details
Eq CodeFuncChunk

Equal if UIDs are equal.

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Quantity CodeFuncChunk

CodeFuncChunks have a Quantity.

Instance details

Defined in Language.Drasil.Chunk.CodeBase

CodeIdea CodeFuncChunk Source #

Finds the code name and CodeChunk within a CodeFuncChunk.

Instance details

Defined in Language.Drasil.Chunk.Code

NamedIdea CodeFuncChunk

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

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Callable CodeFuncChunk

Functions are Callable.

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Idea CodeFuncChunk

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

HasSpace CodeFuncChunk

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

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

HasUID CodeFuncChunk

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

Instance details

Defined in Language.Drasil.Chunk.CodeBase

Methods

uid :: Lens' CodeFuncChunk UID #

data VarOrFunc #

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

Constructors

Var 
Func 

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

Construct a CodeVarChunk from a Quantity.

quantfunc :: (Quantity c, MayHaveUnit c) => c -> CodeFuncChunk #

Construct a CodeFuncChunk 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.

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

Get a list of CodeChunks from an equation.

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

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

varResolve :: ChunkDB -> UID -> CodeVarChunk #

Make a CodeVarChunk from a UID in the ChunkDB.

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

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

funcPrefix :: String #

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

class CodeIdea c => DefiningCodeExpr c where #

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

Methods

codeExpr :: Lens' c CodeExpr #

Instances

Instances details
DefiningCodeExpr CodeDefinition Source #

Finds the defining expression of a CodeDefinition.

Instance details

Defined in Language.Drasil.Chunk.CodeDefinition

Orphan instances

CodeIdea CodeFuncChunk Source #

Finds the code name and CodeChunk within a CodeFuncChunk.

Instance details

CodeIdea CodeVarChunk Source #

Finds the code name and CodeChunk within a CodeVarChunk.

Instance details

CodeIdea CodeChunk Source #

Finds the code name of a CodeChunk.

Instance details