Skip to content
New issue

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

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

Already on GitHub? # to your account

Don't allow function parameters that overload keywords #3

Open
erewok opened this issue Feb 13, 2017 · 2 comments
Open

Don't allow function parameters that overload keywords #3

erewok opened this issue Feb 13, 2017 · 2 comments

Comments

@erewok
Copy link
Owner

erewok commented Feb 13, 2017

We have a capture in one of our test API endpoints where the variable is named id. This is created as a function parameter and passed into the client function.

Ideally, we wouldn't overload any Python keywords, such as id, because it's gross and poor form.

Possibly check for membership in a list of keywords and rename if so.

@sboosali
Copy link

yeah, I wanted to do this too when I was playing with servant, but I don't know if it's possible with the operations supported on ghc's current type level strings. type level string comparison seems to exist, but I forget the details of why I didn't think this worked on my earlier attempt. so I ended up just checking things on the value level.

https://hackage.haskell.org/package/base-4.10.0.0/docs/GHC-TypeLits.html#v:sameSymbol

@erewok
Copy link
Owner Author

erewok commented Nov 18, 2017

I think this should be possible if we reify the strings and compare. I'll have to dig into a bit more. I'm still trying to figure out how to restructure the resulting code. Probably after the new year, I'll have a chance to start on the rewrite.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants