
7 Aug
2019
7 Aug
'19
9:36 a.m.
On Wed, Aug 7, 2019, 8:22 AM Juan Casanova
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