Comments (3)
I'm surprised if this is a recent change in behavior. I think this is in fact by design. The locally nameless representation only supports substituting terms that are well formed in the sense that all bound variables occur in a term together with an enclosing binder.
That is Bn 0 0
on its own is not a valid argument for subst
.
from unbound-generics.
Yeah, the example constructed is somewhat artificial for brevity -- I discovered this behaviour in the implementation of contextual metavariables.
There delayed substitution can appear under a binder and if one substitutes a solution for the meta later it technically becomes subst freeName boundName whateverterm
.
concrete example being:
--term before metavar substitution
orb0 = \b10 b20. ?_29 [ b223 → b20, b116 → b10, orb0 → orb0 ]
--metavar solution
--that exists in the context with variables b223 and b116 available
?_29 = case b116 of
True -> True
False -> b223
Regardless, if this is intended behaviour, I can imagine a guard is appropriate that verifies that bound variables don't occur in the term that we substitute with. Something akin to if (isFreeName n)
.
from unbound-generics.
Regardless, if this is intended behaviour, I can imagine a guard is appropriate that verifies that bound variables don't occur in the term that we substitute with. Something akin to if
(isFreeName n)
.
I think that's hard to do because the typeclass Subst b a
doesn't actually place any constraints on u :: b
- the term that will be substituted for n
- in subst n u x
. All we know is that n :: Name b
is a name that can occur somewhere inside x
- we don't know anything about what kind of thing u
might be. (Maybe there is something clever we can do, but the straightforward approach doesn't typecheck)
from unbound-generics.
Related Issues (20)
- unbound-generics-0.1.2 won't compile with GHC 7.10.x
- Add `Hashable` instances for names and binder combinators
- Add `substBind` operation like `unbound` recently did HOT 9
- Unification function HOT 2
- What does Embed really do? HOT 2
- Substitution should continue traversing even when the variables do not match HOT 1
- Borrow good ideas from moniker HOT 1
- Bump for GHC 8.6.1 HOT 2
- Support for capturing substitution HOT 2
- Remove Show superclass on Alpha HOT 1
- Add `Read` instances for names and binder or how to derive it HOT 1
- Allow name representations other than String HOT 3
- test
- Build failure with mtl-2.3
- Cherrypick `instantiate` from sweirich's branch HOT 1
- unbind2Plus doesn't work with two different pattern types HOT 1
- README example doesn't compile with recent GHC
- Support transformers >= 0.6.0.0 HOT 1
- Help Wanted: Looking for co-maintainer HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unbound-generics.