add get_interface_type()
This commit is contained in:
parent
cae616b7ae
commit
d445e27293
1 changed files with 18 additions and 0 deletions
18
src/term.rs
18
src/term.rs
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>\\
|
||||
|
|
Loading…
Add table
Reference in a new issue