fix(build): --uplc must use Program<Name> to pretty print

This commit is contained in:
rvcas
2023-06-07 16:25:59 -04:00
parent 1747090931
commit 8d107b1293
3 changed files with 33 additions and 5 deletions

View File

@@ -537,6 +537,29 @@ impl TryFrom<Term<Name>> for Term<DeBruijn> {
}
}
impl TryFrom<&Program<DeBruijn>> for Program<Name> {
type Error = debruijn::Error;
fn try_from(value: &Program<DeBruijn>) -> Result<Self, Self::Error> {
Ok(Program::<Name> {
version: value.version,
term: (&value.term).try_into()?,
})
}
}
impl TryFrom<&Term<DeBruijn>> for Term<Name> {
type Error = debruijn::Error;
fn try_from(value: &Term<DeBruijn>) -> Result<Self, debruijn::Error> {
let mut converter = Converter::new();
let term = converter.debruijn_to_name(value)?;
Ok(term)
}
}
impl TryFrom<Program<NamedDeBruijn>> for Program<Name> {
type Error = debruijn::Error;