github-actions[bot] on gh-pages
deploy: 8a97d89e13db1c752ff1b47… (compare)
armanbilge on series
armanbilge on 0.23
Update jawn-parser to 1.4.0 in … Merge pull request #6513 from h… (compare)
http4s-steward[bot] on series
Update jawn-parser to 1.4.0 in … (compare)
github-actions[bot] on gh-pages
deploy: bc2f3d5e075ad289c68ac58… (compare)
rossabaker on 0.23.13
Merge branch '0.22' into 0.23 http4s-0.23.13 (compare)
armanbilge on 1.0.0-M34-1
rossabaker on main
Release v1.0.0-M34 Merge pull request #6512 from h… (compare)
rossabaker on 0.22
http4s-0.22.14 Merge pull request #279 from ht… (compare)
logMe[IO]("hello")
will think that "hello" is Sync[F]
apply
, but it's more horrendous in implementation
def logMe[F[_]]: Magnet[F] = new Magnet[F]
class Magnet[F[_]]
object Magnet {
implicit def conv[F[_]: Sync](m: Magnet[F]): LogMePartiallyApplied[F] =
new LogMePartiallyApplied[F]
class LogMePartiallyApplied[F[_]: Sync] {
def apply(s: String, logAction: String => F[Unit] = { s =>
Sync[F].delay(println(s))
}) =
logAction(s)
}
}
def yolo = logMe[IO]("hello")
// scala> yolo.unsafeRunSync
// hello
234sekjfasdf
or it didn’t happen.
implicitNotFound
does not work (if it fails the implicit search you simply do not trigger the conversion)
def yolo = logMe[IO]("hello")
// scala> yolo.unsafeRunSync
// hello
def well = logMe("hello")
Users/fabio/projects/playground/src/main/scala/Playground.scala:57: Specify `IO` there: `logMe[IO]("hello")`
[error] def well = logMe("hello")
def logMe[F[_]]: Magnet[F] = new Magnet[F]
class Magnet[F[_]]
trait LowPrio {
@annotation.implicitNotFound("""Specify `IO` there: `logMe[IO]("hello")`""")
trait Error
class Catch[F[_]] {
def apply(s: String, logAction: String => F[Unit] = ???)(implicit ev: Error) =
???
}
implicit def conv2[F[_]](m: Magnet[F]): Catch[F] =
new Catch[F]
}
object Magnet extends LowPrio {
implicit def conv[F[_]: Sync](m: Magnet[F]): LogMePartiallyApplied[F] =
new LogMePartiallyApplied[F]
class LogMePartiallyApplied[F[_]: Sync] {
def apply(s: String, logAction: String => F[Unit] = { s =>
Sync[F].delay(println(s))
}) =
logAction(s)
}
}
enjoy