rra haskell code example
Example: haskell functor
-- Functors are a class of data structure that "contain" a generic type
-- you can "inject" functions inside these functors with `fmap`
-- Applying a function "inside" of a functor will not change the structure
-- of the functor
-- e.g `fmap (\x -> x + 1)` [1..10] will not change the length of the list
-- Functors require an implentation of `fmap`
fmap :: Functor f => (a -> b) -> f a -> f b
-- and have to obey the functor laws:
-- fmap id = id
-- fmap (f . g) = fmap f . fmap g