github-actions[bot] on gh-pages
deploy: e25f7ddbc8059e9fb3df8d8… (compare)
danicheg on series
danicheg on 0.23
Update sbt-native-packager to 1… Merge pull request #6616 from h… (compare)
github-actions[bot] on gh-pages
deploy: c9726a9244ceb1afdb51d39… (compare)
danicheg on flake-lock-12
danicheg on 0.23
flake.lock: Update Flake lock … Merge pull request #6615 from h… (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.