Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import scalaz._
- import Scalaz._
- object console extends App {
- trait Apart[F] {
- type T
- type G[X]
- def apply(f: F): G[T]
- }
- object Apart {
- type Aux[FA, A, F[_]] = Apart[FA] { type T = A; type G[X] = F[X] }
- implicit def af[F[_], A]: Apart[F[A]] = new Apart[F[A]] {
- type T = A
- type G[X] = F[X]
- def apply(f: F[A]): G[T] = f
- }
- }
- def foo[This, Mo, F[_]](ft: This)
- (implicit apart: Apart.Aux[This, Mo, F],
- F: Functor[F],
- Mo: Monoid[Mo]) = {
- F.map(apart(ft))(_ => Mo.zero)
- }
- foo(some(3))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement