I\'m reading Learn You a Haskell and I\'m wondering why so many things are acting like a list, and nothing in the Prelude is using the native facility of type classes to set
There are the two type classes called Foldable
and Traversable
which aim to abstract some common1 behaviours of lists and other sequential data structures. Not all data structures have instances of these though, and I don't know if they are transparent enough to the compiler such that it can still perform optimisation on them (does anybody know something about that?)
Source: Foldable and Traversable
See also this answer to
Why is Haskell missing “obvious” Typeclasses