Identities and monoidal folds

  • We need boundaries
  • Truly monoidal folds
  • Escaping the boundaries
  • Doing better

This continuation of the previous article comparing JavaScript and Haskell goes more deeply into implementations of the minimum and maximum functions. We will start by looking at how the notion of an identity value can be generalized, first by imposing a boundary on a type and later by exploring other ways to provide default return values. Finally, we’ll look at the real exception-throwing Haskell and some safer alternatives.

Sign up for access to the full page, plus the complete archive and all the latest content.