Home

From Category Theory for Programmers - Series 1

Category Theory 6.1 - Functors

(part 2)
class Eq a where 
    (==) :: a -> a -> Bool
class Functor f where 
    fmap :: (a -> b) -> (f a -> f b)
instance Functor List where 
    fmap f Nil = Nil
    fmap f (cons h t) = Cons (f h) (fmap f t)
type Reader r a = r -> a
fmap :: (a -> b) -> (r -> a) -> (r -> b)
fmap f g = 𝑓 ∘ 𝑔 = (∘) f g