Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some kind of local scope in pattern bindings #8

Open
lambdageek opened this issue Jan 10, 2015 · 0 comments
Open

Some kind of local scope in pattern bindings #8

lambdageek opened this issue Jan 10, 2015 · 0 comments

Comments

@lambdageek
Copy link
Owner

Consider implementing SML data type definitions:

   datatype 'a option = NONE | SOME of 'a

The whole data definition is a pattern in the rest of the module, but the variable a should scope locally over the value constructors which are themselves in scope in the rest of the module.

If we were working with terms, we'd just use a Bind to introduce a scope so that the a ranged over the value constructors.

But since NONE and SOME are constructor names that scope over the rest of the module, what we actually want is to use a LocalBind as a pattern. (This is in some sense a complement to Shift which is all about lifting terms out of scopes whereas this would be limiting the scope of a pattern)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant