1. 12

  2. 1

    Great essay, but I’d change the title to reflect that it’s the Foldable instances for these that are not arbitrary. When I saw the title, I was expecting something on Arbitrary (as in QuickCheck).

    These instances are confusing only if people are unaware of what (,) means in the container context. A pair is versatile, but as a container (or Functor), the type (a, b) means, unambiguously, “a container of exactly one b with an annotation of type a”. And Either a b means “a container of zero or one b”– just as Maybe is a container– with an annotation of type a in the “zero” case. That’s obviously a clumsy-sounding way to describe what we don’t usually think of as a container, but it’s the only “right” interpretation, given the curried type signatures and the fact that Functor is by definition of one type.