feat: start when expressions
This commit is contained in:
@@ -110,6 +110,16 @@ pub enum Term<T> {
|
||||
Builtin(DefaultFunction),
|
||||
}
|
||||
|
||||
impl<T> Term<T> {
|
||||
pub fn is_unit(&self) -> bool {
|
||||
matches!(self, Term::Constant(Constant::Unit))
|
||||
}
|
||||
|
||||
pub fn force_wrap(self) -> Self {
|
||||
Term::Force(self.into())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T> Display for Term<T>
|
||||
where
|
||||
T: Binder<'a>,
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
use std::{fmt::Display, str::FromStr};
|
||||
use std::{fmt::Display, rc::Rc, str::FromStr};
|
||||
|
||||
use strum_macros::EnumIter;
|
||||
|
||||
use flat_rs::de;
|
||||
|
||||
use crate::ast::Term;
|
||||
|
||||
/// All the possible builtin functions in Untyped Plutus Core.
|
||||
#[repr(u8)]
|
||||
#[allow(non_camel_case_types)]
|
||||
@@ -389,3 +391,15 @@ impl DefaultFunction {
|
||||
.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> From<DefaultFunction> for Term<T> {
|
||||
fn from(builtin: DefaultFunction) -> Self {
|
||||
Term::Builtin(builtin)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> From<DefaultFunction> for Rc<Term<T>> {
|
||||
fn from(builtin: DefaultFunction) -> Self {
|
||||
Term::Builtin(builtin).into()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user