gleamunison/ast

Types

pub type AbilityDeclaration {
  AbilityDeclaration(
    name: identity.LocalVar,
    operations: List(Operation),
  )
}

Constructors

pub type AbilityRef {
  AbilityRef(decl: identity.DefinitionRef)
}

Constructors

pub type BuiltinType {
  IntType
  FloatType
  TextType
  BoolType
  ListType
  HandlerType
}

Constructors

  • IntType
  • FloatType
  • TextType
  • BoolType
  • ListType
  • HandlerType
pub type Case {
  Case(pattern: Pattern, guard: option.Option(Guard), body: Term)
}

Constructors

pub type Constructor {
  Constructor(name: identity.LocalVar, args: List(TypeRef))
}

Constructors

pub type Definition {
  TermDef(term: Term, typ: Type)
  TypeDef(TypeDeclaration)
  AbilityDecl(AbilityDeclaration)
}

Constructors

pub type Guard {
  GuardTerm(term: Term)
}

Constructors

  • GuardTerm(term: Term)
pub type Operation {
  Operation(
    name: identity.LocalVar,
    inputs: List(TypeRef),
    output: TypeRef,
  )
}

Constructors

pub type Pattern {
  PatVar(identity.LocalVar)
  PatInt(Int)
  PatText(BitArray)
  PatCons(head: identity.LocalVar, tail: identity.LocalVar)
  PatEmptyList
  PatAs(bound: identity.LocalVar, inner: Pattern)
  PatConstructor(
    ctor_ref: identity.DefinitionRef,
    args: List(Pattern),
  )
}

Constructors

pub type ReqElement {
  Concrete(AbilityRef)
  ReqVar(index: Int)
}

Constructors

pub type Requirement {
  Required(abilities: List(ReqElement))
}

Constructors

pub type Term {
  RefTo(identity.DefinitionRef)
  LocalVarRef(identity.LocalVar)
  Int(Int)
  Float(Float)
  Text(BitArray)
  List(List(Term))
  Apply(function: Term, arg: Term)
  Lambda(binder: identity.LocalVar, body: Term)
  Let(binder: identity.LocalVar, value: Term, body: Term)
  Match(scrutinee: Term, cases: List(Case))
  Do(
    ability: identity.DefinitionRef,
    operation: identity.LocalVar,
    args: List(Term),
  )
  Handle(
    computation: Term,
    handler: Term,
    ability: identity.DefinitionRef,
  )
  Construct(ctor_ref: identity.DefinitionRef, args: List(Term))
  Hole
  Use(binder: identity.LocalVar, call: Term, body: Term)
}

Constructors

pub type Type {
  TypeVar(index: Int)
  AbilityVar(index: Int)
  Fn(params: List(Type), result: Type, requires: Requirement)
  App(name: identity.DefinitionRef, args: List(Type))
  Builtin(BuiltinType)
}

Constructors

pub type TypeDeclaration {
  Structural(
    name: identity.LocalVar,
    parameters: List(identity.LocalVar),
    constructors: List(Constructor),
  )
  Unique(
    name: identity.LocalVar,
    guid: String,
    parameters: List(identity.LocalVar),
    constructors: List(Constructor),
  )
}

Constructors

pub type TypeRef {
  TypeRefVar(identity.LocalVar)
  TypeCon(identity.DefinitionRef)
  TypeRefBuiltin(BuiltinType)
}

Constructors

pub type Unit {
  Unit(
    root: identity.DefinitionRef,
    defs: List(#(identity.DefinitionRef, Definition)),
  )
}

Constructors

Search Document