pub enum Expr {
Var(Arc<str>),
Lam(Arc<str>, Box<Self>),
App(Box<Self>, Box<Self>),
Lit(Literal),
Record(Vec<(Arc<str>, Self)>),
List(Vec<Self>),
Field(Box<Self>, Arc<str>),
Index(Box<Self>, Box<Self>),
Match {
scrutinee: Box<Self>,
arms: Vec<(Pattern, Self)>,
},
Let {
name: Arc<str>,
value: Box<Self>,
body: Box<Self>,
},
Builtin(BuiltinOp, Vec<Self>),
}Expand description
An expression in the pure functional language.
All variants are serializable, content-addressable, and evaluate deterministically on any platform (including WASM).
Variants§
Var(Arc<str>)
Variable reference.
Lam(Arc<str>, Box<Self>)
Lambda abstraction: λparam. body.
App(Box<Self>, Box<Self>)
Function application: func(arg).
Lit(Literal)
Literal value.
Record(Vec<(Arc<str>, Self)>)
Record construction: { name: expr, ... }.
List(Vec<Self>)
List construction: [expr, ...].
Field(Box<Self>, Arc<str>)
Field access: expr.field.
Index(Box<Self>, Box<Self>)
Index access: expr[index].
Match
Pattern matching: match scrutinee { pat => body, ... }.
Fields
Let
Let binding: let name = value in body.
Fields
Builtin(BuiltinOp, Vec<Self>)
Built-in operation applied to arguments.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Expr
impl<'de> Deserialize<'de> for Expr
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Expr
impl StructuralPartialEq for Expr
Auto Trait Implementations§
impl Freeze for Expr
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnsafeUnpin for Expr
impl UnwindSafe for Expr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more