-
Notifications
You must be signed in to change notification settings - Fork 197
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
Features/operator redefinition #335
Conversation
//Which frees other libraries to use >>= in the more tranditional way. | ||
|
||
|
||
//Using a dummy type here so that our operator definition doesn't automatically smash |
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.
Could you make this a real xmldoc comment?
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.
Will do
"[...] move both my rebound infix operators, as well as the original Suave defined operators into separate modules where folk could use them (or not) without opening them into the global namespace by default." But the operators aren't in the global namespace today, are they? They are in the Suave.Http module, and you can choose not to open it? About the type member overloading; what would a downstream consumer override look like? You cannot attach more static members to the BindIt type, right? So instead you'd have to implement the inline operator on the type in question; but then you can't do that for framework types, like Choice, right? |
We could do |
As I recall, we used a child |
@haf I am OK moving the operators to its own name space; do not know about the name though. The idea would be to phase them out eventually and promote usage of the symbols defined in this PR. |
Perhaps use |
If the group is willing to move the current operators into Http.Operators I'd be happy to close this, do that work, then open a new pull request. I like the idea of not opening the operators into the namespace by default, it seems like it makes things more pleasant for folk downstream and give them more flexibility. If we did that, would we still want the redefinitions of the operators as I did here in a module, or would moving them out of the main Http namespace be sufficient? |
So currently we have:
as the default. With that change it would be this (for the default happy-path)
I think that is too much; if we perform this change, how about we make it AutoOpen in Suave and for the rest one would have to choose a submodule of the Sauve namespace? I.e.
I was also wondering if you @amcguier would consider answering my questions above? |
We should spend some time thinking about the name spaces; I do not quite like the way they are now. For example I feel that |
Also |
Agree about |
I haven't made my mind yet but I'm thinking of moving them one level up. So we do. open Suave.EventSource Instead of. open Suave.Http.EventSource What do you think ? I would like to have less open statements in general. |
@ademar, well, |
@haf Sorry, I kind of lost them in the ongoing discussion.
Did I get them all? If not, let me know. :-) |
Ref #340 |
Ref #342 |
@haf If the operators are going to get moved into a namespace that makes it easy not to open them into the project namespace, I can just kill this PR and use that change. I'm too stuck on the changes I made anyway. Thoughts? |
@amcguier Yes, alright. Let's go for the namespace refactor PR. You're welcome to chime in on the refactor branch. |
Hi Folk,
This is a first stab at providing a slightly cleaner infix situation, referencing item #311. This cleans the namespace and allows other libraries to use monadic bind >>= in the standard way.
I'm pretty open to suggestion about this one. One alternative approach might be to have all the named prefix functions remain in the primary namespace, and move both my rebound infix operators, as well as the original Suave defined operators into separate modules where folk could use them (or not) without opening them into the global namespace by default.
That approach would require a little refactoring of the core modules to add an open statement for the default operators, but it might be the cleanest way to move forward.
Thoughts?