category-theory-presentation/categories/30_How/100_Functors/040_Haskell_Functors_for_the_programmer.md

12 lines
367 B
Markdown
Raw Normal View History

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!"`