| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Drasil.GOOL.InterfaceGOOL
Synopsis
- type Program = ProgData
- type GSProgram (a :: k -> Type) (prg :: k) = GS (a prg)
- type Class = Doc
- type StateVar = Doc
- type CSStateVar (r :: k -> Type) (stvr :: k) = CS (r stvr)
- type Initializers (r :: Type -> Type) = [(SVariable r, SValue r)]
- class (UnRepr r TypeData, Argument r, BodySym r bod block, BlockSym r block stmt, CommandLineArgs r, Literal r, MathConstant r, VariableValue r, VariableSym r, TypeSym r, OOTypeSym r, OOVariableSym r, SelfSym r, BooleanExpression r, Comparison r, NumericExpression r, ValueSym r, InternalValueExp r, ValueExpression r, OOValueExpression r, IndexTranslator r, Array r, List r, ListStatement r stmt, Reference r, Set r, FunctionSym r, OOFunctionSym r, ParameterSym r, ScopeSym r, BinderSym r, InternalList r block, MethodSym r vis mthd bod, OOMethodSym r vis mthd attch bod, AttachmentSym r attch, VisibilitySym r vis, StateVarSym r vis stvr attch, ClassSym r mthd stvr, TypeElim r, VariableElim r, EmptyStatement r stmt, MultiStatement r stmt, ValueStatement r stmt, CommentStatement r stmt, DeclStatement r stmt bod, OODeclStatement r stmt, AssignStatement r stmt, FuncAppStatement r stmt, OOFuncAppStatement r stmt, ControlStatement r stmt bod, StringStatement r stmt, PrintConsole r stmt, ReadConsole r stmt, FileHandling r stmt, PrintFile r stmt, ReadFile r stmt, ModuleSym r mod mthd, FileSym r file mod, ProgramSym r prg file) => OOProg (r :: Type -> Type) vis stmt mthd stvr attch 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 ModuleSym (r :: Type -> Type) mod mthd | r -> mod mthd where
- class ClassSym (r :: Type -> Type) mthd stvr | r -> mthd stvr where
- buildClass :: Maybe Label -> [CSStateVar r stvr] -> [MS (r mthd)] -> [MS (r mthd)] -> CS (r Class)
- extraClass :: Label -> Maybe Label -> [CSStateVar r stvr] -> [MS (r mthd)] -> [MS (r mthd)] -> CS (r Class)
- implementingClass :: Label -> [Label] -> [CSStateVar r stvr] -> [MS (r mthd)] -> [MS (r mthd)] -> CS (r Class)
- docClass :: String -> CS (r Class) -> CS (r Class)
- class OOTypeSym (r :: Type -> Type) where
- class OOVariableSym (r :: Type -> Type) where
- ($->) :: OOVariableSym r => SValue r -> SVariable r -> SVariable r
- class SelfSym (r :: Type -> Type) where
- instanceVarSelf :: (OOVariableSym r, SelfSym r, VariableValue r) => SVariable r -> SVariable r
- class OOValueExpression (r :: Type -> Type) where
- newObjMixedArgs :: MixedCtorCall r
- extNewObjMixedArgs :: Library -> MixedCtorCall r
- libNewObjMixedArgs :: Library -> MixedCtorCall r
- selfMethodCall :: (InternalValueExp r, VariableValue r, SelfSym r) => PosCall r
- newObj :: OOValueExpression r => PosCtorCall r
- extNewObj :: OOValueExpression r => Library -> PosCtorCall r
- libNewObj :: OOValueExpression r => Library -> PosCtorCall r
- class OODeclStatement (r :: Type -> Type) stmt | r -> stmt where
- objDecNewNoParams :: OODeclStatement r stmt => SVariable r -> r ScopeData -> MS (r stmt)
- extObjDecNewNoParams :: OODeclStatement r stmt => Library -> SVariable r -> r ScopeData -> MS (r stmt)
- class OOFuncAppStatement (r :: Type -> Type) stmt | r -> stmt where
- selfInOutCall :: InOutCall r stmt
- class GetSet (r :: Type -> Type) where
- class InternalValueExp (r :: Type -> Type) where
- objMethodCall :: InternalValueExp r => VS (r TypeData) -> SValue r -> Label -> [SValue r] -> SValue r
- objMethodCallNamedArgs :: InternalValueExp r => VS (r TypeData) -> SValue r -> Label -> NamedArgs r -> SValue r
- objMethodCallMixedArgs :: InternalValueExp r => VS (r TypeData) -> SValue r -> Label -> [SValue r] -> NamedArgs r -> SValue r
- objMethodCallNoParams :: InternalValueExp r => VS (r TypeData) -> SValue r -> Label -> SValue r
- classMethodCall :: InternalValueExp r => VS (r TypeData) -> VS (r TypeData) -> Label -> [SValue r] -> SValue r
- classMethodCallNamedArgs :: InternalValueExp r => VS (r TypeData) -> VS (r TypeData) -> Label -> NamedArgs r -> SValue r
- classMethodCallMixedArgs :: InternalValueExp r => VS (r TypeData) -> VS (r TypeData) -> Label -> [SValue r] -> NamedArgs r -> SValue r
- classMethodCallNoParams :: InternalValueExp r => VS (r TypeData) -> VS (r TypeData) -> Label -> SValue r
- class OOMethodSym (r :: Type -> Type) vis mthd attch bod | r -> vis mthd attch bod where
- method :: Label -> r vis -> r attch -> VS (r TypeData) -> [MS (r ParamData)] -> MS (r bod) -> MS (r mthd)
- getMethod :: SVariable r -> MS (r mthd)
- setMethod :: SVariable r -> MS (r mthd)
- constructor :: [MS (r ParamData)] -> Initializers r -> MS (r bod) -> MS (r mthd)
- inOutMethod :: Label -> r vis -> r attch -> InOutFunc r mthd bod
- docInOutMethod :: Label -> r vis -> r attch -> DocInOutFunc r mthd bod
- privMethod :: (OOMethodSym r vis mthd attch bod, AttachmentSym r attch, VisibilitySym r vis) => Label -> VS (r TypeData) -> [MS (r ParamData)] -> MS (r bod) -> MS (r mthd)
- pubMethod :: (OOMethodSym r vis mthd attch bod, AttachmentSym r attch, VisibilitySym r vis) => Label -> VS (r TypeData) -> [MS (r ParamData)] -> MS (r bod) -> MS (r mthd)
- initializer :: (OOMethodSym r vis mthd attch bod, BodySym r bod block) => [MS (r ParamData)] -> Initializers r -> MS (r mthd)
- nonInitConstructor :: OOMethodSym r vis mthd attch bod => [MS (r ParamData)] -> MS (r bod) -> MS (r mthd)
- class StateVarSym (r :: Type -> Type) vis stvr attch | r -> vis stvr attch where
- stateVar :: r vis -> r attch -> SVariable r -> CSStateVar r stvr
- stateVarDef :: r vis -> r attch -> SVariable r -> SValue r -> CSStateVar r stvr
- constVar :: r vis -> SVariable r -> SValue r -> CSStateVar r stvr
- privDVar :: (AttachmentSym r attch, VisibilitySym r vis, StateVarSym r vis stvr attch) => SVariable r -> CSStateVar r stvr
- pubDVar :: (AttachmentSym r attch, VisibilitySym r vis, StateVarSym r vis stvr attch) => SVariable r -> CSStateVar r stvr
- pubSVar :: (AttachmentSym r attch, VisibilitySym r vis, StateVarSym r vis stvr attch) => SVariable r -> CSStateVar r stvr
- class AttachmentSym (r :: k -> Type) (attch :: k) | r -> attch where
- classLevel :: r attch
- instanceLevel :: r attch
- class OOFunctionSym (r :: Type -> Type) where
- ($.) :: OOFunctionSym r => SValue r -> VS (r FuncData) -> SValue r
- selfAccess :: (VariableValue r, SelfSym r, OOFunctionSym r) => VS (r FuncData) -> SValue r
- class ObserverPattern (r :: Type -> Type) stmt | r -> stmt where
- observerListName :: Label
- initObserverList :: (VariableSym r, DeclStatement r stmt bod) => VS (r TypeData) -> [SValue r] -> r ScopeData -> MS (r stmt)
- addObserver :: (VariableSym r, VariableValue r, ValueSym r, List r, ListStatement r stmt) => SValue r -> MS (r stmt)
- class StrategyPattern (r :: Type -> Type) bod block | r -> bod block where
- convTypeOO :: (TypeSym r, OOTypeSym r) => CodeType -> VS (r TypeData)
Documentation
type CSStateVar (r :: k -> Type) (stvr :: k) = CS (r stvr) Source #
class (UnRepr r TypeData, Argument r, BodySym r bod block, BlockSym r block stmt, CommandLineArgs r, Literal r, MathConstant r, VariableValue r, VariableSym r, TypeSym r, OOTypeSym r, OOVariableSym r, SelfSym r, BooleanExpression r, Comparison r, NumericExpression r, ValueSym r, InternalValueExp r, ValueExpression r, OOValueExpression r, IndexTranslator r, Array r, List r, ListStatement r stmt, Reference r, Set r, FunctionSym r, OOFunctionSym r, ParameterSym r, ScopeSym r, BinderSym r, InternalList r block, MethodSym r vis mthd bod, OOMethodSym r vis mthd attch bod, AttachmentSym r attch, VisibilitySym r vis, StateVarSym r vis stvr attch, ClassSym r mthd stvr, TypeElim r, VariableElim r, EmptyStatement r stmt, MultiStatement r stmt, ValueStatement r stmt, CommentStatement r stmt, DeclStatement r stmt bod, OODeclStatement r stmt, AssignStatement r stmt, FuncAppStatement r stmt, OOFuncAppStatement r stmt, ControlStatement r stmt bod, StringStatement r stmt, PrintConsole r stmt, ReadConsole r stmt, FileHandling r stmt, PrintFile r stmt, ReadFile r stmt, ModuleSym r mod mthd, FileSym r file mod, ProgramSym r prg file) => OOProg (r :: Type -> Type) vis stmt mthd stvr attch prg file mod bod block Source #
Wrapper typeclass that bundles everything essential for generating an object-oriented program.
Instances
| OOProg CodeInfoOO () () () () () GOOLState () () () () Source # | |
Defined in Drasil.GOOL.CodeInfoOO | |
| OOProg CSharpCode Doc (Doc, Terminator) MethodData StateVar Doc ProgData FileData ModData Body Block Source # | |
Defined in Drasil.GOOL.LanguageRenderer.CSharpRenderer | |
| OOProg JavaCode Doc (Doc, Terminator) MethodData StateVar Doc ProgData FileData ModData Body Block Source # | |
Defined in Drasil.GOOL.LanguageRenderer.JavaRenderer | |
| OOProg PythonCode Doc (Doc, Terminator) MethodData StateVar AttachmentData ProgData FileData ModData Body Block Source # | |
Defined in Drasil.GOOL.LanguageRenderer.PythonRenderer | |
| OOProg SwiftCode Doc (Doc, Terminator) MethodData StateVar Doc ProgData FileData ModData Body Block Source # | |
Defined in Drasil.GOOL.LanguageRenderer.SwiftRenderer | |
| OOProg r vis stmt mthd stvr attch prg file mod bod block => OOProg (LoggingFor r) vis stmt mthd stvr attch 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
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
class ModuleSym (r :: Type -> Type) mod mthd | r -> mod mthd where Source #
Class for representing a module.
Methods
buildModule :: Label -> [Label] -> [MS (r mthd)] -> [CS (r Class)] -> FS (r mod) Source #
Given module name, list of import names, list of module functions, and list of module classes, generates a representation of a module.
Instances
class ClassSym (r :: Type -> Type) mthd stvr | r -> mthd stvr where Source #
Class for representing an OO class.
Methods
buildClass :: Maybe Label -> [CSStateVar r stvr] -> [MS (r mthd)] -> [MS (r mthd)] -> CS (r Class) Source #
Main external method for creating a class. Inputs: parent class, variables, constructor(s), methods
extraClass :: Label -> Maybe Label -> [CSStateVar r stvr] -> [MS (r mthd)] -> [MS (r mthd)] -> CS (r Class) Source #
Creates an extra class, i.e. with a different name than the module name. Inputs: class name, the rest are the same as buildClass.
implementingClass :: Label -> [Label] -> [CSStateVar r stvr] -> [MS (r mthd)] -> [MS (r mthd)] -> CS (r Class) Source #
Creates a class implementing a list of interfaces. Inputs: class name, interface names, variables, constructor(s), methods
Instances
class OOTypeSym (r :: Type -> Type) where Source #
Instances
| OOTypeSym CodeInfoOO Source # | |
Defined in Drasil.GOOL.CodeInfoOO | |
| OOTypeSym CSharpCode Source # | |
Defined in Drasil.GOOL.LanguageRenderer.CSharpRenderer | |
| OOTypeSym CppHdrCode Source # | |
Defined in Drasil.GOOL.LanguageRenderer.CppRenderer | |
| OOTypeSym CppSrcCode Source # | |
Defined in Drasil.GOOL.LanguageRenderer.CppRenderer | |
| OOTypeSym JavaCode Source # | |
| OOTypeSym PythonCode Source # | |
Defined in Drasil.GOOL.LanguageRenderer.PythonRenderer | |
| OOTypeSym SwiftCode Source # | |
| OOTypeSym r => OOTypeSym (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor | |
| Pair p => OOTypeSym (p CppSrcCode CppHdrCode) Source # | |
Defined in Drasil.GOOL.LanguageRenderer.CppRenderer Methods obj :: ClassName -> VS (p CppSrcCode CppHdrCode TypeData) Source # | |
class OOVariableSym (r :: Type -> Type) where Source #
Methods
classVar :: Label -> VS (r TypeData) -> SVariable r Source #
A class-level variable, separate from its class (i.e. v, not v)
classConst :: Label -> VS (r TypeData) -> SVariable r Source #
A class-level constant, separate from its class (i.e. v, not v)
classVarAccess :: VS (r TypeData) -> SVariable r -> SVariable r Source #
Given a class C and a class-level variable v, creates v
extClassVarAccess :: VS (r TypeData) -> SVariable r -> SVariable r Source #
Given a class C from an external module and a class-level variable v,
performs any necessary imports and creates v
instanceVarAccess :: SValue r -> SVariable r -> SVariable r Source #
Given an instance i and an instance-level variable v, creates `i.v`
Instances
class SelfSym (r :: Type -> Type) where Source #
Instances
| SelfSym CodeInfoOO Source # | |
Defined in Drasil.GOOL.CodeInfoOO Methods | |
| SelfSym CSharpCode Source # | |
Defined in Drasil.GOOL.LanguageRenderer.CSharpRenderer Methods | |
| SelfSym CppHdrCode Source # | |
Defined in Drasil.GOOL.LanguageRenderer.CppRenderer Methods | |
| SelfSym CppSrcCode Source # | |
Defined in Drasil.GOOL.LanguageRenderer.CppRenderer Methods | |
| SelfSym JavaCode Source # | |
| SelfSym PythonCode Source # | |
Defined in Drasil.GOOL.LanguageRenderer.PythonRenderer Methods | |
| SelfSym SwiftCode Source # | |
| SelfSym r => SelfSym (LoggingFor r) Source # | |
Defined in Drasil.Shared.LanguageRenderer.LoggingFor Methods self :: SVariable (LoggingFor r) Source # | |
| Pair p => SelfSym (p CppSrcCode CppHdrCode) Source # | |
Defined in Drasil.GOOL.LanguageRenderer.CppRenderer Methods self :: SVariable (p CppSrcCode CppHdrCode) Source # | |
instanceVarSelf :: (OOVariableSym r, SelfSym r, VariableValue r) => SVariable r -> SVariable r Source #
Given a variable v, creates `self.v`
class OOValueExpression (r :: Type -> Type) where Source #
Methods
newObjMixedArgs :: MixedCtorCall r Source #
extNewObjMixedArgs :: Library -> MixedCtorCall r Source #
libNewObjMixedArgs :: Library -> MixedCtorCall r Source #
Instances
selfMethodCall :: (InternalValueExp r, VariableValue r, SelfSym r) => PosCall r Source #
newObj :: OOValueExpression r => PosCtorCall r Source #
extNewObj :: OOValueExpression r => Library -> PosCtorCall r Source #
libNewObj :: OOValueExpression r => Library -> PosCtorCall r Source #
class OODeclStatement (r :: Type -> Type) stmt | r -> stmt where Source #
Methods
objDecDef :: SVariable r -> r ScopeData -> SValue r -> MS (r stmt) Source #
objDecNew :: SVariable r -> r ScopeData -> [SValue r] -> MS (r stmt) Source #
extObjDecNew :: Library -> SVariable r -> r ScopeData -> [SValue r] -> MS (r stmt) Source #
Instances
objDecNewNoParams :: OODeclStatement r stmt => SVariable r -> r ScopeData -> MS (r stmt) Source #
extObjDecNewNoParams :: OODeclStatement r stmt => Library -> SVariable r -> r ScopeData -> MS (r stmt) Source #
class OOFuncAppStatement (r :: Type -> Type) stmt | r -> stmt where Source #
Methods
selfInOutCall :: InOutCall r stmt Source #
Instances
class GetSet (r :: Type -> Type) where Source #
Methods
get :: SValue r -> SVariable r -> SValue r Source #
set :: SValue r -> SVariable r -> SValue r -> SValue r Source #
Instances
class InternalValueExp (r :: Type -> Type) where Source #
A class for representing method calls, both instance- and class-level
Methods
objMethodCallMixedArgs' :: Label -> VS (r TypeData) -> SValue r -> [SValue r] -> NamedArgs r -> SValue r Source #
Generic function for calling a method. Takes the function name, the return type, the object, a list of positional arguments, and a list of named arguments.
classMethodCallMixedArgs' :: Label -> VS (r TypeData) -> VS (r TypeData) -> [SValue r] -> NamedArgs r -> SValue r Source #
Generic function for calling a class method. Takes the function name, the return type, the class type, a list of positional arguments, and a list of named arguments.
Instances
objMethodCall :: InternalValueExp r => VS (r TypeData) -> SValue r -> Label -> [SValue r] -> SValue r Source #
Calling a method. t is the return type of the method, o is the object, f is the method name, and ps is a list of positional arguments.
objMethodCallNamedArgs :: InternalValueExp r => VS (r TypeData) -> SValue r -> Label -> NamedArgs r -> SValue r Source #
Calling a method with named arguments.
objMethodCallMixedArgs :: InternalValueExp r => VS (r TypeData) -> SValue r -> Label -> [SValue r] -> NamedArgs r -> SValue r Source #
Calling a method with a mix of positional and named arguments.
objMethodCallNoParams :: InternalValueExp r => VS (r TypeData) -> SValue r -> Label -> SValue r Source #
Calling a method with no parameters.
classMethodCall :: InternalValueExp r => VS (r TypeData) -> VS (r TypeData) -> Label -> [SValue r] -> SValue r Source #
Calling a class method. t is the return type of the method, c is the class, f is the method name, and ps is a list of positional arguments.
classMethodCallNamedArgs :: InternalValueExp r => VS (r TypeData) -> VS (r TypeData) -> Label -> NamedArgs r -> SValue r Source #
Calling a class method with named arguments.
classMethodCallMixedArgs :: InternalValueExp r => VS (r TypeData) -> VS (r TypeData) -> Label -> [SValue r] -> NamedArgs r -> SValue r Source #
Calling a class method with a mix of positional and named arguments.
classMethodCallNoParams :: InternalValueExp r => VS (r TypeData) -> VS (r TypeData) -> Label -> SValue r Source #
Calling a class method with no parameters.
class OOMethodSym (r :: Type -> Type) vis mthd attch bod | r -> vis mthd attch bod where Source #
Methods
method :: Label -> r vis -> r attch -> VS (r TypeData) -> [MS (r ParamData)] -> MS (r bod) -> MS (r mthd) Source #
getMethod :: SVariable r -> MS (r mthd) Source #
setMethod :: SVariable r -> MS (r mthd) Source #
constructor :: [MS (r ParamData)] -> Initializers r -> MS (r bod) -> MS (r mthd) Source #
inOutMethod :: Label -> r vis -> r attch -> InOutFunc r mthd bod Source #
docInOutMethod :: Label -> r vis -> r attch -> DocInOutFunc r mthd bod Source #
Instances
privMethod :: (OOMethodSym r vis mthd attch bod, AttachmentSym r attch, VisibilitySym r vis) => Label -> VS (r TypeData) -> [MS (r ParamData)] -> MS (r bod) -> MS (r mthd) Source #
pubMethod :: (OOMethodSym r vis mthd attch bod, AttachmentSym r attch, VisibilitySym r vis) => Label -> VS (r TypeData) -> [MS (r ParamData)] -> MS (r bod) -> MS (r mthd) Source #
initializer :: (OOMethodSym r vis mthd attch bod, BodySym r bod block) => [MS (r ParamData)] -> Initializers r -> MS (r mthd) Source #
nonInitConstructor :: OOMethodSym r vis mthd attch bod => [MS (r ParamData)] -> MS (r bod) -> MS (r mthd) Source #
class StateVarSym (r :: Type -> Type) vis stvr attch | r -> vis stvr attch where Source #
Class for representing class variables, both instance- and class-level.
Used when creating a class, to hold extra information about Attachment
and Visibility.
Usually Doc is used for the representation.
Methods
stateVar :: r vis -> r attch -> SVariable r -> CSStateVar r stvr Source #
Given a visibility, attachment, and variable, represent the declaration of a state variable with no initial value.
stateVarDef :: r vis -> r attch -> SVariable r -> SValue r -> CSStateVar r stvr Source #
Given a visibility, attachment, variable, and initial value, represent the declaration of a state variable with the given initial value.
constVar :: r vis -> SVariable r -> SValue r -> CSStateVar r stvr Source #
Given a visibility, variable, and value, represent the declaration of a state constant with the given value.
Instances
privDVar :: (AttachmentSym r attch, VisibilitySym r vis, StateVarSym r vis stvr attch) => SVariable r -> CSStateVar r stvr Source #
pubDVar :: (AttachmentSym r attch, VisibilitySym r vis, StateVarSym r vis stvr attch) => SVariable r -> CSStateVar r stvr Source #
pubSVar :: (AttachmentSym r attch, VisibilitySym r vis, StateVarSym r vis stvr attch) => SVariable r -> CSStateVar r stvr Source #
class AttachmentSym (r :: k -> Type) (attch :: k) | r -> attch where Source #
Used to differentiate whether a member is attached to the class or the instance
Instances
class OOFunctionSym (r :: Type -> Type) where Source #
Methods
func :: Label -> VS (r TypeData) -> [SValue r] -> VS (r FuncData) Source #
objAccess :: SValue r -> VS (r FuncData) -> SValue r Source #
Instances
selfAccess :: (VariableValue r, SelfSym r, OOFunctionSym r) => VS (r FuncData) -> SValue r Source #
class ObserverPattern (r :: Type -> Type) stmt | r -> stmt where Source #
Instances
initObserverList :: (VariableSym r, DeclStatement r stmt bod) => VS (r TypeData) -> [SValue r] -> r ScopeData -> MS (r stmt) Source #
addObserver :: (VariableSym r, VariableValue r, ValueSym r, List r, ListStatement r stmt) => SValue r -> MS (r stmt) Source #
class StrategyPattern (r :: Type -> Type) bod block | r -> bod block where Source #
Methods
runStrategy :: Label -> [(Label, MS (r bod))] -> Maybe (SValue r) -> Maybe (SVariable r) -> MS (r block) Source #