| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Drasil.Code.CodeVar
Description
Defines chunk types for use in code generation.
Synopsis
- class CodeIdea c where
- class CodeIdea c => DefiningCodeExpr c where
- data VarOrFunc
- data CodeChunk = CodeC {}
- qc :: Lens' CodeChunk DefinedQuantityDict
- data CodeVarChunk = CodeVC {}
- ccv :: Lens' CodeVarChunk CodeChunk
- obv :: Lens' CodeVarChunk (Maybe CodeChunk)
- newtype CodeFuncChunk = CodeFC {}
- ccf :: Iso' CodeFuncChunk CodeChunk
- funcPrefix :: String
- listToArray :: CodeVarChunk -> CodeVarChunk
- quantvar :: (Quantity c, MayHaveUnit c, Concept c) => c -> CodeVarChunk
- quantfunc :: (Quantity c, MayHaveUnit c, Concept c) => c -> CodeFuncChunk
Documentation
class CodeIdea c => DefiningCodeExpr c where Source #
A DefiningCodeExpr must have it's underlying chunk
defined in the CodeExpr language.
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 DefinedQuantityDict and the kind of code (variable or function).
Constructors
| CodeC | |
Fields
| |
Instances
qc :: Lens' CodeChunk DefinedQuantityDict 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 #
funcPrefix :: String Source #
Used when a function name needs to be distinguishable from a variable name.
quantvar :: (Quantity c, MayHaveUnit c, Concept c) => c -> CodeVarChunk Source #
Construct a CodeVarChunk from a Quantity.
quantfunc :: (Quantity c, MayHaveUnit c, Concept c) => c -> CodeFuncChunk Source #
Construct a CodeFuncChunk from a Quantity.