Add Fetch#runAll - #194
Conversation
| */ | ||
| def runAll[F[_]]: FetchRunnerAll[F] = new FetchRunnerAll[F] | ||
|
|
||
| private[fetch] class FetchRunnerAll[F[_]](private val dummy: Boolean = true) extends AnyVal { |
There was a problem hiding this comment.
What's the purpose of dummy?
There was a problem hiding this comment.
It's just a dummy attribute to be able to define a class with the apply method diferent arities.
There was a problem hiding this comment.
What would be the problem of using just two functions?
def runAll[F[_]: Concurrent: Timer, A](fa: Fetch[F, A])
: F[(Log, DataCache[F], A)] =
runAll(fa, InMemoryCache.empty[F])
def runAll[F[_]: Concurrent: Timer, A](fa: Fetch[F, A], cache: DataCache[F])
: F[(Log, DataCache[F], A)] = /**/ There was a problem hiding this comment.
We use this technique to be able to partially apply the type parameters in Fetch.run* methods, so you can do Fetch.run[IO](f) and omit the second type parameter. It doesn't work with an overloaded method.
There was a problem hiding this comment.
What about using a syntax extension on the Fetch[F, A] element?
implicit class FetchRunOps[F[_], A](val fa: Fetch[F, A]){
def runAll()(implicit /****/) : F[(Log, DataCache[F], A)] = /***/
def runAll(cache: DataCache[F])(implicit /***/) : F[(Log, DataCache[F], A)] = /***/
}There was a problem hiding this comment.
Still haven't added syntax for run* methods, it's actually a bit tricky. Opened #195 to address it.
Add Fetch#runAll
No description provided.