I have a number of questions on these examples but am going to start with 1 as to not make it too confusing
> fmap sum [Just 1, Just 2, Just 3] -- [A]
[1,2,3]
> (fmap . fmap) sum Just [1, 2, 3] -- [B]
Just 6
> fmap sum (Just [1,2,3]) -- [C]
Just 6
Given the type of sum
sum :: (Foldable t, Num a) => t a -> a
> fmap sum [Just 1]
[1]
I think, perhaps incorrectly
-
[]is thet/foldable -
aisMaybe a(or perhapsMaybe Intbut not sure that matters for the question) - So you could say
fmapputssuminside of[]and sumsJust 1to 1.
Why does th Just go away? It would make sense if t a represented Just 1 so that t a -> a but that seems pretty wrong.



