github-actions[bot] on gh-pages
deploy: 977a734d2649460b2a64256… (compare)
armanbilge on 0.23
fix delayed websocket frame pro… apply sbt quicklint fixes fix Scala 2.12 compilation error and 5 more (compare)
withLog
would be sufficient for this use case.
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.