Safe Haskell | None |
---|---|
Language | Haskell2010 |
Language.Drasil.Chunk.CodeBase
Description
Defines chunk types for use in code generation.
Synopsis
- class CodeIdea c where
- class CodeIdea c => DefiningCodeExpr c where
- programName :: CommonIdea c => c -> String
- funcPrefix :: String
- data VarOrFunc
- data CodeChunk = CodeC {
- _qc :: QuantityDict
- kind :: VarOrFunc
- qc :: Lens' CodeChunk QuantityDict
- data CodeVarChunk = CodeVC {}
- obv :: Lens' CodeVarChunk (Maybe CodeChunk)
- ccv :: Lens' CodeVarChunk CodeChunk
- newtype CodeFuncChunk = CodeFC {}
- ccf :: Iso' CodeFuncChunk CodeChunk
- quantvar :: (Quantity c, MayHaveUnit c) => c -> CodeVarChunk
- quantfunc :: (Quantity c, MayHaveUnit c) => c -> CodeFuncChunk
- codevars :: CodeExpr -> ChunkDB -> [CodeVarChunk]
- codevars' :: CodeExpr -> ChunkDB -> [CodeVarChunk]
- varResolve :: ChunkDB -> UID -> CodeVarChunk
- funcResolve :: ChunkDB -> UID -> CodeFuncChunk
- listToArray :: CodeVarChunk -> CodeVarChunk
Documentation
class CodeIdea c => DefiningCodeExpr c where Source #
A DefiningCodeExpr
must have it's underlying chunk
defined in the CodeExpr language.
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.
Details if a piece of code is meant to be a variable or a function.
Basic chunk representation in the code generation context. Contains a QuantityDict and the kind of code (variable or function).
Constructors
CodeC | |
Fields
|
Instances
Eq CodeChunk Source # | Equal if |
Quantity CodeChunk Source # | |
Defined in Language.Drasil.Chunk.CodeBase | |
NamedIdea CodeChunk Source # | Finds the term ( |
Defined in Language.Drasil.Chunk.CodeBase | |
MayHaveUnit CodeChunk Source # | Finds the units of the |
Idea CodeChunk Source # | Finds the idea contained in the |
HasSpace CodeChunk Source # | Finds the |
Defined in Language.Drasil.Chunk.CodeBase | |
HasSymbol CodeChunk Source # | Finds the |
HasUID CodeChunk Source # | Finds the |
Defined in Language.Drasil.Chunk.CodeBase |
qc :: Lens' CodeChunk QuantityDict Source #
data CodeVarChunk Source #
Chunk representing a variable. The obv
field represents the object containing
this variable, if it is an object field.
Instances
ccv :: Lens' CodeVarChunk CodeChunk Source #
newtype CodeFuncChunk Source #
Chunk representing a function.
Instances
ccf :: Iso' CodeFuncChunk CodeChunk Source #
quantvar :: (Quantity c, MayHaveUnit c) => c -> CodeVarChunk Source #
Construct a CodeVarChunk
from a Quantity
.
quantfunc :: (Quantity c, MayHaveUnit c) => c -> CodeFuncChunk Source #
Construct a CodeFuncChunk
from a Quantity
.
codevars :: CodeExpr -> ChunkDB -> [CodeVarChunk] Source #
Get a list of CodeChunk
s from an equation.
codevars' :: CodeExpr -> ChunkDB -> [CodeVarChunk] Source #
Get a list of CodeChunk
s from an equation (no functions).
varResolve :: ChunkDB -> UID -> CodeVarChunk Source #
Make a CodeVarChunk
from a UID
in the ChunkDB
.
funcResolve :: ChunkDB -> UID -> CodeFuncChunk Source #
Make a CodeFuncChunk
from a UID
in the ChunkDB
.