Lectures‎ > ‎

Week15

Functors
  • A Functor is a typeclass, like Eq, Ord, and Show
  • A Functor defines how a type can be mapped over (e.g. lists)
  • The list data type is part of the functor typeclass
Functor typeclass implementation:

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

In this case f is a type constructor, not a concrete type (e.g., Maybe)


Comments