2 kyu

Folding through a fixed point

231tel

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.

Algorithms

More By Author:

Check out these other kata created by tel

Stats:

CreatedSep 28, 2014
PublishedSep 28, 2014
Warriors Trained1100
Total Skips363
Total Code Submissions937
Total Times Completed231
Haskell Completions231
Total Stars92
% of votes with a positive feedback rating96% of 64
Total "Very Satisfied" Votes60
Total "Somewhat Satisfied" Votes3
Total "Not Satisfied" Votes1
Ad
Contributors
  • tel Avatar
  • jhoffner Avatar
  • Voile Avatar
Ad