A functor lets you apply a function to a value inside a context without manually extracting the value. The result stays in that kind of context. This matters when a value might be absent, as with Maybe, or when there are many values, as in a list. section 3.2.1 section 3.0
In Haskell, fmap performs the mapping. Given an ordinary function such as (+1), it transforms the contents of Just 42 into Just 43. Mapping over Nothing returns Nothing: there is no integer to increment, and the empty context stays empty. section 3.2.1
fmapEx :: Maybe Int -- A function returning a Maybe Int fmapEx = fmap (+ 1) (Just 42) -- Result: Just 43
The listing shows fmap applying (+1) to Just 42 and returning Just 43. section 3.2.1
One function, several values
The same fmap (+1) applied to [1, 2, 3] returns [2, 3, 4]. The function acts on each element while the result remains a list. section 3.2.1
A functor handles a function outside the context and a value inside it. If the function is wrapped too, an applicative addresses that case; if later steps depend on earlier results, a monad handles the sequencing. Functors are the first step, not a substitute for those stronger patterns. section 3.2 section 3.4








