lambdageek / unbound-generics

Specify variable binding in syntax trees using GHC.Generics (reimplementation of Unbound)
https://hackage.haskell.org/package/unbound-generics/
BSD 3-Clause "New" or "Revised" License
56 stars 18 forks source link

Implement `substBind` function #43

Closed lambdageek closed 2 years ago

lambdageek commented 4 years ago

I had to expose a couple of functions that were previously not exported (ctxLevel and the Rec term constructor), which will need a version bump.

Addresses https://github.com/lambdageek/unbound-generics/issues/16


I had to do more work than https://github.com/sweirich/replib/commit/98bdb8a2dab991771702597f16d1e1e7fdbd04fe Specifically, I was surprised that the substPat function for the Rebind, Shift, Embed, and Rec instances did not manipulate the AlphaCtx in the Unbound version of this function. That seems like a bug in Unbound. /cc @sweirich

marklemay commented 4 years ago

I would be happy to contribute some tests. Should they go in test/TestSubstBind.hs?

marklemay commented 4 years ago

added some tests to my fork: https://github.com/marklemay/unbound-generics/commit/4937b9de47d2bf591925550f700581f20d961c90