# 20/1/10, 2:12 am -- Learning about functors

Did you know that in Haskell, a list is a functor? Well, this surprised me. As I was reading Conal Elliott's paper on the Reactive library I lost him not long before he started talking about applicative functors. I soon learned that Functor is just a class, not some intimidating more-abstract version of a function like I had previously imagined whenever my eyes skimmed over that word in #haskell.

Here is the definition for the class Functor:

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

You might notice that `fmap`

's type is close to `map`

's type. `map`

applies a function of type `(a -> b)`

to a list of items `[a]`

, yielding the new list `[b]`

. If you don't know about functors yet, you can think of `fmap`

as a generalization of `map`

. A functor is just a structure that you can map a function onto.