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

Wrap record accessors in an implicit namespace #909

Open
david-christiansen opened this issue Feb 18, 2014 · 7 comments
Open

Wrap record accessors in an implicit namespace #909

david-christiansen opened this issue Feb 18, 2014 · 7 comments

Comments

@david-christiansen
Copy link
Contributor

When elaborating a record

record A where
  MkA : (arg : Int) -> A

the elaborator should wrap an implicit namespace A around the accessors. This would allow them to be more easily overloaded and disambiguated.

I'll try to do this when I get a minute. The ticket is just to remember.

@david-christiansen
Copy link
Contributor Author

Hmm, should constructors be in an implicit namespace as well? It would seem that this would avoid having to wrap separate list-like datatypes in namespaces, and at the same time give an easy and predictable way to disambiguate them (List.Nil vs Vect.Nil).

This is less good for operator names, though. Perhaps it should only happen to non-infix-named datatypes.

What do you think, @edwinb?

@andy-morris
Copy link
Contributor

Apropos of this: should we have syntax for qualified operators? I guess x M.+ y (or M.+ x y à la SML) is a bit gross looking, but possibly better than nothing?

Either way, I agree that constructor namespaces'd be nice. At least they'd be useful for a lot of cases.

@david-christiansen
Copy link
Contributor Author

The syntax is like Prelude.Classes.(+).

@andy-morris
Copy link
Contributor

Oh, right. Never mind then. (That looks nicer too!)

@david-christiansen
Copy link
Contributor Author

@edwinb: any objections to my wrapping constructors in an implicit namespace, with the same name as the family?

@Melvar
Copy link
Collaborator

Melvar commented Oct 19, 2015

I believe this has been implemented for accessors. If constructors should be done, perhaps the issue title should be changed. Note that it is possible to define constructors with additional namespacing explicitly.

@ahmadsalim
Copy link

I think this would still be nice to have.

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

4 participants