-
Notifications
You must be signed in to change notification settings - Fork 49
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 Fetch#runAll #194
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of dummy
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.