-
Notifications
You must be signed in to change notification settings - Fork 11
Consistent Interface parameter placement #23
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
Consistent Interface parameter placement #23
Conversation
I would suggesting putting The reason for that is it plays better with bind and traverse, since you can do things like |
Hah, I see @thomashoneyman said otherwise in #21 (comment), but personally I still think it's right to put |
@garyb I'm happy to defer :) I sometimes put these sorts of values as the first argument because it's easier to scan over them if they're in a consistent position (vs. depending on the number of arguments) and because you can partially-apply if you're going to be using the function several times (I think? It's been a while since I've done this). Given that the web libraries already use your suggested placement I think that's enough reason to stick with that, let alone your other reasons. |
I put it in the first position cause I was thinking about partial application as well, but I'm happy with either as long as it's consistent. |
@razcore-art let's go with @garyb's suggestion! |
I've updated the PR, should be good to go. |
test/Main.purs
Outdated
setLineHandler (\s -> if s == "quit" | ||
then close interface | ||
else do | ||
log $ "You typed: " <> s | ||
prompt interface) interface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can use a bit less indentation with:
setLineHandler (\s -> if s == "quit" | |
then close interface | |
else do | |
log $ "You typed: " <> s | |
prompt interface) interface | |
interface # setLineHandler \s -> | |
if s == "quit" then | |
close interface | |
else do | |
log $ "You typed: " <> s | |
prompt interface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the whitespace so it isn't like either of us! :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like a look from @garyb but otherwise 👍
"Fix" API functions consistency by placing `Interface` parameter at the end of the argument list.
With this PR I'm just trying to align the placement of
Interface
inthe API, it's just cosmetic, but I find that having
Interface
eitherat the beginning (this PR's option) or at the end is desirable.