Questions on https://github.com/bolt12/advent-of-haskell-dd
In the the section "Calculating an implementations":
-
I'm not sure if I undertand the paragraph under the 'IsStack' class definition. If I try to use my own words I understood it as:
You can get
Functorimplementation forsfor free by using using two facts- the Homomorhism Property for
mu:mu (fmap f s) = fmap f (mu s) muandmu'are inverse
Is that correct?
- the Homomorhism Property for
-
I'm puzzled by this result:
-- Result:
-- fmap f [] = []
-- fmap f (h:t) = f h : t
Does this mean f would only get applied to head?
Isn't that an incorrect Functor implementation for a stack?