Repository navigation
Make MVar constructors return Task - #537
Conversation
|
What are your thoughts on making it polymorphic in effect type like Instead of: def apply[A](initial: A): Task[MVar[A]] =
Task.eval(new AsyncMVarImpl[A](AsyncVar(initial)))something like: def apply[F[_], A](initial: A)(implicit F: Sync[F]): F[MVar[A]] =
F.suspend(new AsyncMVarImpl[A](AsyncVar(initial)))Then you could use it with other types if you don't want to use |
|
@Avasil that's a cool idea, however the transition wouldn't be smooth. E.g. one pretty cool thing about def take: Task[A] =
Task.unsafeCreate { (context, callback) =>
implicit val s = context.scheduler
// Execution could be synchronous (e.g. result is null or not)
av.unsafeTake(callback) match {
case null => () // do nothing
case a => callback.asyncOnSuccess(a)
}
}This, plus Another reason is consistency. The That said I do want us to work on abstractions, like But those are going to be in a separate sub-project. And maybe we should make it non-monix (in |
|
@oleg-py can't merge it because Travis-ci is currently having issues unrelated to your code - their queue is messed up. |
Codecov Report
@@ Coverage Diff @@
## master #537 +/- ##
==========================================
- Coverage 90.37% 84.19% -6.18%
==========================================
Files 364 364
Lines 9629 10357 +728
Branches 1797 1865 +68
==========================================
+ Hits 8702 8720 +18
- Misses 927 1637 +710 |
Closes #535