[Haskell-cafe] Ambiguous types

Brent Yorgey byorgey at gmail.com
Wed Aug 7 13:36:42 UTC 2019


On Wed, Aug 7, 2019, 8:22 AM Juan Casanova <juan.casanova at ed.ac.uk> wrote:

> List is special as a foldable because it is general. In
> other words, the function:
>
> tolist :: Foldable t => t a -> [a]
> tolist = foldr (:) []
>
> is such that for any x :: t a where Foldable t, it is true that
>
> foldr f v x = foldr f v (tolist x)
>
> which is to say, any structure a foldable may have is preserved when
> transforming into list shape, as a foldable.
>

This is true.  In fact "Listable" might have been a better name than
Foldable.  (In particular Foldable has nothing to do with generic folds aka
catamorphisms.)

-Brent

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20190807/2cbd32b4/attachment.html>


More information about the Haskell-Cafe mailing list