Cofree Traversable Functors
Love Waern · KTH Publication Database DiVA (KTH Royal Institute of Technology) · 2019
Traversable functors see widespread use in purely functional programming as an approach to the iterator pattern. Unlike other commonly used functor families, free constructions of traversable functors have not yet been described. Free constructions have previously found powerful applications in purely functional programming, as they embody the concept of providing the minimal amount of structure needed to create members of a complex family out of members of a simpler, underlying family. This thesis introduces Cofree Traversable Functors, together with a provably valid implementation, thereby developing a family of free constructions for traversable functors. As free constructions, cofree traversable functors may be used in order to create novel traversable functors from regular functors. Cofree traversable functors may also be leveraged in order to manipulate traversable functors generically.