What does <$> mean in Haskell?

While reading a piece of Haskell code I came upon this: <$>. What does it mean in Haskell? After some google searches I remain in the dark.


Google is not the best search engine for Haskell. Try Hoogle or Hayoo, both will point you right away to this:

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

It's merely an infix synonym for fmap, so you can write e.g.

Prelude> (*2) <$> [1..3]
[2,4,6]
Prelude> show <$> Just 11
Just "11"

Like most infix functions, it is not built-in syntax, just a function definition. But functors are such a fundamental tool that <$> is found pretty much everywhere.


Hayoo has been offline for quite a while now.