wiki:FunctionalProgramming/Functor

Functor

A uniform transformation (a -> b) over a parameterized type f, which is also called mapping.

A parameterized type is basically everything, from Lists and Strings to functions itselves.

Haskell

To be a Functor is to implement the fmap function which applies a function.

class Functor f where
      fmap :: (a -> b) -> f a -> f b

"Lifted" application, analogous to ($).

(<$>) :: Functor f => (a -> b) -> f a -> f b
(<$>) = fmap

An infix synonym of fmap

substituting a constant instead of function application (transformation)

(<$) :: a -> f b -> f a
(<$) =  fmap . const
Last modified 23 months ago Last modified on Apr 5, 2018, 5:17:00 AM
Note: See TracWiki for help on using the wiki.