category-theory-presentation/categories/30_How/100_Functors/040_Haskell_Functors_for_the_programmer.md
2013-02-28 16:49:12 +01:00

367 B

Haskell Functors for the programmer

Functor is a type class used for types that can be mapped over.

  • Containers: [], Trees, Map, HashMap...
  • "Feature Type":
    • Maybe a: help to handle absence of a.
      Ex: safeDiv x 0 ⇒ Nothing
    • Either String a: help to handle errors
      Ex: reportDiv x 0 ⇒ Left "Division by 0!"