Folding through a fixed point
Description:
In Haskell the greatest and least fixed points of a functor are both equivalent. Demonstrate this to be true.
A small tutorial introducing least and greatest fixed points of functors is included in the initial solution.
Hint: Try constructing the forward and backward functions for specific choices of f
first.
Hint hint: It may be useful to read Wadler's Recursive Types for Free!, but while that paper explains the phenomenon explored here in great detail there are also simpler ways of figuring it out.
Hint hint hint: Least
types are "smaller" than Greatest
types. What this means is that converting from Least
to Greatest
is less exotic than going the other way—you may end up finding it to be the easier direction to code as well.
Hint hint hint hint: It may be useful to construct a few more functions related to wrap
and unwrap
. The search term "Lambek's Lemma" may help... but be wary that it usually spills its secret only amidst a large amount of other Category Theoretic mumbo-jumbo.
Similar Kata:
Stats:
Created | Sep 28, 2014 |
Published | Sep 28, 2014 |
Warriors Trained | 1100 |
Total Skips | 363 |
Total Code Submissions | 937 |
Total Times Completed | 231 |
Haskell Completions | 231 |
Total Stars | 92 |
% of votes with a positive feedback rating | 96% of 64 |
Total "Very Satisfied" Votes | 60 |
Total "Somewhat Satisfied" Votes | 3 |
Total "Not Satisfied" Votes | 1 |