advent-of-haskell-dd
advent-of-haskell-dd copied to clipboard
Question about "Calculating Implementations"
@smatting kindly took the time to write a document with some questions, which I link here.
First of all thanks for the questions!
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 inverseIs that correct?
Yes, that's exactly it! The original DD paper has a section about it that goes into more detail, but basically if you are able to have a computable inverse (mu') you can calculate a solution much more easily!
Does this mean
fwould only get applied to head? Isn't that an incorrectFunctorimplementation for a stack?
Good eye! That was indeed an error in my post which I have already fixed! Thanks for pointing it out. I forgot to propagate the fmap and it lead to a wrong calculation.