gen_gleam/statements

For generating Gleam statements

Types

pub opaque type Argument
pub opaque type Clause
pub type ComparisonOperator {
  Lt
  Lte
  Eq
  Neq
  Gt
  Gte
}

Constructors

  • Lt
  • Lte
  • Eq
  • Neq
  • Gt
  • Gte
pub opaque type Function

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_typed(name: String, arg_type: GleamType) -> Argument
pub fn arg_untyped(name: String) -> Argument
pub fn case_stmt(
  guards: List(GleamStatement),
  clauses: List(Clause),
) -> GleamStatement
pub fn clause(
  patterns: List(Pattern),
  stmt: GleamStatement,
) -> Clause
pub fn compare(
  stmt1: GleamStatement,
  comp_op: ComparisonOperator,
  stmt2: GleamStatement,
) -> GleamStatement
pub fn direct(string: String) -> GleamStatement

@deprecated

pub fn false() -> GleamStatement
pub fn function(
  arguments: List(Argument),
  return_type: Option(GleamType),
  statements: List(GleamStatement),
) -> Function
pub fn generate(stmt: GleamStatement) -> String
pub fn generate_function(f: Function) -> String
pub fn int(value: Int) -> GleamStatement
pub fn let_(
  pattern: Pattern,
  statement: GleamStatement,
) -> GleamStatement
pub fn let_tuple(
  patterns: List(Pattern),
  statement: GleamStatement,
  f: fn(List(GleamStatement)) -> List(GleamStatement),
) -> GleamStatement
pub fn list(values: List(GleamStatement)) -> GleamStatement
pub fn most_of_a_function(f: Function) -> String
pub fn multiply(terms: List(GleamStatement)) -> GleamStatement
pub fn name_of_var(var: GleamStatement) -> String
pub fn named_call(
  named_function: NamedFunction,
  arguments: List(GleamStatement),
) -> GleamStatement
pub fn nil() -> GleamStatement
pub fn true() -> GleamStatement
pub fn tuple(values: List(GleamStatement)) -> GleamStatement
pub fn use_arg(arg: Argument) -> GleamStatement
pub fn variable(name: String) -> GleamStatement
pub fn variant(
  name: String,
  field_values: List(GleamStatement),
) -> GleamStatement
Search Document