-
Notifications
You must be signed in to change notification settings - Fork 1
Functor
Lanny Ripple edited this page Feb 12, 2016
·
3 revisions
Functor encapsulates the concept of a thing that can be mapped over.
trait Functor[F[_]] {
def map[A, B](fa: F[A])(f: A => B): F[B]
}Scala's syntax makes it more difficult to see here but what map is doing is transforming a function over values into a function over Functor values.
map: (A => B) => (F[A] => F[B])
Most programming collections admit a Functor so another way to name the concept represented is "changing the values of a collection into another type".