lens vs. Foldable (Was: Haskell Foldable Wast)

Henning Thielemann lemming at henning-thielemann.de
Tue Feb 23 09:12:50 UTC 2016


On Sun, 21 Feb 2016, Jeremy wrote:

> Let us consider some of the functions that Foldable actually provides for
> tuples:
>
> length
> Useless and wrong. Unless "length" means "the number of items which fmap
> will operate over", in which case it's just useless and misleading.
>
> maximum
> Useless and wrong/misleading.
>
> minimum
> Useless and wrong/misleading.
>
> product
> Useless and wrong/misleading.
>
> sum
> Useless and wrong/misleading.


An alternative to custom types is to stay with pairs but use lenses 
instead of type class methods:
    http://www.haskellforall.com/2015/10/explicit-is-better-than-implicit.html


More information about the Libraries mailing list