add get_interface_type()

This commit is contained in:
Michael Sippel 2025-03-25 16:31:04 +01:00
parent cae616b7ae
commit d445e27293
Signed by: senvas
GPG key ID: F96CF119C34B64A6

View file

@ -132,6 +132,24 @@ impl TypeTerm {
atom => atom
}
}
pub fn get_interface_type(&self) -> TypeTerm {
match self {
TypeTerm::Ladder(rungs) => {
if let Some(top) = rungs.first() {
top.get_interface_type()
} else {
TypeTerm::unit()
}
}
TypeTerm::App(args) => {
TypeTerm::App(args.iter().map(|a| a.get_interface_type()).collect())
}
atom => atom.clone()
}
}
}
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>\\