| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Drasil.Shared.InterfaceCommon
Synopsis
- type Label = String
- type Library = String
- type Body = Doc
- type Block = Doc
- type Variable = VarData
- type Value = ValData
- type NamedArgs (r :: k -> Type) (var :: k) (val :: k) = [(VS (r var), VS (r val))]
- type MixedCall (r :: k -> Type) (var :: k) (val :: k) (typ :: k) = Label -> VS (r typ) -> [VS (r val)] -> NamedArgs r var val -> VS (r val)
- type MixedCtorCall (r :: k -> Type) (var :: k) (val :: k) (typ :: k) = VS (r typ) -> [VS (r val)] -> NamedArgs r var val -> VS (r val)
- type PosCall (r :: k -> Type) (val :: k) (typ :: k) = Label -> VS (r typ) -> [VS (r val)] -> VS (r val)
- type PosCtorCall (r :: k -> Type) (val :: k) (typ :: k) = VS (r typ) -> [VS (r val)] -> VS (r val)
- type InOutCall (r :: k -> Type) (stmt :: k) (var :: k) (val :: k) = Label -> [VS (r val)] -> [VS (r var)] -> [VS (r var)] -> MS (r stmt)
- type InOutFunc (r :: k -> Type) (mthd :: k) (bod :: k) (var :: k) = [VS (r var)] -> [VS (r var)] -> [VS (r var)] -> MS (r bod) -> MS (r mthd)
- type DocInOutFunc (r :: k -> Type) (mthd :: k) (bod :: k) (var :: k) = String -> [(String, VS (r var))] -> [(String, VS (r var))] -> [(String, VS (r var))] -> MS (r bod) -> MS (r mthd)
- class UnRepr (repr :: Type -> Type) contents where
- unRepr :: repr contents -> contents
- 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 TypeElim (r :: k -> Type) (typ :: k) | r -> typ where
- getCodeType :: r typ -> CodeType
- getTypeString :: UnRepr r TypeData => r TypeData -> String
- class VariableSym (r :: k -> Type) (var :: k) (typ :: k) | r -> var typ where
- class ScopeSym (r :: k -> Type) (scope :: k) | r -> scope where
- convScope :: forall {k} r (scope :: k). ScopeSym r scope => ScopeData -> r scope
- 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)
- litZero :: forall {k} r (val :: k) (typ :: k). (Literal r val typ, TypeElim r typ) => VS (r typ) -> 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 IndexTranslator (r :: k -> Type) (val :: k) | r -> val where
- intToIndex :: VS (r val) -> VS (r val)
- indexToInt :: 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 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 InternalList (r :: k -> Type) (block :: k) (var :: k) (val :: k) | r -> block var val where
- 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 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 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 BinderSym (r :: k -> Type) (binder :: k) (typ :: k) | r -> binder typ where
- class BinderElim (r :: k -> Type) (binder :: k) (typ :: k) | r -> binder typ where
- binderName :: r binder -> String
- binderType :: r binder -> r typ
- convType :: forall {k} r (typ :: k). TypeSym r typ => CodeType -> VS (r typ)
Documentation
type MixedCall (r :: k -> Type) (var :: k) (val :: k) (typ :: k) = Label -> VS (r typ) -> [VS (r val)] -> NamedArgs r var val -> VS (r val) Source #
type MixedCtorCall (r :: k -> Type) (var :: k) (val :: k) (typ :: k) = VS (r typ) -> [VS (r val)] -> NamedArgs r var val -> VS (r val) Source #
type PosCall (r :: k -> Type) (val :: k) (typ :: k) = Label -> VS (r typ) -> [VS (r val)] -> VS (r val) Source #
type PosCtorCall (r :: k -> Type) (val :: k) (typ :: k) = VS (r typ) -> [VS (r val)] -> VS (r val) Source #
type InOutCall (r :: k -> Type) (stmt :: k) (var :: k) (val :: k) = Label -> [VS (r val)] -> [VS (r var)] -> [VS (r var)] -> MS (r stmt) Source #
type InOutFunc (r :: k -> Type) (mthd :: k) (bod :: k) (var :: k) = [VS (r var)] -> [VS (r var)] -> [VS (r var)] -> MS (r bod) -> MS (r mthd) Source #
type DocInOutFunc (r :: k -> Type) (mthd :: k) (bod :: k) (var :: k) = String -> [(String, VS (r var))] -> [(String, VS (r var))] -> [(String, VS (r var))] -> MS (r bod) -> MS (r mthd) Source #
class UnRepr (repr :: Type -> Type) contents where Source #
Instances
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 TypeElim (r :: k -> Type) (typ :: k) | r -> typ where Source #
Methods
getCodeType :: r typ -> CodeType Source #
Instances
getTypeString :: UnRepr r TypeData => r TypeData -> String Source #
A helper function for extracting the String representation from an `r typ`
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
litZero :: forall {k} r (val :: k) (typ :: k). (Literal r val typ, TypeElim r typ) => VS (r typ) -> VS (r val) Source #
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 IndexTranslator (r :: k -> Type) (val :: k) | r -> val where Source #
Helper class for representing the conversion between integers and array indices. GOOL is 0-indexed, so languages like Julia that are not 0-indexed need to convert between integers and indices.
Methods
intToIndex :: VS (r val) -> VS (r val) Source #
Does any necessary conversions from GOOL's zero-indexed assumptions to the target language's assumptions
indexToInt :: VS (r val) -> VS (r val) Source #
Does any necessary conversions from the target language's indexing assumptions assumptions to GOOL's zero-indexed assumptions
Instances
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 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 InternalList (r :: k -> Type) (block :: k) (var :: k) (val :: k) | r -> block var val where Source #
Methods
listSlice' :: Maybe (VS (r val)) -> Maybe (VS (r val)) -> Maybe (VS (r val)) -> VS (r var) -> VS (r val) -> MS (r block) Source #
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 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 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 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 BinderElim (r :: k -> Type) (binder :: k) (typ :: k) | r -> binder typ where Source #