advent-of-haskell-dd icon indicating copy to clipboard operation
advent-of-haskell-dd copied to clipboard

Question about "Calculating Implementations"

Open bolt12 opened this issue 4 years ago • 0 comments

@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 Functor implementation for s for free by using using two facts

  • the Homomorhism Property for mu: mu (fmap f s) = fmap f (mu s)
  • mu and mu' are inverse

Is 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 f would only get applied to head? Isn't that an incorrect Functor implementation 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.

bolt12 avatar Dec 10 '20 11:12 bolt12