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

Add a parallel *> and <* #2015

Closed
LukaJCB opened this issue Nov 6, 2017 · 6 comments · Fixed by #2038
Closed

Add a parallel *> and <* #2015

LukaJCB opened this issue Nov 6, 2017 · 6 comments · Fixed by #2038

Comments

@LukaJCB
Copy link
Member

LukaJCB commented Nov 6, 2017

Probably two very useful operations, however giving these a good "operator name" might be fairly difficult. For now, I'll suggest something like !> and <!, but bikeshedding very welcome!

@etorreborre
Copy link
Contributor

Why not remove *> on Applicative, just use the >> from Monad and use *> for Parallel?

@tpolecat
Copy link
Member

tpolecat commented Nov 6, 2017

@LukaJCB I think !> and <! are fine … I'm looking at Parallel for the first time and I think it should be constrained to CommutativeApply … need to review how we got here.

@etorreborre changing the constraints and semantics of *> and <* (which are heavily used) would be very disruptive so I don't think we should do that. >> is over-constrained and deprecated, and I think it's too soon to introduce it with new semantics, if this is what you were suggesting (I wasn't sure).

@etorreborre
Copy link
Contributor

@tpolecat I was thinking that many people were using >> for sequencing actions. I haven't seen much code using *> instead. The net changes will be to go from >> and *> to *> and !> and I wonder if assigning just another meaning to *> would be a better move in the long run (and keep similar names between Haskell and Scala).

@etorreborre
Copy link
Contributor

@tpolecat @LukaJCB feel free to ignore my bikeshedding opinion, I will be fine as long as we have an operator for Parallel.

@tpolecat
Copy link
Member

tpolecat commented Nov 6, 2017

>> is deprecated in favor of *> … it's an anachronism from the days before Applicative in Haskell but it's still recognizable so I think we should not have it in cats. I use <* and *> all the time but I don't know how common it is I guess … I assume lots of people are using them since they're so useful.

In any case <* and *> are also well-known from Haskell and scalaz and I think we should not change the sequential semantics. a *> b is not the same as b <* a (see State for instance) although it is for CommutativeApply and would be for Parallel with <! and !>.

@etorreborre
Copy link
Contributor

I'm biased because I have used >> a lot more before I started using *>. And I agree with your last sentence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants