All Downloads are FREE. Search and download functionalities are using the official Maven repository.

teststate.util.Functor.scala Maven / Gradle / Ivy

The newest version!
package teststate.util


trait Functor[F[_]] {
  def map[A, B](fa: F[A])(f: A => B): F[B]
}

object Functor {
  implicit lazy val option: Functor[Option] =
    new Functor[Option] {
      override def map[A, B](fa: Option[A])(f: A => B) = fa map f
    }

  implicit lazy val list: Functor[List] =
    new Functor[List] {
      override def map[A, B](fa: List[A])(f: A => B) = fa map f
    }

  implicit lazy val vector: Functor[Vector] =
    new Functor[Vector] {
      override def map[A, B](fa: Vector[A])(f: A => B) = fa map f
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy