Modernizing Haskell 98

The introduction of Applicative, along with Foldable and Traversable, have had a big impact on Haskell.

The Foldable and Traversable type­classes lift the Prelude fold and map functions to a much higher level of abstraction. Moreover, Foldable and Traversable also bring a clean separation between processes that preserve or discard the shape of the structure being processed:

  • Traversable describes a process that preserves the shape of the data structure being traversed over
  • Foldable discards (or transforms) the shape of the structure being folded over

Since Traversable is a specialization of Foldable, we can say that shape preservation is a special case of shape transformation. This line between shape preservation and transformation ...

Get Haskell Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.