gen_gleam/statements
For generating Gleam statements
Types
pub type ComparisonOperator {
Lt
Lte
Eq
Neq
Gt
Gte
}
Constructors
-
Lt
-
Lte
-
Eq
-
Neq
-
Gt
-
Gte
Might become opaque. Do use the functions to generate the constructors/variants.
pub type GleamStatement {
Fail
NilVal
FalseVal
TrueVal
IntVal(value: Int)
ListVal(items: List(GleamStatement))
StringVal(string: String)
TupleVal(items: List(GleamStatement))
VariantVal(name: String, fields: List(GleamStatement))
VarPrimitive(name: String)
Comparison(GleamStatement, ComparisonOperator, GleamStatement)
CaseStatement(
guards: List(GleamStatement),
clauses: List(Clause),
)
FunctionDef(function: Function)
NamedFunctionCall(
function: NamedFunction,
arguments: List(GleamStatement),
)
UseArg(arg: GleamStatement)
Let(pattern: Pattern, statement: GleamStatement)
Seq(statements: List(GleamStatement))
Multiply(terms: List(GleamStatement))
Direct(string: String)
}
Constructors
-
Fail
-
NilVal
-
FalseVal
-
TrueVal
-
IntVal(value: Int)
-
ListVal(items: List(GleamStatement))
-
StringVal(string: String)
-
TupleVal(items: List(GleamStatement))
-
VariantVal(name: String, fields: List(GleamStatement))
-
VarPrimitive(name: String)
-
Comparison(GleamStatement, ComparisonOperator, GleamStatement)
-
CaseStatement( guards: List(GleamStatement), clauses: List(Clause), )
-
FunctionDef(function: Function)
-
NamedFunctionCall( function: NamedFunction, arguments: List(GleamStatement), )
-
UseArg(arg: GleamStatement)
-
Let(pattern: Pattern, statement: GleamStatement)
-
Seq(statements: List(GleamStatement))
-
Multiply(terms: List(GleamStatement))
-
Direct(string: String)
pub type NamedFunction {
NamedFunction(name: String, function: Function)
}
Constructors
-
NamedFunction(name: String, function: Function)
Functions
pub fn arg_untyped(name: String) -> Argument
pub fn case_stmt(
guards: List(GleamStatement),
clauses: List(Clause),
) -> GleamStatement
pub fn compare(
stmt1: GleamStatement,
comp_op: ComparisonOperator,
stmt2: GleamStatement,
) -> GleamStatement
pub fn function(
arguments: List(Argument),
return_type: Option(GleamType),
statements: List(GleamStatement),
) -> Function
pub fn generate_function(f: Function) -> String
pub fn let_tuple(
patterns: List(Pattern),
statement: GleamStatement,
f: fn(List(GleamStatement)) -> List(GleamStatement),
) -> GleamStatement
pub fn most_of_a_function(f: Function) -> String
pub fn name_of_var(var: GleamStatement) -> String
pub fn named_call(
named_function: NamedFunction,
arguments: List(GleamStatement),
) -> GleamStatement