feat: trying Rc for Name

This commit is contained in:
rvcas 2023-01-30 11:41:48 -05:00 committed by Lucas
parent b5d9a9bb52
commit eda3194cf0
2 changed files with 1183 additions and 4 deletions

View File

@ -176,12 +176,12 @@ impl Program<DeBruijn> {
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum Term<T> { pub enum Term<T> {
// tag: 0 // tag: 0
Var(T), Var(Rc<T>),
// tag: 1 // tag: 1
Delay(Rc<Term<T>>), Delay(Rc<Term<T>>),
// tag: 2 // tag: 2
Lambda { Lambda {
parameter_name: T, parameter_name: Rc<T>,
body: Rc<Term<T>>, body: Rc<Term<T>>,
}, },
// tag: 3 // tag: 3
@ -190,7 +190,7 @@ pub enum Term<T> {
argument: Rc<Term<T>>, argument: Rc<Term<T>>,
}, },
// tag: 4 // tag: 4
Constant(Constant), Constant(Rc<Constant>),
// tag: 5 // tag: 5
Force(Rc<Term<T>>), Force(Rc<Term<T>>),
// tag: 6 // tag: 6
@ -201,7 +201,7 @@ pub enum Term<T> {
impl<T> Term<T> { impl<T> Term<T> {
pub fn is_unit(&self) -> bool { pub fn is_unit(&self) -> bool {
matches!(self, Term::Constant(Constant::Unit)) matches!(self, Term::Constant(c) if c.as_ref() == &Constant::Unit)
} }
pub fn force_wrap(self) -> Self { pub fn force_wrap(self) -> Self {

1179
fib_iter.uplc Normal file

File diff suppressed because it is too large Load Diff