rossabaker on v1.0.0-M11
rossabaker on v1.0.0-M12
rossabaker on v1.0.0-M11
rossabaker on main
scalafmt (compare)
rossabaker on v1.0.0-M12
rossabaker on main
Fix OkHttpBuilder scaladoc (compare)
rossabaker on v1.0.0-M11
rossabaker on main
Mention the backends before the… (compare)
rossabaker on main
Remove inline Vault and Unique,… Well, actually, vault is no lon… Merge pull request #4267 from r… (compare)
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
HttpRoutes.of
return org.http4s.package$#HttpRoutes
which is type HttpRoutes[F[_]] = Http[OptionT[F, ?], F]
with Http
being type Http[F[_], G[_]] = Kleisli[F, Request[G], Response[G]]
Request[G]
and Response[G]
with the same effect - but my request is supposed to work with IO and the response should be a stream.
Try(SSLContext.getDefault()).toOption
. The question is whether to log a warning that the default failed.