gen_gleam/patterns

Types

pub type Pattern {
  NilPattern
  FalsePattern
  TruePattern
  IntPattern(Int)
  ListPattern(List(Pattern))
  TuplePattern(List(Pattern))
  UnusedVarPattern(name: Option(String))
  VarPattern(String, Option(GleamType))
}

Constructors

  • NilPattern
  • FalsePattern
  • TruePattern
  • IntPattern(Int)
  • ListPattern(List(Pattern))
  • TuplePattern(List(Pattern))
  • UnusedVarPattern(name: Option(String))
  • VarPattern(String, Option(GleamType))

Functions

pub fn false() -> Pattern
pub fn generate(pattern: Pattern) -> String
pub fn int(value: Int) -> Pattern
pub fn list(values: List(Pattern)) -> Pattern
pub fn nil() -> Pattern
pub fn true() -> Pattern
pub fn tuple(values: List(Pattern)) -> Pattern
pub fn typed_var(name: String, var_type: GleamType) -> Pattern
pub fn underscore() -> Pattern
pub fn unused_var(name: String) -> Pattern

name: variable name without the underscore, it will be prepended when generating code

pub fn var(name: String) -> Pattern
Search Document