-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
fixing flatMap? #20
fixing flatMap? #20
Conversation
yurique
commented
Mar 5, 2019
- some dependency bumps
@yurique Thanks, this looks good! I moved the new I looked at your #21 as well but I'm not convinced that Redefining FlattenStrategy to be FlatMapStrategy is an improvement. It seems that implementing flatten should be more straightforward in general, and the way it's defined now we save one allocation of Also remember that the first type param of I plan to merge this PR later this week, hopefully together with MemoizedCollection for Laminar children handling. Thanks again! |
Cool! I'm looking forward to see it released :) As for the other PR - the bottom line for me is this: as long as it is an internal implementation detail, it doesn't really matter. My motivation was to simplify the trait FlattenStrategy[-Outer[+_] <: Observable[_], -Inner[_], Output[+_] <: Observable[_]] { to quite simple: trait FlattenStrategy[Outer[_], Inner[_], Output[_]] { In the current state it has to be complicated as we declare a "type class" for a 2-level deep type, like Another part of my thinking was that this is the approach (implementing trait FlatMap[F[_]] extends Apply[F] {
def flatMap[A, B](fa: F[A])(f: A => F[B]): F[B]
def flatten[A](ffa: F[F[A]]): F[A] =
flatMap(ffa)(fa => fa) (though it's a little bit different here, as the "inner" has to be the same as "outer") Regarding an additional allocation - in my experience As for the first param of object SomeSignalStrategy extends FlattenStrategy[Signal, Signal, Signal] ? But anyways, this is not critical for me :) (maybe there's someone out there who knows better?) |
It would be possible to instantiate such a strategy, but the |
I've been thinking about this a bit. So, as for On the other hand: should it actually be a |
I agree, it doesn't make much sense for However, in addition to your examples it does make sense to go from So the Note – I can't imagine how one would want to |