[Haskell-cafe] SYB supports genuine gmap

oleg at okmij.org oleg at okmij.org
Fri Jan 3 05:21:22 UTC 2014


For the record, I have described the implementation of generic map
(which is fmap implemented generically, once and for all).

        http://okmij.org/ftp/Haskell/generics.html#gmap

The article stresses a drawback of a fake gmap in terms of gfoldl: a
fake gmap is non-parametric. It fails the law gmap f . gmap g == gmap
(f.g). OTH, the genuine gmap satisfies the law, as behooves to the
generic version of fmap. Although gmap is implemented in terms of the
parametricity-breaking type-introspecting SYB, the gmap is parametric
nevertheless.





More information about the Haskell-Cafe mailing list