Consistent Interface parameter placement#23
Consistent Interface parameter placement#23thomashoneyman merged 1 commit intopurescript-node:masterfrom razcore-rad:api-consistency
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.
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.
I updated the whitespace so it isn't like either of us! :P
thomashoneyman
left a comment
There was a problem hiding this comment.
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
Interfaceinthe API, it's just cosmetic, but I find that having
Interfaceeitherat the beginning (this PR's option) or at the end is desirable.