Compare commits

..

No commits in common. "72705e824ea12fc64737883dcd238d6e8a5509a0" and "68627f140edf8da50aafbe1f3233ead4e54b2169" have entirely different histories.

3 changed files with 6 additions and 28 deletions

View file

@ -54,7 +54,10 @@ impl<'a, M:SugaredMorphism+Clone> SugaredShortestPathProblem<'a, M> {
let mut creates_loop = false;
let mut new_path = prev_path.clone();
new_path.apply_subst(&morph_inst.get_subst());
for n in new_path.morphisms.iter_mut() {
n.apply_subst(&morph_inst.get_subst());
}
for m in new_path.morphisms.iter() {
if m.get_type().src_type == dst_type {
creates_loop = true;

View file

@ -135,13 +135,6 @@ impl SugaredMorphismType {
(x,y) => SugaredMorphismType { src_type: x.clone(), dst_type: y.clone() }
}
}
pub fn apply_subst(&self, σ: &impl SugaredSubstitution) -> SugaredMorphismType {
SugaredMorphismType {
src_type: self.src_type.clone().apply_subst(σ).clone(),
dst_type: self.dst_type.clone().apply_subst(σ).clone()
}
}
}
pub trait SugaredMorphism : Sized {

View file

@ -247,29 +247,11 @@ impl SugaredTypeTerm {
members.into_iter().map(|t| t.desugar(dict))
).collect()),
SugaredTypeTerm::Enum{ enum_repr, variants } => TypeTerm::App(
std::iter::once(
if let Some(sr) = enum_repr {
TypeTerm::Ladder(vec![
dict.parse("Enum").unwrap(),
sr.desugar(dict)
])
} else {
dict.parse("Enum").unwrap()
}
).chain(
std::iter::once( dict.parse("Enum").unwrap() ).chain(
variants.into_iter().map(|t| t.desugar(dict))
).collect()),
SugaredTypeTerm::Seq{ seq_repr, items } => TypeTerm::App(
std::iter::once(
if let Some(sr) = seq_repr {
TypeTerm::Ladder(vec![
dict.parse("Seq").unwrap(),
sr.desugar(dict)
])
} else {
dict.parse("Seq").unwrap()
}
).chain(
std::iter::once( dict.parse("Seq").unwrap() ).chain(
items.into_iter().map(|t| t.desugar(dict))
).collect()),
}