| Safe Haskell | Safe-Inferred | 
|---|---|
| Language | Haskell2010 | 
Language.Drasil.Chunk.Code
Contents
Description
Defines chunk types for use in code generation.
Synopsis
- class CodeIdea c where
 - data CodeChunk = CodeC {}
 - data CodeVarChunk = CodeVC {}
 - newtype CodeFuncChunk = CodeFC {}
 - data VarOrFunc
 - obv :: Lens' CodeVarChunk (Maybe CodeChunk)
 - quantvar :: (Quantity c, MayHaveUnit c, Concept c) => c -> CodeVarChunk
 - quantfunc :: (Quantity c, MayHaveUnit c, Concept c) => c -> CodeFuncChunk
 - ccObjVar :: CodeVarChunk -> CodeVarChunk -> CodeVarChunk
 - codevars :: CodeExpr -> ChunkDB -> [CodeVarChunk]
 - codevars' :: CodeExpr -> ChunkDB -> [CodeVarChunk]
 - funcResolve :: ChunkDB -> UID -> CodeFuncChunk
 - varResolve :: ChunkDB -> UID -> CodeVarChunk
 - listToArray :: CodeVarChunk -> CodeVarChunk
 - programName :: CommonIdea c => c -> String
 - funcPrefix :: String
 - class CodeIdea c => DefiningCodeExpr c where
 
Documentation
A CodeIdea must include some code and its name. 
Methods
Name of the idea.
Code chunk associated with the idea.
Instances
| CodeIdea CodeDefinition Source # | Finds the code name of a   | 
Defined in Language.Drasil.Chunk.CodeDefinition  | |
| CodeIdea ParameterChunk Source # | Finds the code name and   | 
Defined in Language.Drasil.Chunk.Parameter  | |
| CodeIdea CodeChunk Source # | Finds the code name of a   | 
| CodeIdea CodeFuncChunk Source # | Finds the code name and   | 
Defined in Language.Drasil.Chunk.Code  | |
| CodeIdea CodeVarChunk Source # | Finds the code name and   | 
Defined in Language.Drasil.Chunk.Code  | |
Basic chunk representation in the code generation context. Contains a DefinedQuantityDict and the kind of code (variable or function).
Constructors
| CodeC | |
Fields 
  | |
Instances
| CodeIdea CodeChunk Source # | Finds the code name of a   | 
| HasUID CodeChunk | Finds the   | 
Defined in Drasil.Code.CodeVar  | |
| Idea CodeChunk | Finds the idea contained in the   | 
| NamedIdea CodeChunk | Finds the term (  | 
Defined in Drasil.Code.CodeVar  | |
| MayHaveUnit CodeChunk | Finds the units of the   | 
| ConceptDomain CodeChunk | |
Defined in Drasil.Code.CodeVar  | |
| Definition CodeChunk | Finds the Definition contained in the   | 
Defined in Drasil.Code.CodeVar  | |
| Quantity CodeChunk | |
Defined in Drasil.Code.CodeVar  | |
| HasSpace CodeChunk | Finds the   | 
Defined in Drasil.Code.CodeVar  | |
| HasSymbol CodeChunk | Finds the   | 
| Eq CodeChunk | Equal if   | 
data CodeVarChunk #
Chunk representing a variable. The obv field represents the object containing 
 this variable, if it is an object field.
Instances
newtype CodeFuncChunk #
Chunk representing a function.
Instances
Details if a piece of code is meant to be a variable or a function.
obv :: Lens' CodeVarChunk (Maybe CodeChunk) #
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.
ccObjVar :: CodeVarChunk -> CodeVarChunk -> CodeVarChunk Source #
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).
funcResolve :: ChunkDB -> UID -> CodeFuncChunk Source #
Make a CodeFuncChunk from a UID in the ChunkDB.
varResolve :: ChunkDB -> UID -> CodeVarChunk Source #
Make a CodeVarChunk from a UID in the ChunkDB.
listToArray :: CodeVarChunk -> CodeVarChunk #
programName :: CommonIdea c => c -> String #
Convert an abbreviation into one deemed 'code-friendly', removing spaces, and replacing special characters with underscores.
FIXME: This should NOT be treated as a getter, but something we cache
   local to something that has a 'program name'.
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.
Instances
| DefiningCodeExpr CodeDefinition Source # | Finds the defining expression of a CodeDefinition.  | 
Defined in Language.Drasil.Chunk.CodeDefinition Methods codeExpr :: Lens' CodeDefinition CodeExpr #  | |
Orphan instances
| CodeIdea CodeChunk Source # | Finds the code name of a   | 
| CodeIdea CodeFuncChunk Source # | Finds the code name and   | 
| CodeIdea CodeVarChunk Source # | Finds the code name and   |