-
Notifications
You must be signed in to change notification settings - Fork 66
Remove invalid instance Monad Concurrently. #26
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
Conversation
Summary of discussion so far, which started in ekmett/either#38: Based on an idea of @glguy, I thought that there is no way to implement a However, now I realize that in fact it is possible to create a concurrent |
Furthermore, when ApplicativeDo is implemented, the |
Forget about
I am a little worried that the laziness can result in some unexpected behavior beyond the concurrency though. |
You cannot have a do
decision <- decide
doSomethingBasedOnADecision decision Executing However, I absolutely disagree with the following statement:
I explain my position in the parallel thread. |
Why does it simply not make sense? |
Personally, I'd favor just removing it, rather than trying to come up with a super-fancy version that buries |
@ekmett It's just I don't feel confident enough of my understanding of this library to be certain that throwing laziness into the mix in this way doesn't create some subtle difference in semantics that we don't want. And is my proposed implementation good enough, or do we need another
The intended interface for |
Fixing the typos in my two proposals for a
|
Even if it were palatable, which it is not, I believe the |
Remove invalid instance Monad Concurrently.
Ah, I see now - the idea is to make a |
@simonmar Agreed. Thanks for reviewing this! |
@simonmar @ygale: I ran into this issue while trying to apply Kleisli to Concurrently. Eg.
Applicative is not powerful enough to allow a |
@tomberek The point of the above discussion is that Losing the But that isn't the only arrow you could have. Notably the static arrow transformer newtype Static f p a b = Static { runStatic :: f (p a b) } takes any so if we start you should be able to do something like lift it into |
The expected I've been able to make the behavior work right with defining a |
The
Monad
instance forConcurrently
is invalid: we have(<*>) /= ap
becauseap
runs the two actions sequentially while(<*>)
runs them concurrently. There is no way to write a validMonad
instance forConcurrently
, so the existing broken instance should just be removed.The existence of an invalid
Monad
instance causes breakage in the wild. See, for example, ekmett/either#38.