ZM
@typeclass trait Embed[U[_[_]]] {
def embed[F[_]: FlatMap](ft: F[U[F]]): U[F]
}зная про F только наличие FlatMap, мы можем от него избавиться снаружи
Size: a a a
ZM
@typeclass trait Embed[U[_[_]]] {
def embed[F[_]: FlatMap](ft: F[U[F]]): U[F]
}λ
@typeclass trait Embed[U[_[_]]] {
def embed[F[_]: FlatMap](ft: F[U[F]]): U[F]
}ZM
ZM
λ
@typeclass trait Embed[U[_[_]]] {
def embed[F[_]: FlatMap](ft: F[U[F]]): U[F]
}trait Logging[F[_]] {
def info(msg: String): F[Unit]
}F HasContext Ctx
val logging: F[Logging[F]] = ask { ctx =>
new Logging[F] {
def info (msg: String): F[Unit] = F.delay(println(s"$msg [$ctx]"))
}
}val embLogging: Logging[F] = logging.embed
λ
λ
λ
λ
λ
ZM
λ
AT
@typeclass trait Embed[U[_[_]]] {
def embed[F[_]: FlatMap](ft: F[U[F]]): U[F]
}ZM
λ
λ
λ
ZM
λ
ZM