| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Drasil.GProc
Description
re-export smart constructors for external code writing
Synopsis
- type Label = String
- type GSProgram (a :: k -> Type) (prg :: k) = GS (a prg)
- type Body = Doc
- type FS = State FileState
- type MS = State MethodState
- type VS = State ValueState
- type SVariable (a :: Type -> Type) = VS (a Variable)
- type SValue (a :: Type -> Type) = VS (a Value)
- type NamedArgs (r :: Type -> Type) = [(SVariable r, SValue r)]
- class (UnRepr r TypeData, BodySym r bod block, BlockSym r block stmt, FunctionSym r, VariableValue r, ScopeSym r, BinderSym r, InternalList r block, MethodSym r vis mthd bod, TypeElim r, VariableElim r, Array r, EmptyStatement r stmt, MultiStatement r stmt, ValueStatement r stmt, AssignStatement r stmt, Argument r, BooleanExpression r, CommandLineArgs r, CommentStatement r stmt, Comparison r, ControlStatement r stmt bod, DeclStatement r stmt bod, FuncAppStatement r stmt, PrintConsole r stmt, ReadConsole r stmt, FileHandling r stmt, PrintFile r stmt, ReadFile r stmt, List r, ListStatement r stmt, Literal r, MathConstant r, NumericExpression r, ParameterSym r, Reference r, Set r, StringStatement r stmt, ValueExpression r, VariableValue r, ModuleSym r mod mthd, FileSym r file mod, ProgramSym r prg file) => ProcProg (r :: Type -> Type) vis stmt mthd prg file mod bod block
- class ProgramSym (r :: k -> Type) (prg :: k) (file :: k) | r -> prg file where
- class FileSym (r :: k -> Type) (file :: k) (mod :: k) | r -> file mod where
- class BodySym (r :: k -> Type) (bod :: k) (block :: k) | r -> bod block where
- bodyStatements :: forall {k} r (block :: k) (stmt :: k) (bod :: k). (BlockSym r block stmt, BodySym r bod block) => [MS (r stmt)] -> MS (r bod)
- oneLiner :: forall {k} r (block :: k) (stmt :: k) (bod :: k). (BlockSym r block stmt, BodySym r bod block) => MS (r stmt) -> MS (r bod)
- class BlockSym (r :: k -> Type) (block :: k) (stmt :: k) | r -> block stmt where
- class TypeSym (r :: Type -> Type) where
- bool :: VS (r TypeData)
- int :: VS (r TypeData)
- float :: VS (r TypeData)
- double :: VS (r TypeData)
- char :: VS (r TypeData)
- string :: VS (r TypeData)
- infile :: VS (r TypeData)
- outfile :: VS (r TypeData)
- referenceType :: VS (r TypeData) -> VS (r TypeData)
- listType :: VS (r TypeData) -> VS (r TypeData)
- setType :: VS (r TypeData) -> VS (r TypeData)
- arrayType :: VS (r TypeData) -> VS (r TypeData)
- innerType :: VS (r TypeData) -> VS (r TypeData)
- funcType :: [VS (r TypeData)] -> VS (r TypeData) -> VS (r TypeData)
- void :: VS (r TypeData)
- class TypeSym r => BinderSym (r :: Type -> Type) where
- class EmptyStatement (r :: k -> Type) (stmt :: k) | r -> stmt where
- class MultiStatement (r :: k -> Type) (stmt :: k) | r -> stmt where
- class ValueStatement (r :: Type -> Type) stmt | r -> stmt where
- class VariableSym r => AssignStatement (r :: Type -> Type) stmt | r -> stmt where
- (&=) :: AssignStatement r stmt => SVariable r -> SValue r -> MS (r stmt)
- class (VariableSym r, ScopeSym r) => DeclStatement (r :: Type -> Type) stmt bod | r -> stmt bod where
- varDec :: SVariable r -> r ScopeData -> MS (r stmt)
- varDecDef :: SVariable r -> r ScopeData -> SValue r -> MS (r stmt)
- listDec :: Integer -> SVariable r -> r ScopeData -> MS (r stmt)
- listDecDef :: SVariable r -> r ScopeData -> [SValue r] -> MS (r stmt)
- setDec :: SVariable r -> r ScopeData -> MS (r stmt)
- setDecDef :: SVariable r -> r ScopeData -> SValue r -> MS (r stmt)
- arrayDec :: Integer -> SValue r -> SVariable r -> r ScopeData -> MS (r stmt)
- arrayDecDef :: SVariable r -> r ScopeData -> [SValue r] -> MS (r stmt)
- constDecDef :: SVariable r -> r ScopeData -> SValue r -> MS (r stmt)
- funcDecDef :: SVariable r -> r ScopeData -> [SVariable r] -> MS (r bod) -> MS (r stmt)
- class VariableSym r => PrintConsole (r :: Type -> Type) stmt | r -> stmt where
- class VariableSym r => ReadConsole (r :: Type -> Type) stmt | r -> stmt where
- getInput :: SVariable r -> MS (r stmt)
- discardInput :: MS (r stmt)
- class VariableSym r => FileHandling (r :: Type -> Type) stmt | r -> stmt where
- class VariableSym r => PrintFile (r :: Type -> Type) stmt | r -> stmt where
- class VariableSym r => ReadFile (r :: Type -> Type) stmt | r -> stmt where
- getFileInput :: SValue r -> SVariable r -> MS (r stmt)
- discardFileInput :: SValue r -> MS (r stmt)
- getFileInputLine :: SValue r -> SVariable r -> MS (r stmt)
- discardFileLine :: SValue r -> MS (r stmt)
- getFileInputAll :: SValue r -> SVariable r -> MS (r stmt)
- class VariableSym r => StringStatement (r :: Type -> Type) stmt | r -> stmt where
- stringSplit :: Char -> SVariable r -> SValue r -> MS (r stmt)
- stringListVals :: [SVariable r] -> SValue r -> MS (r stmt)
- stringListLists :: [SVariable r] -> SValue r -> MS (r stmt)
- class VariableSym r => FuncAppStatement (r :: Type -> Type) stmt | r -> stmt where
- inOutCall :: InOutCall r stmt
- extInOutCall :: Library -> InOutCall r stmt
- class CommentStatement (r :: k -> Type) (stmt :: k) | r -> stmt where
- class VariableSym r => ControlStatement (r :: Type -> Type) stmt bod | r -> stmt bod where
- break :: MS (r stmt)
- continue :: MS (r stmt)
- returnStmt :: SValue r -> MS (r stmt)
- throw :: Label -> MS (r stmt)
- ifCond :: [(SValue r, MS (r bod))] -> MS (r bod) -> MS (r stmt)
- switch :: SValue r -> [(SValue r, MS (r bod))] -> MS (r bod) -> MS (r stmt)
- ifExists :: SValue r -> MS (r bod) -> MS (r bod) -> MS (r stmt)
- for :: MS (r stmt) -> SValue r -> MS (r stmt) -> MS (r bod) -> MS (r stmt)
- forRange :: SVariable r -> SValue r -> SValue r -> SValue r -> MS (r bod) -> MS (r stmt)
- forEach :: SVariable r -> SValue r -> MS (r bod) -> MS (r stmt)
- while :: SValue r -> MS (r bod) -> MS (r stmt)
- tryCatch :: MS (r bod) -> MS (r bod) -> MS (r stmt)
- assert :: SValue r -> SValue r -> MS (r stmt)
- ifNoElse :: (BodySym r bod block, ControlStatement r stmt bod) => [(SValue r, MS (r bod))] -> MS (r stmt)
- switchAsIf :: (ControlStatement r stmt bod, Comparison r) => SValue r -> [(SValue r, MS (r bod))] -> MS (r bod) -> MS (r stmt)
- class TypeSym r => VariableSym (r :: Type -> Type) where
- class ScopeSym (r :: Type -> Type) where
- data ScopeData
- class VariableSym r => VariableElim (r :: Type -> Type) where
- variableName :: r Variable -> String
- variableType :: r Variable -> r TypeData
- listOf :: VariableSym r => Label -> VS (r TypeData) -> SVariable r
- listVar :: VariableSym r => Label -> VS (r TypeData) -> SVariable r
- class TypeSym r => ValueSym (r :: Type -> Type) where
- class ValueSym r => Argument (r :: Type -> Type) where
- pointerArg :: SValue r -> SValue r
- class ValueSym r => Literal (r :: Type -> Type) where
- litTrue :: SValue r
- litFalse :: SValue r
- litChar :: Char -> SValue r
- litDouble :: Double -> SValue r
- litFloat :: Float -> SValue r
- litInt :: Integer -> SValue r
- litString :: String -> SValue r
- litArray :: VS (r TypeData) -> [SValue r] -> SValue r
- litList :: VS (r TypeData) -> [SValue r] -> SValue r
- litSet :: VS (r TypeData) -> [SValue r] -> SValue r
- class ValueSym r => MathConstant (r :: Type -> Type) where
- class (VariableSym r, ValueSym r) => VariableValue (r :: Type -> Type) where
- class ValueSym r => CommandLineArgs (r :: Type -> Type) where
- class ValueSym r => NumericExpression (r :: Type -> Type) where
- (#~) :: SValue r -> SValue r
- (#/^) :: SValue r -> SValue r
- (#|) :: SValue r -> SValue r
- (#+) :: SValue r -> SValue r -> SValue r
- (#-) :: SValue r -> SValue r -> SValue r
- (#*) :: SValue r -> SValue r -> SValue r
- (#/) :: SValue r -> SValue r -> SValue r
- (#%) :: SValue r -> SValue r -> SValue r
- (#^) :: SValue r -> SValue r -> SValue r
- log :: SValue r -> SValue r
- ln :: SValue r -> SValue r
- exp :: SValue r -> SValue r
- sin :: SValue r -> SValue r
- cos :: SValue r -> SValue r
- tan :: SValue r -> SValue r
- csc :: SValue r -> SValue r
- sec :: SValue r -> SValue r
- cot :: SValue r -> SValue r
- arcsin :: SValue r -> SValue r
- arccos :: SValue r -> SValue r
- arctan :: SValue r -> SValue r
- floor :: SValue r -> SValue r
- ceil :: SValue r -> SValue r
- class ValueSym r => BooleanExpression (r :: Type -> Type) where
- class ValueSym r => Comparison (r :: Type -> Type) where
- class (VariableSym r, ValueSym r) => ValueExpression (r :: Type -> Type) where
- inlineIf :: SValue r -> SValue r -> SValue r -> SValue r
- funcAppMixedArgs :: MixedCall r
- extFuncAppMixedArgs :: Library -> MixedCall r
- libFuncAppMixedArgs :: Library -> MixedCall r
- lambda :: [VSBinder r] -> SValue r -> SValue r
- notNull :: SValue r -> SValue r
- funcApp :: ValueExpression r => PosCall r
- funcAppNamedArgs :: ValueExpression r => Label -> VS (r TypeData) -> NamedArgs r -> SValue r
- extFuncApp :: ValueExpression r => Library -> PosCall r
- libFuncApp :: ValueExpression r => Library -> PosCall r
- exists :: ValueExpression r => SValue r -> SValue r
- class ValueSym r => FunctionSym (r :: Type -> Type)
- class (TypeSym r, ValueSym r) => Reference (r :: Type -> Type) where
- class IndexTranslator r => Array (r :: Type -> Type) where
- class IndexTranslator r => List (r :: Type -> Type) where
- class ListStatement (r :: Type -> Type) stmt | r -> stmt where
- class ValueSym r => InternalList (r :: Type -> Type) block | r -> block
- listSlice :: InternalList r block => SVariable r -> SValue r -> Maybe (SValue r) -> Maybe (SValue r) -> Maybe (SValue r) -> MS (r block)
- listIndexExists :: (List r, Comparison r) => SValue r -> SValue r -> SValue r
- at :: List r => SValue r -> SValue r -> SValue r
- class ValueSym r => Set (r :: Type -> Type) where
- class (IndexTranslator r, Literal r) => NativeVector (r :: Type -> Type) where
- vecType :: VS (r TypeData) -> VS (r TypeData)
- litVec :: VS (r TypeData) -> [SValue r] -> SValue r
- vecScale :: SValue r -> SValue r -> SValue r
- vecAdd :: SValue r -> SValue r -> SValue r
- vecIndex :: SValue r -> SValue r -> SValue r
- vecDot :: SValue r -> SValue r -> SValue r
- vecMag :: SValue r -> SValue r
- vecUnit :: SValue r -> SValue r
- class VisibilitySym (r :: k -> Type) (vis :: k) | r -> vis where
- class VariableSym r => ParameterSym (r :: Type -> Type) where
- class (ParameterSym r, VisibilitySym r vis) => MethodSym (r :: Type -> Type) vis mthd bod | r -> mthd bod where
- docMain :: MS (r bod) -> MS (r mthd)
- function :: Label -> r vis -> VS (r TypeData) -> [MS (r ParamData)] -> MS (r bod) -> MS (r mthd)
- mainFunction :: MS (r bod) -> MS (r mthd)
- docFunc :: String -> [String] -> Maybe String -> MS (r mthd) -> MS (r mthd)
- inOutFunc :: Label -> r vis -> InOutFunc r mthd bod
- docInOutFunc :: Label -> r vis -> DocInOutFunc r mthd bod
- class ModuleSym (r :: k -> Type) (mod :: k) (mthd :: k) | r -> mod mthd where
- buildModule :: Label -> [Label] -> [MS (r mthd)] -> FS (r mod)
- convType :: TypeSym r => CodeType -> VS (r TypeData)
- data ProgData
- data FileData
- data ModData
- data TypeData
- data VisibilityTag
- data ParamData
- data CodeType
- data GOOLState = GS {}
- lensMStoVS :: Lens' MethodState ValueState
- headers :: Lens' GOOLState [FilePath]
- sources :: Lens' GOOLState [FilePath]
- mainMod :: Lens' GOOLState (Maybe FilePath)
- initialState :: GOOLState
- onStateValue :: (a -> b) -> State s a -> State s b
- onCodeList :: Monad m => ([a] -> b) -> [m a] -> m b
- unJLC :: JuliaCode a -> a
- jlName :: String
- jlVersion :: String
- unMLC :: MatlabCode a -> a
- mlName :: String
- mlVersion :: String
- newtype LoggingFor (r :: Type -> Type) a = LC {
- unLC :: r a
- class TypeSym r => TypeElim (r :: Type -> Type) where
- getCodeType :: r TypeData -> CodeType
- getTypeString :: UnRepr r TypeData => r TypeData -> String
Documentation
class (UnRepr r TypeData, BodySym r bod block, BlockSym r block stmt, FunctionSym r, VariableValue r, ScopeSym r, BinderSym r, InternalList r block, MethodSym r vis mthd bod, TypeElim r, VariableElim r, Array r, EmptyStatement r stmt, MultiStatement r stmt, ValueStatement r stmt, AssignStatement r stmt, Argument r, BooleanExpression r, CommandLineArgs r, CommentStatement r stmt, Comparison r, ControlStatement r stmt bod, DeclStatement r stmt bod, FuncAppStatement r stmt, PrintConsole r stmt, ReadConsole r stmt, FileHandling r stmt, PrintFile r stmt, ReadFile r stmt, List r, ListStatement r stmt, Literal r, MathConstant r, NumericExpression r, ParameterSym r, Reference r, Set r, StringStatement r stmt, ValueExpression r, VariableValue r, ModuleSym r mod mthd, FileSym r file mod, ProgramSym r prg file) => ProcProg (r :: Type -> Type) vis stmt mthd prg file mod bod block Source #
Wrapper typeclass that bundles everything essential for generating a procedural program.
Instances
| ProcProg r vis stmt mthd prg file mod bod block => ProcProg (LoggingFor r) vis stmt mthd prg file mod bod block Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor | |
class ProgramSym (r :: k -> Type) (prg :: k) (file :: k) | r -> prg file where Source #
Class for representing a program.
Usually ProgData is used for the representation.
Methods
prog :: Label -> Label -> [FS (r file)] -> GSProgram r prg Source #
Given program name, program purpose, and list of files, Generates a representation of a program.
Instances
| ProgramSym r prg file => ProgramSym (LoggingFor r :: Type -> Type) (prg :: Type) (file :: Type) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods prog :: Label -> Label -> [FS (LoggingFor r file)] -> GSProgram (LoggingFor r) prg Source # | |
class FileSym (r :: k -> Type) (file :: k) (mod :: k) | r -> file mod where Source #
Class for representing a file.
Methods
fileDoc :: FS (r mod) -> FS (r file) Source #
Given a module, generates a representation of a file. (Implicit assumption: exactly one module per file)
docMod :: String -> String -> [String] -> String -> FS (r file) -> FS (r file) Source #
Given module description, watermark, list of author names, date as a String, and file to comment, creates a documented module (i.e. module with a header comment)
Instances
| FileSym r file mod => FileSym (LoggingFor r :: Type -> Type) (file :: Type) (mod :: Type) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods fileDoc :: FS (LoggingFor r mod) -> FS (LoggingFor r file) Source # docMod :: String -> String -> [String] -> String -> FS (LoggingFor r file) -> FS (LoggingFor r file) Source # | |
class BodySym (r :: k -> Type) (bod :: k) (block :: k) | r -> bod block where Source #
Class for representing a Body, which is basically a lexical scope of code.
Examples include a function body, the branch(es) of an `if`-statement, etc.
Methods
body :: [MS (r block)] -> MS (r bod) Source #
addComments :: Label -> MS (r bod) -> MS (r bod) Source #
Given a comment and a body, add the comment as a header for the body.
Instances
| BodySym r bod block => BodySym (LoggingFor r :: Type -> Type) (bod :: Type) (block :: Type) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods body :: [MS (LoggingFor r block)] -> MS (LoggingFor r bod) Source # addComments :: Label -> MS (LoggingFor r bod) -> MS (LoggingFor r bod) Source # | |
bodyStatements :: forall {k} r (block :: k) (stmt :: k) (bod :: k). (BlockSym r block stmt, BodySym r bod block) => [MS (r stmt)] -> MS (r bod) Source #
oneLiner :: forall {k} r (block :: k) (stmt :: k) (bod :: k). (BlockSym r block stmt, BodySym r bod block) => MS (r stmt) -> MS (r bod) Source #
class BlockSym (r :: k -> Type) (block :: k) (stmt :: k) | r -> block stmt where Source #
Class for representing a block of code.
A block is a series of statements grouped together,
not for use by the compiler/interpreter
but to improve readability of the generated code.
See the bottom of page 2 of Brook's GOOL paper from 2020 for more details.
Instances
| BlockSym r block stmt => BlockSym (LoggingFor r :: Type -> Type) (block :: Type) (stmt :: Type) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods block :: [MS (LoggingFor r stmt)] -> MS (LoggingFor r block) Source # | |
class TypeSym (r :: Type -> Type) where Source #
Class for representing a type.
Methods
bool :: VS (r TypeData) Source #
int :: VS (r TypeData) Source #
float :: VS (r TypeData) Source #
double :: VS (r TypeData) Source #
char :: VS (r TypeData) Source #
string :: VS (r TypeData) Source #
infile :: VS (r TypeData) Source #
outfile :: VS (r TypeData) Source #
referenceType :: VS (r TypeData) -> VS (r TypeData) Source #
listType :: VS (r TypeData) -> VS (r TypeData) Source #
setType :: VS (r TypeData) -> VS (r TypeData) Source #
arrayType :: VS (r TypeData) -> VS (r TypeData) Source #
innerType :: VS (r TypeData) -> VS (r TypeData) Source #
funcType :: [VS (r TypeData)] -> VS (r TypeData) -> VS (r TypeData) Source #
Instances
| TypeSym r => TypeSym (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods bool :: VS (LoggingFor r TypeData) Source # int :: VS (LoggingFor r TypeData) Source # float :: VS (LoggingFor r TypeData) Source # double :: VS (LoggingFor r TypeData) Source # char :: VS (LoggingFor r TypeData) Source # string :: VS (LoggingFor r TypeData) Source # infile :: VS (LoggingFor r TypeData) Source # outfile :: VS (LoggingFor r TypeData) Source # referenceType :: VS (LoggingFor r TypeData) -> VS (LoggingFor r TypeData) Source # listType :: VS (LoggingFor r TypeData) -> VS (LoggingFor r TypeData) Source # setType :: VS (LoggingFor r TypeData) -> VS (LoggingFor r TypeData) Source # arrayType :: VS (LoggingFor r TypeData) -> VS (LoggingFor r TypeData) Source # innerType :: VS (LoggingFor r TypeData) -> VS (LoggingFor r TypeData) Source # funcType :: [VS (LoggingFor r TypeData)] -> VS (LoggingFor r TypeData) -> VS (LoggingFor r TypeData) Source # | |
class TypeSym r => BinderSym (r :: Type -> Type) where Source #
A class for representing a binder, i.e. the binding of a variable name to a type, scope, etc. As of July 2026, integration of this typeclass is still WIP, blocked by issues with our variable map.
Instances
| BinderSym r => BinderSym (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods binder :: Label -> VS (LoggingFor r TypeData) -> VSBinder (LoggingFor r) Source # | |
class EmptyStatement (r :: k -> Type) (stmt :: k) | r -> stmt where Source #
Instances
| EmptyStatement r stmt => EmptyStatement (LoggingFor r :: Type -> Type) (stmt :: Type) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods emptyStmt :: MS (LoggingFor r stmt) Source # | |
class MultiStatement (r :: k -> Type) (stmt :: k) | r -> stmt where Source #
Methods
multi :: [MS (r stmt)] -> MS (r stmt) Source #
Consolidates a list of statements into a single statement
Instances
| MultiStatement r stmt => MultiStatement (LoggingFor r :: Type -> Type) (stmt :: Type) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods multi :: [MS (LoggingFor r stmt)] -> MS (LoggingFor r stmt) Source # | |
class ValueStatement (r :: Type -> Type) stmt | r -> stmt where Source #
Instances
| ValueStatement r stmt => ValueStatement (LoggingFor r) stmt Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods valStmt :: SValue (LoggingFor r) -> MS (LoggingFor r stmt) Source # | |
class VariableSym r => AssignStatement (r :: Type -> Type) stmt | r -> stmt where Source #
Methods
(&-=) :: SVariable r -> SValue r -> MS (r stmt) infixl 1 Source #
(&+=) :: SVariable r -> SValue r -> MS (r stmt) infixl 1 Source #
(&++) :: SVariable r -> MS (r stmt) infixl 8 Source #
Instances
| (MultiStatement r stmt, AssignStatement r stmt, FileHandling r stmt, PrintFile r stmt, VariableValue r, VariableElim r, Literal r) => AssignStatement (LoggingFor r) stmt Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods (&-=) :: SVariable (LoggingFor r) -> SValue (LoggingFor r) -> MS (LoggingFor r stmt) Source # (&+=) :: SVariable (LoggingFor r) -> SValue (LoggingFor r) -> MS (LoggingFor r stmt) Source # (&++) :: SVariable (LoggingFor r) -> MS (LoggingFor r stmt) Source # (&--) :: SVariable (LoggingFor r) -> MS (LoggingFor r stmt) Source # assign :: SVariable (LoggingFor r) -> SValue (LoggingFor r) -> MS (LoggingFor r stmt) Source # | |
class (VariableSym r, ScopeSym r) => DeclStatement (r :: Type -> Type) stmt bod | r -> stmt bod where Source #
Methods
varDec :: SVariable r -> r ScopeData -> MS (r stmt) Source #
Declare a variable without giving it a value.
Not for use with arrays; use arrayDec instead.
varDecDef :: SVariable r -> r ScopeData -> SValue r -> MS (r stmt) Source #
Declare a variable and give it a value.
Not for use with arrays; use arrayDecDef instead.
listDec :: Integer -> SVariable r -> r ScopeData -> MS (r stmt) Source #
Given the size of the list, the variable to store the list in, and the scope of the variable, declare a list of the given size.
listDecDef :: SVariable r -> r ScopeData -> [SValue r] -> MS (r stmt) Source #
setDec :: SVariable r -> r ScopeData -> MS (r stmt) Source #
setDecDef :: SVariable r -> r ScopeData -> SValue r -> MS (r stmt) Source #
arrayDec :: Integer -> SValue r -> SVariable r -> r ScopeData -> MS (r stmt) Source #
Given the size of the aray, the default value to fill the array with, the variable to store the array in, and the scope of the variable, declare an array of the given size.
arrayDecDef :: SVariable r -> r ScopeData -> [SValue r] -> MS (r stmt) Source #
constDecDef :: SVariable r -> r ScopeData -> SValue r -> MS (r stmt) Source #
funcDecDef :: SVariable r -> r ScopeData -> [SVariable r] -> MS (r bod) -> MS (r stmt) Source #
Instances
class VariableSym r => PrintConsole (r :: Type -> Type) stmt | r -> stmt where Source #
Methods
print :: SValue r -> MS (r stmt) Source #
printLn :: SValue r -> MS (r stmt) Source #
printStr :: String -> MS (r stmt) Source #
printStrLn :: String -> MS (r stmt) Source #
Instances
| PrintConsole r stmt => PrintConsole (LoggingFor r) stmt Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods print :: SValue (LoggingFor r) -> MS (LoggingFor r stmt) Source # printLn :: SValue (LoggingFor r) -> MS (LoggingFor r stmt) Source # printStr :: String -> MS (LoggingFor r stmt) Source # printStrLn :: String -> MS (LoggingFor r stmt) Source # | |
class VariableSym r => ReadConsole (r :: Type -> Type) stmt | r -> stmt where Source #
Instances
| (MultiStatement r stmt, FileHandling r stmt, PrintFile r stmt, ReadConsole r stmt, VariableValue r, VariableElim r, Literal r) => ReadConsole (LoggingFor r) stmt Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods getInput :: SVariable (LoggingFor r) -> MS (LoggingFor r stmt) Source # discardInput :: MS (LoggingFor r stmt) Source # | |
class VariableSym r => FileHandling (r :: Type -> Type) stmt | r -> stmt where Source #
Methods
openFileR :: SVariable r -> SValue r -> MS (r stmt) Source #
openFileW :: SVariable r -> SValue r -> MS (r stmt) Source #
openFileA :: SVariable r -> SValue r -> MS (r stmt) Source #
Instances
| FileHandling r stmt => FileHandling (LoggingFor r) stmt Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods openFileR :: SVariable (LoggingFor r) -> SValue (LoggingFor r) -> MS (LoggingFor r stmt) Source # openFileW :: SVariable (LoggingFor r) -> SValue (LoggingFor r) -> MS (LoggingFor r stmt) Source # openFileA :: SVariable (LoggingFor r) -> SValue (LoggingFor r) -> MS (LoggingFor r stmt) Source # closeFile :: SValue (LoggingFor r) -> MS (LoggingFor r stmt) Source # | |
class VariableSym r => PrintFile (r :: Type -> Type) stmt | r -> stmt where Source #
Methods
printFile :: SValue r -> SValue r -> MS (r stmt) Source #
Given the file handle and value to print, print the value to the file.
printFileLn :: SValue r -> SValue r -> MS (r stmt) Source #
printFileStr :: SValue r -> String -> MS (r stmt) Source #
printFileStrLn :: SValue r -> String -> MS (r stmt) Source #
Instances
| PrintFile r stmt => PrintFile (LoggingFor r) stmt Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods printFile :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> MS (LoggingFor r stmt) Source # printFileLn :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> MS (LoggingFor r stmt) Source # printFileStr :: SValue (LoggingFor r) -> String -> MS (LoggingFor r stmt) Source # printFileStrLn :: SValue (LoggingFor r) -> String -> MS (LoggingFor r stmt) Source # | |
class VariableSym r => ReadFile (r :: Type -> Type) stmt | r -> stmt where Source #
Methods
getFileInput :: SValue r -> SVariable r -> MS (r stmt) Source #
discardFileInput :: SValue r -> MS (r stmt) Source #
getFileInputLine :: SValue r -> SVariable r -> MS (r stmt) Source #
discardFileLine :: SValue r -> MS (r stmt) Source #
getFileInputAll :: SValue r -> SVariable r -> MS (r stmt) Source #
Instances
| (MultiStatement r stmt, FileHandling r stmt, PrintFile r stmt, ReadFile r stmt, VariableValue r, VariableElim r, Literal r) => ReadFile (LoggingFor r) stmt Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods getFileInput :: SValue (LoggingFor r) -> SVariable (LoggingFor r) -> MS (LoggingFor r stmt) Source # discardFileInput :: SValue (LoggingFor r) -> MS (LoggingFor r stmt) Source # getFileInputLine :: SValue (LoggingFor r) -> SVariable (LoggingFor r) -> MS (LoggingFor r stmt) Source # discardFileLine :: SValue (LoggingFor r) -> MS (LoggingFor r stmt) Source # getFileInputAll :: SValue (LoggingFor r) -> SVariable (LoggingFor r) -> MS (LoggingFor r stmt) Source # | |
class VariableSym r => StringStatement (r :: Type -> Type) stmt | r -> stmt where Source #
Methods
stringSplit :: Char -> SVariable r -> SValue r -> MS (r stmt) Source #
Given a char to split on, variable to store result in, and string to split, generates a statement splitting the string into a list of strings delimited by the char.
stringListVals :: [SVariable r] -> SValue r -> MS (r stmt) Source #
stringListLists :: [SVariable r] -> SValue r -> MS (r stmt) Source #
Given a list of variables and a value containing a list of strings, assign the ith element of the list of strings into the ith variable
Instances
| (MultiStatement r stmt, StringStatement r stmt, FileHandling r stmt, PrintFile r stmt, VariableValue r, VariableElim r, Literal r) => StringStatement (LoggingFor r) stmt Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods stringSplit :: Char -> SVariable (LoggingFor r) -> SValue (LoggingFor r) -> MS (LoggingFor r stmt) Source # stringListVals :: [SVariable (LoggingFor r)] -> SValue (LoggingFor r) -> MS (LoggingFor r stmt) Source # stringListLists :: [SVariable (LoggingFor r)] -> SValue (LoggingFor r) -> MS (LoggingFor r stmt) Source # | |
class VariableSym r => FuncAppStatement (r :: Type -> Type) stmt | r -> stmt where Source #
Instances
| FuncAppStatement r stmt => FuncAppStatement (LoggingFor r) stmt Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods inOutCall :: InOutCall (LoggingFor r) stmt Source # extInOutCall :: Library -> InOutCall (LoggingFor r) stmt Source # | |
class CommentStatement (r :: k -> Type) (stmt :: k) | r -> stmt where Source #
Instances
| CommentStatement r stmt => CommentStatement (LoggingFor r :: Type -> Type) (stmt :: Type) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor | |
class VariableSym r => ControlStatement (r :: Type -> Type) stmt bod | r -> stmt bod where Source #
Methods
continue :: MS (r stmt) Source #
returnStmt :: SValue r -> MS (r stmt) Source #
throw :: Label -> MS (r stmt) Source #
ifCond :: [(SValue r, MS (r bod))] -> MS (r bod) -> MS (r stmt) Source #
String of if-else statements. Arguments: List of predicates and bodies (if this then that), Body for else branch
switch :: SValue r -> [(SValue r, MS (r bod))] -> MS (r bod) -> MS (r stmt) Source #
ifExists :: SValue r -> MS (r bod) -> MS (r bod) -> MS (r stmt) Source #
for :: MS (r stmt) -> SValue r -> MS (r stmt) -> MS (r bod) -> MS (r stmt) Source #
forRange :: SVariable r -> SValue r -> SValue r -> SValue r -> MS (r bod) -> MS (r stmt) Source #
forEach :: SVariable r -> SValue r -> MS (r bod) -> MS (r stmt) Source #
while :: SValue r -> MS (r bod) -> MS (r stmt) Source #
tryCatch :: MS (r bod) -> MS (r bod) -> MS (r stmt) Source #
Instances
ifNoElse :: (BodySym r bod block, ControlStatement r stmt bod) => [(SValue r, MS (r bod))] -> MS (r stmt) Source #
switchAsIf :: (ControlStatement r stmt bod, Comparison r) => SValue r -> [(SValue r, MS (r bod))] -> MS (r bod) -> MS (r stmt) Source #
class TypeSym r => VariableSym (r :: Type -> Type) where Source #
Class for representing variables.
Methods
var :: Label -> VS (r TypeData) -> SVariable r Source #
An instance- or function-level variable, separate from its instance (i.e. v, not `o.v`)
constant :: Label -> VS (r TypeData) -> SVariable r Source #
An instance- or function-level constant, separate from its instance (i.e. v, not `o.v`)
extVar :: Library -> Label -> VS (r TypeData) -> SVariable r Source #
An instance- or module-level variable from an external library.
Given library Lib, variable name v, and variable type t,
it performs the necessary imports and creates v
Instances
| VariableSym r => VariableSym (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods var :: Label -> VS (LoggingFor r TypeData) -> SVariable (LoggingFor r) Source # constant :: Label -> VS (LoggingFor r TypeData) -> SVariable (LoggingFor r) Source # extVar :: Library -> Label -> VS (LoggingFor r TypeData) -> SVariable (LoggingFor r) Source # | |
class ScopeSym (r :: Type -> Type) where Source #
Class for representing the lexical scope of a variable.
Currently only differentiates global and local,
allowing individual renderers to define which of them the main function is.
Instances
| ScopeSym r => ScopeSym (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods global :: LoggingFor r ScopeData Source # mainFn :: LoggingFor r ScopeData Source # local :: LoggingFor r ScopeData Source # | |
class VariableSym r => VariableElim (r :: Type -> Type) where Source #
Methods
variableName :: r Variable -> String Source #
variableType :: r Variable -> r TypeData Source #
Instances
| VariableElim r => VariableElim (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods variableName :: LoggingFor r Variable -> String Source # variableType :: LoggingFor r Variable -> LoggingFor r TypeData Source # | |
class TypeSym r => ValueSym (r :: Type -> Type) where Source #
Class for representing a value.
Instances
| ValueSym r => ValueSym (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods valueType :: LoggingFor r Value -> LoggingFor r TypeData Source # | |
class ValueSym r => Argument (r :: Type -> Type) where Source #
Methods
pointerArg :: SValue r -> SValue r Source #
Instances
| Argument r => Argument (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods pointerArg :: SValue (LoggingFor r) -> SValue (LoggingFor r) Source # | |
class ValueSym r => Literal (r :: Type -> Type) where Source #
Methods
litChar :: Char -> SValue r Source #
litDouble :: Double -> SValue r Source #
litFloat :: Float -> SValue r Source #
litInt :: Integer -> SValue r Source #
litString :: String -> SValue r Source #
litArray :: VS (r TypeData) -> [SValue r] -> SValue r Source #
litList :: VS (r TypeData) -> [SValue r] -> SValue r Source #
litSet :: VS (r TypeData) -> [SValue r] -> SValue r Source #
Instances
| Literal r => Literal (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods litTrue :: SValue (LoggingFor r) Source # litFalse :: SValue (LoggingFor r) Source # litChar :: Char -> SValue (LoggingFor r) Source # litDouble :: Double -> SValue (LoggingFor r) Source # litFloat :: Float -> SValue (LoggingFor r) Source # litInt :: Integer -> SValue (LoggingFor r) Source # litString :: String -> SValue (LoggingFor r) Source # litArray :: VS (LoggingFor r TypeData) -> [SValue (LoggingFor r)] -> SValue (LoggingFor r) Source # litList :: VS (LoggingFor r TypeData) -> [SValue (LoggingFor r)] -> SValue (LoggingFor r) Source # litSet :: VS (LoggingFor r TypeData) -> [SValue (LoggingFor r)] -> SValue (LoggingFor r) Source # | |
class ValueSym r => MathConstant (r :: Type -> Type) where Source #
Instances
| MathConstant r => MathConstant (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods pi :: SValue (LoggingFor r) Source # | |
class (VariableSym r, ValueSym r) => VariableValue (r :: Type -> Type) where Source #
Instances
| VariableValue r => VariableValue (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods valueOf :: SVariable (LoggingFor r) -> SValue (LoggingFor r) Source # | |
class ValueSym r => CommandLineArgs (r :: Type -> Type) where Source #
Instances
| CommandLineArgs r => CommandLineArgs (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor | |
class ValueSym r => NumericExpression (r :: Type -> Type) where Source #
Methods
(#~) :: SValue r -> SValue r infixl 8 Source #
(#/^) :: SValue r -> SValue r infixl 7 Source #
(#|) :: SValue r -> SValue r infixl 7 Source #
(#+) :: SValue r -> SValue r -> SValue r infixl 5 Source #
(#-) :: SValue r -> SValue r -> SValue r infixl 5 Source #
(#*) :: SValue r -> SValue r -> SValue r infixl 6 Source #
(#/) :: SValue r -> SValue r -> SValue r infixl 6 Source #
(#%) :: SValue r -> SValue r -> SValue r infixl 6 Source #
(#^) :: SValue r -> SValue r -> SValue r infixl 7 Source #
log :: SValue r -> SValue r Source #
ln :: SValue r -> SValue r Source #
exp :: SValue r -> SValue r Source #
sin :: SValue r -> SValue r Source #
cos :: SValue r -> SValue r Source #
tan :: SValue r -> SValue r Source #
csc :: SValue r -> SValue r Source #
sec :: SValue r -> SValue r Source #
cot :: SValue r -> SValue r Source #
arcsin :: SValue r -> SValue r Source #
arccos :: SValue r -> SValue r Source #
arctan :: SValue r -> SValue r Source #
Instances
class ValueSym r => BooleanExpression (r :: Type -> Type) where Source #
Methods
(?!) :: SValue r -> SValue r infixr 6 Source #
Instances
| BooleanExpression r => BooleanExpression (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods (?!) :: SValue (LoggingFor r) -> SValue (LoggingFor r) Source # (?&&) :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> SValue (LoggingFor r) Source # (?||) :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> SValue (LoggingFor r) Source # | |
class ValueSym r => Comparison (r :: Type -> Type) where Source #
Methods
(?<) :: SValue r -> SValue r -> SValue r infixl 4 Source #
(?<=) :: SValue r -> SValue r -> SValue r infixl 4 Source #
(?>) :: SValue r -> SValue r -> SValue r infixl 4 Source #
(?>=) :: SValue r -> SValue r -> SValue r infixl 4 Source #
Instances
| Comparison r => Comparison (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods (?<) :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> SValue (LoggingFor r) Source # (?<=) :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> SValue (LoggingFor r) Source # (?>) :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> SValue (LoggingFor r) Source # (?>=) :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> SValue (LoggingFor r) Source # (?==) :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> SValue (LoggingFor r) Source # (?!=) :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> SValue (LoggingFor r) Source # | |
class (VariableSym r, ValueSym r) => ValueExpression (r :: Type -> Type) where Source #
A class for representing values that can include expressions
Methods
inlineIf :: SValue r -> SValue r -> SValue r -> SValue r Source #
funcAppMixedArgs :: MixedCall r Source #
extFuncAppMixedArgs :: Library -> MixedCall r Source #
libFuncAppMixedArgs :: Library -> MixedCall r Source #
Instances
| ValueExpression r => ValueExpression (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods inlineIf :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> SValue (LoggingFor r) -> SValue (LoggingFor r) Source # funcAppMixedArgs :: MixedCall (LoggingFor r) Source # extFuncAppMixedArgs :: Library -> MixedCall (LoggingFor r) Source # libFuncAppMixedArgs :: Library -> MixedCall (LoggingFor r) Source # lambda :: [VSBinder (LoggingFor r)] -> SValue (LoggingFor r) -> SValue (LoggingFor r) Source # notNull :: SValue (LoggingFor r) -> SValue (LoggingFor r) Source # | |
funcApp :: ValueExpression r => PosCall r Source #
funcAppNamedArgs :: ValueExpression r => Label -> VS (r TypeData) -> NamedArgs r -> SValue r Source #
extFuncApp :: ValueExpression r => Library -> PosCall r Source #
libFuncApp :: ValueExpression r => Library -> PosCall r Source #
class ValueSym r => FunctionSym (r :: Type -> Type) Source #
Instances
| FunctionSym r => FunctionSym (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor | |
class (TypeSym r, ValueSym r) => Reference (r :: Type -> Type) where Source #
A class for representing references. By "reference" we basically mean "C++ pointer" or "OCaml reference".
Methods
makeRef :: SValue r -> SValue r Source #
Given a value, convert it to a reference to that value
maybeDeref :: SValue r -> SValue r Source #
Given a value that may be a reference type, apply any necessary dereference operation.
Instances
| Reference r => Reference (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods makeRef :: SValue (LoggingFor r) -> SValue (LoggingFor r) Source # maybeDeref :: SValue (LoggingFor r) -> SValue (LoggingFor r) Source # | |
class IndexTranslator r => Array (r :: Type -> Type) where Source #
Methods
arrayElem :: SValue r -> SValue r -> SVariable r Source #
Given array a and index i, creates `a[i]`
arrayLength :: SValue r -> SValue r Source #
Given an array, return its length
arrayCopy :: SValue r -> SValue r Source #
Given a source array, create a (shallow) copy of it
Instances
| Array r => Array (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods arrayElem :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> SVariable (LoggingFor r) Source # arrayLength :: SValue (LoggingFor r) -> SValue (LoggingFor r) Source # arrayCopy :: SValue (LoggingFor r) -> SValue (LoggingFor r) Source # | |
class IndexTranslator r => List (r :: Type -> Type) where Source #
Methods
listSize :: SValue r -> SValue r Source #
Finds the size of a list. Arguments are: List
listAccess :: SValue r -> SValue r -> SValue r Source #
Gets the value of an index of a list. Arguments are: List, Index
indexOf :: SValue r -> SValue r -> SValue r Source #
Finds the index of the first occurrence of a value in a list. Arguments are: List, Value
Instances
| List r => List (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods listSize :: SValue (LoggingFor r) -> SValue (LoggingFor r) Source # listAccess :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> SValue (LoggingFor r) Source # indexOf :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> SValue (LoggingFor r) Source # | |
class ListStatement (r :: Type -> Type) stmt | r -> stmt where Source #
Methods
listAdd :: SValue r -> SValue r -> SValue r -> MS (r stmt) Source #
Inserts a value into a list. Arguments are: List, Index, Value
listAppend :: SValue r -> SValue r -> MS (r stmt) Source #
Appens a value to a list. Arguments are: List, Value
listSet :: SValue r -> SValue r -> SValue r -> MS (r stmt) Source #
Sets the value of an index of a list. Arguments are: List, Index, Value
Instances
| ListStatement r stmt => ListStatement (LoggingFor r) stmt Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods listAdd :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> SValue (LoggingFor r) -> MS (LoggingFor r stmt) Source # listAppend :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> MS (LoggingFor r stmt) Source # listSet :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> SValue (LoggingFor r) -> MS (LoggingFor r stmt) Source # | |
class ValueSym r => InternalList (r :: Type -> Type) block | r -> block Source #
Minimal complete definition
listSlice'
Instances
| InternalList r block => InternalList (LoggingFor r) block Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods listSlice' :: Maybe (SValue (LoggingFor r)) -> Maybe (SValue (LoggingFor r)) -> Maybe (SValue (LoggingFor r)) -> SVariable (LoggingFor r) -> SValue (LoggingFor r) -> MS (LoggingFor r block) | |
listSlice :: InternalList r block => SVariable r -> SValue r -> Maybe (SValue r) -> Maybe (SValue r) -> Maybe (SValue r) -> MS (r block) Source #
Creates a slice of a list and assigns it to a variable. Arguments are: Variable to assign List to read from (optional) Start index inclusive. (if Nothing, then list start if step > 0, list end if step < 0) (optional) End index exclusive. (if Nothing, then list end if step > 0, list start if step > 0) (optional) Step (if Nothing, then defaults to 1)
listIndexExists :: (List r, Comparison r) => SValue r -> SValue r -> SValue r Source #
class ValueSym r => Set (r :: Type -> Type) where Source #
Methods
contains :: SValue r -> SValue r -> SValue r Source #
Checks membership Arguments are: Set, Value
setAdd :: SValue r -> SValue r -> SValue r Source #
Inserts a value into a set Arguments are: Set, Value
setRemove :: SValue r -> SValue r -> SValue r Source #
Removes a value from a set Arguments are: Set, Value
setUnion :: SValue r -> SValue r -> SValue r Source #
Removes a value from a set Arguments are: Set, Set
Instances
| Set r => Set (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods contains :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> SValue (LoggingFor r) Source # setAdd :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> SValue (LoggingFor r) Source # setRemove :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> SValue (LoggingFor r) Source # setUnion :: SValue (LoggingFor r) -> SValue (LoggingFor r) -> SValue (LoggingFor r) Source # | |
class (IndexTranslator r, Literal r) => NativeVector (r :: Type -> Type) where Source #
Vector operations for languages with native vector support (e.g. MATLAB,
Julia). Expression-based: every operation takes and returns SValues, so
operations compose like math (e.g. vecAdd (vecScale s a) b).
Vectors have their own vecType and litVec so callers don't depend on
how vectors are represented; these default to listType and litList.
Methods
vecType :: VS (r TypeData) -> VS (r TypeData) Source #
The type of a vector with the given element type.
Defaults to listType; a language may override it to use a distinct
vector representation.
litVec :: VS (r TypeData) -> [SValue r] -> SValue r Source #
A vector literal with the given element type and elements.
Defaults to litList.
vecScale :: SValue r -> SValue r -> SValue r Source #
Scales a vector by a scalar. Arguments are: Scalar, Vector
vecAdd :: SValue r -> SValue r -> SValue r Source #
Adds two vectors elementwise. Arguments are: Vector, Vector
vecIndex :: SValue r -> SValue r -> SValue r Source #
Gets the element of a vector at an index. Arguments are: Vector, Index
vecDot :: SValue r -> SValue r -> SValue r Source #
Dot product of two vectors (returns a scalar). Arguments are: Vector, Vector
vecMag :: SValue r -> SValue r Source #
Euclidean norm (magnitude) of a vector (returns a scalar). Argument is: Vector
vecUnit :: SValue r -> SValue r Source #
Unit vector in the direction of a vector (returns a vector). Argument is: Vector
Instances
| NativeVector lang => NativeVector (LoggingFor lang) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods vecType :: VS (LoggingFor lang TypeData) -> VS (LoggingFor lang TypeData) Source # litVec :: VS (LoggingFor lang TypeData) -> [SValue (LoggingFor lang)] -> SValue (LoggingFor lang) Source # vecScale :: SValue (LoggingFor lang) -> SValue (LoggingFor lang) -> SValue (LoggingFor lang) Source # vecAdd :: SValue (LoggingFor lang) -> SValue (LoggingFor lang) -> SValue (LoggingFor lang) Source # vecIndex :: SValue (LoggingFor lang) -> SValue (LoggingFor lang) -> SValue (LoggingFor lang) Source # vecDot :: SValue (LoggingFor lang) -> SValue (LoggingFor lang) -> SValue (LoggingFor lang) Source # vecMag :: SValue (LoggingFor lang) -> SValue (LoggingFor lang) Source # vecUnit :: SValue (LoggingFor lang) -> SValue (LoggingFor lang) Source # | |
class VisibilitySym (r :: k -> Type) (vis :: k) | r -> vis where Source #
A class for representing Visibility, of a class member, i.e. whether it is public or private.
Instances
| VisibilitySym r vis => VisibilitySym (LoggingFor r :: Type -> Type) (vis :: Type) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor | |
class VariableSym r => ParameterSym (r :: Type -> Type) where Source #
A class for representing function/method parameters.
Methods
param :: SVariable r -> MS (r ParamData) Source #
pointerParam :: SVariable r -> MS (r ParamData) Source #
A parameter that is an "alias" type, e.g. a C++ reference. This is a minor hack, to get around us not having/wanting "alias types" in GOOL.
Instances
| ParameterSym r => ParameterSym (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods param :: SVariable (LoggingFor r) -> MS (LoggingFor r ParamData) Source # pointerParam :: SVariable (LoggingFor r) -> MS (LoggingFor r ParamData) Source # | |
class (ParameterSym r, VisibilitySym r vis) => MethodSym (r :: Type -> Type) vis mthd bod | r -> mthd bod where Source #
A class for representing functions/methods.
Usually MethodData is used for the representation.
Methods
docMain :: MS (r bod) -> MS (r mthd) Source #
function :: Label -> r vis -> VS (r TypeData) -> [MS (r ParamData)] -> MS (r bod) -> MS (r mthd) Source #
mainFunction :: MS (r bod) -> MS (r mthd) Source #
docFunc :: String -> [String] -> Maybe String -> MS (r mthd) -> MS (r mthd) Source #
inOutFunc :: Label -> r vis -> InOutFunc r mthd bod Source #
docInOutFunc :: Label -> r vis -> DocInOutFunc r mthd bod Source #
Instances
| MethodSym r vis mthd bod => MethodSym (LoggingFor r) vis mthd bod Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods docMain :: MS (LoggingFor r bod) -> MS (LoggingFor r mthd) Source # function :: Label -> LoggingFor r vis -> VS (LoggingFor r TypeData) -> [MS (LoggingFor r ParamData)] -> MS (LoggingFor r bod) -> MS (LoggingFor r mthd) Source # mainFunction :: MS (LoggingFor r bod) -> MS (LoggingFor r mthd) Source # docFunc :: String -> [String] -> Maybe String -> MS (LoggingFor r mthd) -> MS (LoggingFor r mthd) Source # inOutFunc :: Label -> LoggingFor r vis -> InOutFunc (LoggingFor r) mthd bod Source # docInOutFunc :: Label -> LoggingFor r vis -> DocInOutFunc (LoggingFor r) mthd bod Source # | |
class ModuleSym (r :: k -> Type) (mod :: k) (mthd :: k) | r -> mod mthd where Source #
Class for representing a module.
Methods
buildModule :: Label -> [Label] -> [MS (r mthd)] -> FS (r mod) Source #
Given module name, list of import names, and list of module functions, generates a representation of a module.
Instances
| ModuleSym r mod mthd => ModuleSym (LoggingFor r :: Type -> Type) (mod :: Type) (mthd :: Type) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods buildModule :: Label -> [Label] -> [MS (LoggingFor r mthd)] -> FS (LoggingFor r mod) Source # | |
data VisibilityTag Source #
Instances
| Eq VisibilityTag Source # | |
Defined in Drasil.Shared.AST Methods (==) :: VisibilityTag -> VisibilityTag -> Bool # (/=) :: VisibilityTag -> VisibilityTag -> Bool # | |
Constructors
| Boolean | |
| Integer | |
| Float | |
| Double | |
| Char | |
| String | |
| InFile | |
| OutFile | |
| Reference CodeType | |
| List CodeType | |
| Set CodeType | |
| Array CodeType | |
| Object ClassName | |
| Func [CodeType] CodeType | |
| Void |
lensMStoVS :: Lens' MethodState ValueState Source #
onStateValue :: (a -> b) -> State s a -> State s b Source #
onCodeList :: Monad m => ([a] -> b) -> [m a] -> m b Source #
newtype LoggingFor (r :: Type -> Type) a Source #
Instances
class TypeSym r => TypeElim (r :: Type -> Type) where Source #
Methods
getCodeType :: r TypeData -> CodeType Source #
Instances
| TypeElim r => TypeElim (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods getCodeType :: LoggingFor r TypeData -> CodeType Source # | |