google-research / dex-lang

Research language for array processing in the Haskell/ML family
BSD 3-Clause "New" or "Revised" License
1.58k stars 107 forks source link

Use `ImpName` instead of `AtomName` in ImpIR. #1159

Closed dougalm closed 1 year ago

dougalm commented 1 year ago

We couldn't do this before because we carry an Atom in the Simp->Imp substitution and we didn't want to add an AtomicImpName case to Atom just for this single use. But with the new IR system that's fine! We add the case and signal that it doesn't have to be handled anywhere else by giving it the Sat r (Is SimpToImpIR) constraint.

One awkward part of the change is that now we have a mix of atom names and imp names in the block that we want to hand to Algebra. I resolved this by rebinding the imp names to atom names before calling into Algebra, but it's a bit ugly.