Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait Functor[F[_]] {
- def fmap[A, B](a: F[A], f: A => B) : F[B]
- }
- object FunctorImplicits {
- def fmap[F[_], A, B](a: F[A], f: A => B)(implicit functor: Functor[F]): F[B] =
- functor.fmap(functor, f)
- implicit object OptionFunctor extends Functor[Option] {
- def fmap[A, B](a:Option[A], f: A => B): Option[B]
- = a map f
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement