| 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 Value = ValData
- type NamedArgs (r :: k -> Type) (var :: k) (val :: k) = [(VS (r var), VS (r val))]
- class (UnRepr r TypeData, BodySym r bod block, BlockSym r block stmt, ValueSym r val typ, VariableSym r var typ, VariableValue r var val, ScopeSym r scope, BinderSym r binder typ, InternalList r block var val, VisibilitySym r vis, MethodSym r mthd vis param bod var typ, TypeSym r typ, TypeElim r typ, VariableElim r var typ, IndexTranslator r val, Array r var val, EmptyStatement r stmt, MultiStatement r stmt, ValueStatement r stmt val, AssignStatement r stmt var val, Argument r val, BooleanExpression r val, CommandLineArgs r val, CommentStatement r stmt, Comparison r val, ControlStatement r bod stmt var val, DeclStatement r bod stmt var scope val, FuncAppStatement r stmt var val, PrintConsole r stmt val, ReadConsole r stmt var, FileHandling r stmt var val, PrintFile r stmt val, ReadFile r stmt var val, List r val, ListStatement r stmt val, Literal r val typ, MathConstant r val, NumericExpression r val, ParameterSym r param var, Reference r val, Set r val, StringStatement r stmt var val, ValueExpression r var val binder typ, VariableValue r var val, ModuleSym r mod mthd, FileSym r file mod, ProgramSym r prg file) => ProcProg (r :: Type -> Type) prg file mod mthd vis param bod block stmt var scope val binder typ
- 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 :: k -> Type) (typ :: k) | r -> typ where
- bool :: VS (r typ)
- int :: VS (r typ)
- float :: VS (r typ)
- double :: VS (r typ)
- char :: VS (r typ)
- string :: VS (r typ)
- infile :: VS (r typ)
- outfile :: VS (r typ)
- referenceType :: VS (r typ) -> VS (r typ)
- listType :: VS (r typ) -> VS (r typ)
- setType :: VS (r typ) -> VS (r typ)
- arrayType :: VS (r typ) -> VS (r typ)
- innerType :: VS (r typ) -> VS (r typ)
- funcType :: [VS (r typ)] -> VS (r typ) -> VS (r typ)
- void :: VS (r typ)
- class BinderSym (r :: k -> Type) (binder :: k) (typ :: k) | r -> binder typ where
- class EmptyStatement (r :: k -> Type) (stmt :: k) | r -> stmt where
- class MultiStatement (r :: k -> Type) (stmt :: k) | r -> stmt where
- class ValueStatement (r :: k -> Type) (stmt :: k) (val :: k) | r -> stmt val where
- class AssignStatement (r :: k -> Type) (stmt :: k) (var :: k) (val :: k) | r -> stmt var val where
- (&=) :: forall {k} r (stmt :: k) (var :: k) (val :: k). AssignStatement r stmt var val => VS (r var) -> VS (r val) -> MS (r stmt)
- class DeclStatement (r :: k -> Type) (bod :: k) (stmt :: k) (var :: k) (scope :: k) (val :: k) | r -> bod stmt var scope val where
- varDec :: VS (r var) -> r scope -> MS (r stmt)
- varDecDef :: VS (r var) -> r scope -> VS (r val) -> MS (r stmt)
- listDec :: Integer -> VS (r var) -> r scope -> MS (r stmt)
- listDecDef :: VS (r var) -> r scope -> [VS (r val)] -> MS (r stmt)
- setDec :: VS (r var) -> r scope -> MS (r stmt)
- setDecDef :: VS (r var) -> r scope -> VS (r val) -> MS (r stmt)
- arrayDec :: Integer -> VS (r val) -> VS (r var) -> r scope -> MS (r stmt)
- arrayDecDef :: VS (r var) -> r scope -> [VS (r val)] -> MS (r stmt)
- constDecDef :: VS (r var) -> r scope -> VS (r val) -> MS (r stmt)
- funcDecDef :: VS (r var) -> r scope -> [VS (r var)] -> MS (r bod) -> MS (r stmt)
- class PrintConsole (r :: k -> Type) (stmt :: k) (val :: k) | r -> stmt val where
- class ReadConsole (r :: k -> Type) (stmt :: k) (var :: k) | r -> stmt var where
- getInput :: VS (r var) -> MS (r stmt)
- discardInput :: MS (r stmt)
- class FileHandling (r :: k -> Type) (stmt :: k) (var :: k) (val :: k) | r -> stmt var val where
- class PrintFile (r :: k -> Type) (stmt :: k) (val :: k) | r -> stmt val where
- class ReadFile (r :: k -> Type) (stmt :: k) (var :: k) (val :: k) | r -> stmt var val where
- getFileInput :: VS (r val) -> VS (r var) -> MS (r stmt)
- discardFileInput :: VS (r val) -> MS (r stmt)
- getFileInputLine :: VS (r val) -> VS (r var) -> MS (r stmt)
- discardFileLine :: VS (r val) -> MS (r stmt)
- getFileInputAll :: VS (r val) -> VS (r var) -> MS (r stmt)
- class StringStatement (r :: k -> Type) (stmt :: k) (var :: k) (val :: k) | r -> stmt var val where
- stringSplit :: Char -> VS (r var) -> VS (r val) -> MS (r stmt)
- stringListVals :: [VS (r var)] -> VS (r val) -> MS (r stmt)
- stringListLists :: [VS (r var)] -> VS (r val) -> MS (r stmt)
- class FuncAppStatement (r :: k -> Type) (stmt :: k) (var :: k) (val :: k) | r -> stmt var val where
- inOutCall :: InOutCall r stmt var val
- extInOutCall :: Library -> InOutCall r stmt var val
- class CommentStatement (r :: k -> Type) (stmt :: k) | r -> stmt where
- class ControlStatement (r :: k -> Type) (bod :: k) (stmt :: k) (var :: k) (val :: k) | r -> bod stmt var val where
- break :: MS (r stmt)
- continue :: MS (r stmt)
- returnStmt :: VS (r val) -> MS (r stmt)
- throw :: Label -> MS (r stmt)
- ifCond :: [(VS (r val), MS (r bod))] -> MS (r bod) -> MS (r stmt)
- switch :: VS (r val) -> [(VS (r val), MS (r bod))] -> MS (r bod) -> MS (r stmt)
- ifExists :: VS (r val) -> MS (r bod) -> MS (r bod) -> MS (r stmt)
- for :: MS (r stmt) -> VS (r val) -> MS (r stmt) -> MS (r bod) -> MS (r stmt)
- forRange :: VS (r var) -> VS (r val) -> VS (r val) -> VS (r val) -> MS (r bod) -> MS (r stmt)
- forEach :: VS (r var) -> VS (r val) -> MS (r bod) -> MS (r stmt)
- while :: VS (r val) -> MS (r bod) -> MS (r stmt)
- tryCatch :: MS (r bod) -> MS (r bod) -> MS (r stmt)
- assert :: VS (r val) -> VS (r val) -> MS (r stmt)
- ifNoElse :: forall {k} r (bod :: k) (block :: k) (stmt :: k) (var :: k) (val :: k). (BodySym r bod block, ControlStatement r bod stmt var val) => [(VS (r val), MS (r bod))] -> MS (r stmt)
- switchAsIf :: forall {k} r (bod :: k) (stmt :: k) (var :: k) (val :: k). (ControlStatement r bod stmt var val, Comparison r val) => VS (r val) -> [(VS (r val), MS (r bod))] -> MS (r bod) -> MS (r stmt)
- class VariableSym (r :: k -> Type) (var :: k) (typ :: k) | r -> var typ where
- class ScopeSym (r :: k -> Type) (scope :: k) | r -> scope where
- class VariableElim (r :: k -> Type) (var :: k) (typ :: k) | r -> var typ where
- variableName :: r var -> String
- variableType :: r var -> r typ
- listOf :: forall {k} r (typ :: k) (var :: k). (TypeSym r typ, VariableSym r var typ) => Label -> VS (r typ) -> VS (r var)
- listVar :: forall {k} r (typ :: k) (var :: k). (TypeSym r typ, VariableSym r var typ) => Label -> VS (r typ) -> VS (r var)
- class ValueSym (r :: k -> Type) (val :: k) (typ :: k) | r -> val typ where
- valueType :: r val -> r typ
- class Argument (r :: k -> Type) (val :: k) | r -> val where
- pointerArg :: VS (r val) -> VS (r val)
- class Literal (r :: k -> Type) (val :: k) (typ :: k) | r -> val typ where
- litTrue :: VS (r val)
- litFalse :: VS (r val)
- litChar :: Char -> VS (r val)
- litDouble :: Double -> VS (r val)
- litFloat :: Float -> VS (r val)
- litInt :: Integer -> VS (r val)
- litString :: String -> VS (r val)
- litArray :: VS (r typ) -> [VS (r val)] -> VS (r val)
- litList :: VS (r typ) -> [VS (r val)] -> VS (r val)
- litSet :: VS (r typ) -> [VS (r val)] -> VS (r val)
- class MathConstant (r :: k -> Type) (val :: k) | r -> val where
- class VariableValue (r :: k -> Type) (var :: k) (val :: k) | r -> var val where
- class CommandLineArgs (r :: k -> Type) (val :: k) | r -> val where
- class NumericExpression (r :: k -> Type) (val :: k) | r -> val where
- (#~) :: VS (r val) -> VS (r val)
- (#/^) :: VS (r val) -> VS (r val)
- (#|) :: VS (r val) -> VS (r val)
- (#+) :: VS (r val) -> VS (r val) -> VS (r val)
- (#-) :: VS (r val) -> VS (r val) -> VS (r val)
- (#*) :: VS (r val) -> VS (r val) -> VS (r val)
- (#/) :: VS (r val) -> VS (r val) -> VS (r val)
- (#%) :: VS (r val) -> VS (r val) -> VS (r val)
- (#^) :: VS (r val) -> VS (r val) -> VS (r val)
- log :: VS (r val) -> VS (r val)
- ln :: VS (r val) -> VS (r val)
- exp :: VS (r val) -> VS (r val)
- sin :: VS (r val) -> VS (r val)
- cos :: VS (r val) -> VS (r val)
- tan :: VS (r val) -> VS (r val)
- csc :: VS (r val) -> VS (r val)
- sec :: VS (r val) -> VS (r val)
- cot :: VS (r val) -> VS (r val)
- arcsin :: VS (r val) -> VS (r val)
- arccos :: VS (r val) -> VS (r val)
- arctan :: VS (r val) -> VS (r val)
- floor :: VS (r val) -> VS (r val)
- ceil :: VS (r val) -> VS (r val)
- class BooleanExpression (r :: k -> Type) (val :: k) | r -> val where
- class Comparison (r :: k -> Type) (val :: k) | r -> val where
- class ValueExpression (r :: k -> Type) (var :: k) (val :: k) (binder :: k) (typ :: k) | r -> var val binder typ where
- inlineIf :: VS (r val) -> VS (r val) -> VS (r val) -> VS (r val)
- funcAppMixedArgs :: MixedCall r var val typ
- extFuncAppMixedArgs :: Library -> MixedCall r var val typ
- libFuncAppMixedArgs :: Library -> MixedCall r var val typ
- lambda :: [VS (r binder)] -> VS (r val) -> VS (r val)
- notNull :: VS (r val) -> VS (r val)
- funcApp :: forall {k} r (var :: k) (val :: k) (binder :: k) (typ :: k). ValueExpression r var val binder typ => PosCall r val typ
- funcAppNamedArgs :: forall {k} r (var :: k) (val :: k) (binder :: k) (typ :: k). ValueExpression r var val binder typ => Label -> VS (r typ) -> NamedArgs r var val -> VS (r val)
- extFuncApp :: forall {k} r (var :: k) (val :: k) (binder :: k) (typ :: k). ValueExpression r var val binder typ => Library -> PosCall r val typ
- libFuncApp :: forall {k} r (var :: k) (val :: k) (binder :: k) (typ :: k). ValueExpression r var val binder typ => Library -> PosCall r val typ
- exists :: forall {k} r (var :: k) (val :: k) (binder :: k) (typ :: k). ValueExpression r var val binder typ => VS (r val) -> VS (r val)
- class Reference (r :: k -> Type) (val :: k) | r -> val where
- class Array (r :: k -> Type) (var :: k) (val :: k) | r -> var val where
- class List (r :: k -> Type) (val :: k) | r -> val where
- class ListStatement (r :: k -> Type) (stmt :: k) (val :: k) | r -> stmt val where
- class InternalList (r :: k -> Type) (block :: k) (var :: k) (val :: k) | r -> block var val
- listSlice :: forall {k} r (block :: k) (var :: k) (val :: k). InternalList r block var val => VS (r var) -> VS (r val) -> Maybe (VS (r val)) -> Maybe (VS (r val)) -> Maybe (VS (r val)) -> MS (r block)
- listIndexExists :: forall {k} r (val :: k). (List r val, Comparison r val) => VS (r val) -> VS (r val) -> VS (r val)
- at :: forall {k} r (val :: k). List r val => VS (r val) -> VS (r val) -> VS (r val)
- class Set (r :: k -> Type) (val :: k) | r -> val where
- class NativeVector (r :: k -> Type) (val :: k) (typ :: k) | r -> val typ where
- vecType :: VS (r typ) -> VS (r typ)
- litVec :: VS (r typ) -> [VS (r val)] -> VS (r val)
- vecScale :: VS (r val) -> VS (r val) -> VS (r val)
- vecAdd :: VS (r val) -> VS (r val) -> VS (r val)
- vecIndex :: VS (r val) -> VS (r val) -> VS (r val)
- vecDot :: VS (r val) -> VS (r val) -> VS (r val)
- vecMag :: VS (r val) -> VS (r val)
- vecUnit :: VS (r val) -> VS (r val)
- class VisibilitySym (r :: k -> Type) (vis :: k) | r -> vis where
- class ParameterSym (r :: k -> Type) (param :: k) (var :: k) | r -> param var where
- class MethodSym (r :: k -> Type) (mthd :: k) (vis :: k) (param :: k) (bod :: k) (var :: k) (typ :: k) | r -> mthd vis param bod var typ where
- docMain :: MS (r bod) -> MS (r mthd)
- function :: Label -> r vis -> VS (r typ) -> [MS (r param)] -> 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 var
- docInOutFunc :: Label -> r vis -> DocInOutFunc r mthd bod var
- class ModuleSym (r :: k -> Type) (mod :: k) (mthd :: k) | r -> mod mthd where
- buildModule :: Label -> [Label] -> [MS (r mthd)] -> FS (r mod)
- convType :: forall {k} r (typ :: k). TypeSym r typ => CodeType -> VS (r typ)
- 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 TypeElim (r :: k -> Type) (typ :: k) | r -> typ where
- getCodeType :: r typ -> CodeType
- getTypeString :: UnRepr r TypeData => r TypeData -> String
Documentation
class (UnRepr r TypeData, BodySym r bod block, BlockSym r block stmt, ValueSym r val typ, VariableSym r var typ, VariableValue r var val, ScopeSym r scope, BinderSym r binder typ, InternalList r block var val, VisibilitySym r vis, MethodSym r mthd vis param bod var typ, TypeSym r typ, TypeElim r typ, VariableElim r var typ, IndexTranslator r val, Array r var val, EmptyStatement r stmt, MultiStatement r stmt, ValueStatement r stmt val, AssignStatement r stmt var val, Argument r val, BooleanExpression r val, CommandLineArgs r val, CommentStatement r stmt, Comparison r val, ControlStatement r bod stmt var val, DeclStatement r bod stmt var scope val, FuncAppStatement r stmt var val, PrintConsole r stmt val, ReadConsole r stmt var, FileHandling r stmt var val, PrintFile r stmt val, ReadFile r stmt var val, List r val, ListStatement r stmt val, Literal r val typ, MathConstant r val, NumericExpression r val, ParameterSym r param var, Reference r val, Set r val, StringStatement r stmt var val, ValueExpression r var val binder typ, VariableValue r var val, ModuleSym r mod mthd, FileSym r file mod, ProgramSym r prg file) => ProcProg (r :: Type -> Type) prg file mod mthd vis param bod block stmt var scope val binder typ Source #
Wrapper typeclass that bundles everything essential for generating a procedural program.
Instances
| ProcProg JuliaCode ProgData FileData ModData MethodData Doc ParamData Body Block Statement Variable ScopeData Value BinderD TypeData Source # | |
Defined in Drasil.GProc.LanguageRenderer.JuliaRenderer | |
| ProcProg MatlabCode ProgData FileData ModData MethodData Doc ParamData Body Block Statement Variable ScopeData Value BinderD TypeData Source # | |
Defined in Drasil.GProc.LanguageRenderer.MatlabRenderer | |
| ProcProg r prg file mod mthd vis param bod block stmt var scope val binder typ => ProcProg (LoggingFor r) prg file mod mthd vis param bod block stmt var scope val binder typ 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 JuliaCode ProgData FileData Source # | |
| ProgramSym MatlabCode ProgData FileData Source # | |
Defined in Drasil.GProc.LanguageRenderer.MatlabRenderer | |
| 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 JuliaCode FileData ModData Source # | |
| FileSym MatlabCode FileData ModData Source # | |
Defined in Drasil.GProc.LanguageRenderer.MatlabRenderer | |
| 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
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
class TypeSym (r :: k -> Type) (typ :: k) | r -> typ where Source #
Class for representing a type.
Methods
outfile :: VS (r typ) Source #
referenceType :: VS (r typ) -> VS (r typ) Source #
listType :: VS (r typ) -> VS (r typ) Source #
setType :: VS (r typ) -> VS (r typ) Source #
arrayType :: VS (r typ) -> VS (r typ) Source #
innerType :: VS (r typ) -> VS (r typ) Source #
funcType :: [VS (r typ)] -> VS (r typ) -> VS (r typ) Source #
Instances
class BinderSym (r :: k -> Type) (binder :: k) (typ :: k) | r -> binder typ 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
class EmptyStatement (r :: k -> Type) (stmt :: k) | r -> stmt where Source #
Instances
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
class ValueStatement (r :: k -> Type) (stmt :: k) (val :: k) | r -> stmt val where Source #
Instances
class AssignStatement (r :: k -> Type) (stmt :: k) (var :: k) (val :: k) | r -> stmt var val where Source #
Methods
(&-=) :: VS (r var) -> VS (r val) -> MS (r stmt) infixl 1 Source #
(&+=) :: VS (r var) -> VS (r val) -> MS (r stmt) infixl 1 Source #
(&++) :: VS (r var) -> MS (r stmt) infixl 8 Source #
Instances
(&=) :: forall {k} r (stmt :: k) (var :: k) (val :: k). AssignStatement r stmt var val => VS (r var) -> VS (r val) -> MS (r stmt) infixr 1 Source #
class DeclStatement (r :: k -> Type) (bod :: k) (stmt :: k) (var :: k) (scope :: k) (val :: k) | r -> bod stmt var scope val where Source #
Methods
varDec :: VS (r var) -> r scope -> MS (r stmt) Source #
Declare a variable without giving it a value.
Not for use with arrays; use arrayDec instead.
varDecDef :: VS (r var) -> r scope -> VS (r val) -> MS (r stmt) Source #
Declare a variable and give it a value.
Not for use with arrays; use arrayDecDef instead.
listDec :: Integer -> VS (r var) -> r scope -> 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 :: VS (r var) -> r scope -> [VS (r val)] -> MS (r stmt) Source #
setDec :: VS (r var) -> r scope -> MS (r stmt) Source #
setDecDef :: VS (r var) -> r scope -> VS (r val) -> MS (r stmt) Source #
arrayDec :: Integer -> VS (r val) -> VS (r var) -> r scope -> 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 :: VS (r var) -> r scope -> [VS (r val)] -> MS (r stmt) Source #
constDecDef :: VS (r var) -> r scope -> VS (r val) -> MS (r stmt) Source #
funcDecDef :: VS (r var) -> r scope -> [VS (r var)] -> MS (r bod) -> MS (r stmt) Source #
Instances
class PrintConsole (r :: k -> Type) (stmt :: k) (val :: k) | r -> stmt val where Source #
Methods
print :: VS (r val) -> MS (r stmt) Source #
printLn :: VS (r val) -> MS (r stmt) Source #
printStr :: String -> MS (r stmt) Source #
printStrLn :: String -> MS (r stmt) Source #
Instances
class ReadConsole (r :: k -> Type) (stmt :: k) (var :: k) | r -> stmt var where Source #
Instances
class FileHandling (r :: k -> Type) (stmt :: k) (var :: k) (val :: k) | r -> stmt var val where Source #
Methods
openFileR :: VS (r var) -> VS (r val) -> MS (r stmt) Source #
openFileW :: VS (r var) -> VS (r val) -> MS (r stmt) Source #
openFileA :: VS (r var) -> VS (r val) -> MS (r stmt) Source #
Instances
class PrintFile (r :: k -> Type) (stmt :: k) (val :: k) | r -> stmt val where Source #
Methods
printFile :: VS (r val) -> VS (r val) -> MS (r stmt) Source #
Given the file handle and value to print, print the value to the file.
printFileLn :: VS (r val) -> VS (r val) -> MS (r stmt) Source #
printFileStr :: VS (r val) -> String -> MS (r stmt) Source #
printFileStrLn :: VS (r val) -> String -> MS (r stmt) Source #
Instances
class ReadFile (r :: k -> Type) (stmt :: k) (var :: k) (val :: k) | r -> stmt var val where Source #
Methods
getFileInput :: VS (r val) -> VS (r var) -> MS (r stmt) Source #
discardFileInput :: VS (r val) -> MS (r stmt) Source #
getFileInputLine :: VS (r val) -> VS (r var) -> MS (r stmt) Source #
discardFileLine :: VS (r val) -> MS (r stmt) Source #
getFileInputAll :: VS (r val) -> VS (r var) -> MS (r stmt) Source #
Instances
class StringStatement (r :: k -> Type) (stmt :: k) (var :: k) (val :: k) | r -> stmt var val where Source #
Methods
stringSplit :: Char -> VS (r var) -> VS (r val) -> 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 :: [VS (r var)] -> VS (r val) -> MS (r stmt) Source #
stringListLists :: [VS (r var)] -> VS (r val) -> 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
class FuncAppStatement (r :: k -> Type) (stmt :: k) (var :: k) (val :: k) | r -> stmt var val where Source #
Methods
inOutCall :: InOutCall r stmt var val Source #
extInOutCall :: Library -> InOutCall r stmt var val Source #
Instances
class CommentStatement (r :: k -> Type) (stmt :: k) | r -> stmt where Source #
Instances
class ControlStatement (r :: k -> Type) (bod :: k) (stmt :: k) (var :: k) (val :: k) | r -> bod stmt var val where Source #
Methods
continue :: MS (r stmt) Source #
returnStmt :: VS (r val) -> MS (r stmt) Source #
throw :: Label -> MS (r stmt) Source #
ifCond :: [(VS (r val), 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 :: VS (r val) -> [(VS (r val), MS (r bod))] -> MS (r bod) -> MS (r stmt) Source #
ifExists :: VS (r val) -> MS (r bod) -> MS (r bod) -> MS (r stmt) Source #
for :: MS (r stmt) -> VS (r val) -> MS (r stmt) -> MS (r bod) -> MS (r stmt) Source #
forRange :: VS (r var) -> VS (r val) -> VS (r val) -> VS (r val) -> MS (r bod) -> MS (r stmt) Source #
forEach :: VS (r var) -> VS (r val) -> MS (r bod) -> MS (r stmt) Source #
while :: VS (r val) -> MS (r bod) -> MS (r stmt) Source #
tryCatch :: MS (r bod) -> MS (r bod) -> MS (r stmt) Source #
Instances
ifNoElse :: forall {k} r (bod :: k) (block :: k) (stmt :: k) (var :: k) (val :: k). (BodySym r bod block, ControlStatement r bod stmt var val) => [(VS (r val), MS (r bod))] -> MS (r stmt) Source #
switchAsIf :: forall {k} r (bod :: k) (stmt :: k) (var :: k) (val :: k). (ControlStatement r bod stmt var val, Comparison r val) => VS (r val) -> [(VS (r val), MS (r bod))] -> MS (r bod) -> MS (r stmt) Source #
class VariableSym (r :: k -> Type) (var :: k) (typ :: k) | r -> var typ where Source #
Class for representing variables.
Methods
var :: Label -> VS (r typ) -> VS (r var) Source #
An instance- or function-level variable, separate from its instance (i.e. v, not `o.v`)
constant :: Label -> VS (r typ) -> VS (r var) Source #
An instance- or function-level constant, separate from its instance (i.e. v, not `o.v`)
extVar :: Library -> Label -> VS (r typ) -> VS (r var) 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
class ScopeSym (r :: k -> Type) (scope :: k) | r -> scope 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
class VariableElim (r :: k -> Type) (var :: k) (typ :: k) | r -> var typ where Source #
Instances
listOf :: forall {k} r (typ :: k) (var :: k). (TypeSym r typ, VariableSym r var typ) => Label -> VS (r typ) -> VS (r var) Source #
listVar :: forall {k} r (typ :: k) (var :: k). (TypeSym r typ, VariableSym r var typ) => Label -> VS (r typ) -> VS (r var) Source #
class ValueSym (r :: k -> Type) (val :: k) (typ :: k) | r -> val typ where Source #
Class for representing a value.
Instances
class Argument (r :: k -> Type) (val :: k) | r -> val where Source #
Methods
pointerArg :: VS (r val) -> VS (r val) Source #
Instances
class Literal (r :: k -> Type) (val :: k) (typ :: k) | r -> val typ where Source #
Methods
litTrue :: VS (r val) Source #
litFalse :: VS (r val) Source #
litChar :: Char -> VS (r val) Source #
litDouble :: Double -> VS (r val) Source #
litFloat :: Float -> VS (r val) Source #
litInt :: Integer -> VS (r val) Source #
litString :: String -> VS (r val) Source #
litArray :: VS (r typ) -> [VS (r val)] -> VS (r val) Source #
litList :: VS (r typ) -> [VS (r val)] -> VS (r val) Source #
Instances
class MathConstant (r :: k -> Type) (val :: k) | r -> val where Source #
Instances
class VariableValue (r :: k -> Type) (var :: k) (val :: k) | r -> var val where Source #
Instances
class CommandLineArgs (r :: k -> Type) (val :: k) | r -> val where Source #
Instances
| CommandLineArgs CodeInfoOO () Source # | |
Defined in Drasil.GOOL.CodeInfoOO | |
| CommandLineArgs CSharpCode Value Source # | |
| CommandLineArgs CppHdrCode Value Source # | |
| CommandLineArgs CppSrcCode Value Source # | |
| CommandLineArgs JavaCode Value Source # | |
| CommandLineArgs PythonCode Value Source # | |
| CommandLineArgs SwiftCode Value Source # | |
| CommandLineArgs JuliaCode Value Source # | |
| CommandLineArgs MatlabCode Value Source # | |
| CommandLineArgs r val => CommandLineArgs (LoggingFor r :: Type -> Type) (val :: Type) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor | |
| Pair p => CommandLineArgs (p CppSrcCode CppHdrCode :: Type -> Type) Value Source # | |
Defined in Drasil.GOOL.LanguageRenderer.CppRenderer Methods arg :: Integer -> VS (p CppSrcCode CppHdrCode Value) Source # argsList :: VS (p CppSrcCode CppHdrCode Value) Source # argExists :: Integer -> VS (p CppSrcCode CppHdrCode Value) Source # | |
class NumericExpression (r :: k -> Type) (val :: k) | r -> val where Source #
Methods
(#~) :: VS (r val) -> VS (r val) infixl 8 Source #
(#/^) :: VS (r val) -> VS (r val) infixl 7 Source #
(#|) :: VS (r val) -> VS (r val) infixl 7 Source #
(#+) :: VS (r val) -> VS (r val) -> VS (r val) infixl 5 Source #
(#-) :: VS (r val) -> VS (r val) -> VS (r val) infixl 5 Source #
(#*) :: VS (r val) -> VS (r val) -> VS (r val) infixl 6 Source #
(#/) :: VS (r val) -> VS (r val) -> VS (r val) infixl 6 Source #
(#%) :: VS (r val) -> VS (r val) -> VS (r val) infixl 6 Source #
(#^) :: VS (r val) -> VS (r val) -> VS (r val) infixl 7 Source #
log :: VS (r val) -> VS (r val) Source #
ln :: VS (r val) -> VS (r val) Source #
exp :: VS (r val) -> VS (r val) Source #
sin :: VS (r val) -> VS (r val) Source #
cos :: VS (r val) -> VS (r val) Source #
tan :: VS (r val) -> VS (r val) Source #
csc :: VS (r val) -> VS (r val) Source #
sec :: VS (r val) -> VS (r val) Source #
cot :: VS (r val) -> VS (r val) Source #
arcsin :: VS (r val) -> VS (r val) Source #
arccos :: VS (r val) -> VS (r val) Source #
arctan :: VS (r val) -> VS (r val) Source #
Instances
class BooleanExpression (r :: k -> Type) (val :: k) | r -> val where Source #
Methods
(?!) :: VS (r val) -> VS (r val) infixr 6 Source #
(?&&) :: VS (r val) -> VS (r val) -> VS (r val) infixl 2 Source #
(?||) :: VS (r val) -> VS (r val) -> VS (r val) infixl 1 Source #
Instances
class Comparison (r :: k -> Type) (val :: k) | r -> val where Source #
Methods
(?<) :: VS (r val) -> VS (r val) -> VS (r val) infixl 4 Source #
(?<=) :: VS (r val) -> VS (r val) -> VS (r val) infixl 4 Source #
(?>) :: VS (r val) -> VS (r val) -> VS (r val) infixl 4 Source #
(?>=) :: VS (r val) -> VS (r val) -> VS (r val) infixl 4 Source #
(?==) :: VS (r val) -> VS (r val) -> VS (r val) infixl 3 Source #
(?!=) :: VS (r val) -> VS (r val) -> VS (r val) infixl 3 Source #
Instances
class ValueExpression (r :: k -> Type) (var :: k) (val :: k) (binder :: k) (typ :: k) | r -> var val binder typ where Source #
A class for representing values that can include expressions
Methods
inlineIf :: VS (r val) -> VS (r val) -> VS (r val) -> VS (r val) Source #
funcAppMixedArgs :: MixedCall r var val typ Source #
extFuncAppMixedArgs :: Library -> MixedCall r var val typ Source #
libFuncAppMixedArgs :: Library -> MixedCall r var val typ Source #
lambda :: [VS (r binder)] -> VS (r val) -> VS (r val) Source #
Instances
funcApp :: forall {k} r (var :: k) (val :: k) (binder :: k) (typ :: k). ValueExpression r var val binder typ => PosCall r val typ Source #
funcAppNamedArgs :: forall {k} r (var :: k) (val :: k) (binder :: k) (typ :: k). ValueExpression r var val binder typ => Label -> VS (r typ) -> NamedArgs r var val -> VS (r val) Source #
extFuncApp :: forall {k} r (var :: k) (val :: k) (binder :: k) (typ :: k). ValueExpression r var val binder typ => Library -> PosCall r val typ Source #
libFuncApp :: forall {k} r (var :: k) (val :: k) (binder :: k) (typ :: k). ValueExpression r var val binder typ => Library -> PosCall r val typ Source #
exists :: forall {k} r (var :: k) (val :: k) (binder :: k) (typ :: k). ValueExpression r var val binder typ => VS (r val) -> VS (r val) Source #
class Reference (r :: k -> Type) (val :: k) | r -> val where Source #
A class for representing references. By "reference" we basically mean "C++ pointer" or "OCaml reference".
Methods
makeRef :: VS (r val) -> VS (r val) Source #
Given a value, convert it to a reference to that value
maybeDeref :: VS (r val) -> VS (r val) Source #
Given a value that may be a reference type, apply any necessary dereference operation.
Instances
class Array (r :: k -> Type) (var :: k) (val :: k) | r -> var val where Source #
Methods
arrayElem :: VS (r val) -> VS (r val) -> VS (r var) Source #
Given array a and index i, creates `a[i]`
arrayLength :: VS (r val) -> VS (r val) Source #
Given an array, return its length
arrayCopy :: VS (r val) -> VS (r val) Source #
Given a source array, create a (shallow) copy of it
Instances
class List (r :: k -> Type) (val :: k) | r -> val where Source #
Methods
listSize :: VS (r val) -> VS (r val) Source #
Finds the size of a list. Arguments are: List
listAccess :: VS (r val) -> VS (r val) -> VS (r val) Source #
Gets the value of an index of a list. Arguments are: List, Index
indexOf :: VS (r val) -> VS (r val) -> VS (r val) Source #
Finds the index of the first occurrence of a value in a list. Arguments are: List, val
Instances
class ListStatement (r :: k -> Type) (stmt :: k) (val :: k) | r -> stmt val where Source #
Methods
listAdd :: VS (r val) -> VS (r val) -> VS (r val) -> MS (r stmt) Source #
Inserts a value into a list. Arguments are: List, Index, val
listAppend :: VS (r val) -> VS (r val) -> MS (r stmt) Source #
Appens a value to a list. Arguments are: List, val
listSet :: VS (r val) -> VS (r val) -> VS (r val) -> MS (r stmt) Source #
Sets the value of an index of a list. Arguments are: List, Index, val
Instances
class InternalList (r :: k -> Type) (block :: k) (var :: k) (val :: k) | r -> block var val Source #
Minimal complete definition
Instances
listSlice :: forall {k} r (block :: k) (var :: k) (val :: k). InternalList r block var val => VS (r var) -> VS (r val) -> Maybe (VS (r val)) -> Maybe (VS (r val)) -> Maybe (VS (r val)) -> 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 :: forall {k} r (val :: k). (List r val, Comparison r val) => VS (r val) -> VS (r val) -> VS (r val) Source #
class Set (r :: k -> Type) (val :: k) | r -> val where Source #
Methods
contains :: VS (r val) -> VS (r val) -> VS (r val) Source #
Checks membership Arguments are: Set, val
setAdd :: VS (r val) -> VS (r val) -> VS (r val) Source #
Inserts a value into a set Arguments are: Set, val
setRemove :: VS (r val) -> VS (r val) -> VS (r val) Source #
Removes a value from a set Arguments are: Set, val
setUnion :: VS (r val) -> VS (r val) -> VS (r val) Source #
Removes a value from a set Arguments are: Set, Set
Instances
class NativeVector (r :: k -> Type) (val :: k) (typ :: k) | r -> val typ where Source #
Vector operations for languages with native vector support (e.g. MATLAB,
Julia). Expression-based: every operation takes and returns 'VS val's, 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 typ) -> VS (r typ) Source #
The type of a vector with the given element type.
For most languages it will be listType
litVec :: VS (r typ) -> [VS (r val)] -> VS (r val) Source #
A vector literal with the given element type and elements.
For most languages it will be litList.
vecScale :: VS (r val) -> VS (r val) -> VS (r val) Source #
Scales a vector by a scalar. Arguments are: Scalar, Vector
vecAdd :: VS (r val) -> VS (r val) -> VS (r val) Source #
Adds two vectors elementwise. Arguments are: Vector, Vector
vecIndex :: VS (r val) -> VS (r val) -> VS (r val) Source #
Gets the element of a vector at an index. Arguments are: Vector, Index
vecDot :: VS (r val) -> VS (r val) -> VS (r val) Source #
Dot product of two vectors (returns a scalar). Arguments are: Vector, Vector
vecMag :: VS (r val) -> VS (r val) Source #
Euclidean norm (magnitude) of a vector (returns a scalar). Argument is: Vector
vecUnit :: VS (r val) -> VS (r val) Source #
Unit vector in the direction of a vector (returns a vector). Argument is: Vector
Instances
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
class ParameterSym (r :: k -> Type) (param :: k) (var :: k) | r -> param var where Source #
A class for representing function/method parameters.
Methods
param :: VS (r var) -> MS (r param) Source #
pointerParam :: VS (r var) -> MS (r param) 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
class MethodSym (r :: k -> Type) (mthd :: k) (vis :: k) (param :: k) (bod :: k) (var :: k) (typ :: k) | r -> mthd vis param bod var typ 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 typ) -> [MS (r param)] -> 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 var Source #
docInOutFunc :: Label -> r vis -> DocInOutFunc r mthd bod var Source #
Instances
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 JuliaCode ModData MethodData Source # | |
Defined in Drasil.GProc.LanguageRenderer.JuliaRenderer | |
| ModuleSym MatlabCode ModData MethodData Source # | |
Defined in Drasil.GProc.LanguageRenderer.MatlabRenderer Methods buildModule :: Label -> [Label] -> [MS (MatlabCode MethodData)] -> FS (MatlabCode ModData) Source # | |
| 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 # | |
Instances
Instances
Instances
Instances
data VisibilityTag Source #
Instances
Instances
Constructors
| Boolean | |
| Integer | |
| Float | |
| Double | |
| Char | |
| String | |
| InFile | |
| OutFile | |
| Reference CodeType | |
| List CodeType | |
| Set CodeType | |
| Array CodeType | |
| Object ClassName | |
| Func [CodeType] CodeType | |
| Void |
Constructors
| GS | |
Fields
| |
Instances
| ProgramSym CodeInfoOO GOOLState () Source # | |
Defined in Drasil.GOOL.CodeInfoOO Methods prog :: Label -> Label -> [FS (CodeInfoOO ())] -> GSProgram CodeInfoOO GOOLState Source # | |
| OOProg CodeInfoOO GOOLState () () () () () () () () () () () () () () () () Source # | |
Defined in Drasil.GOOL.CodeInfoOO | |
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 #
unMLC :: MatlabCode a -> a Source #
newtype LoggingFor (r :: Type -> Type) a Source #
Instances
class TypeElim (r :: k -> Type) (typ :: k) | r -> typ where Source #
Methods
getCodeType :: r typ -> CodeType Source #