Why there is no way to derive Applicative Functors in Haskell?

In Haskell, you can derive Functor, Foldable and Traversable automatically using deriving. There is no way to derive Applicative, though. Considering there is one obvious way to define an Applicative instance (which would amount to a zipped application), isn't there any way to enable deriving Applicative?


  • No, this is not obvious at all. Compare the following Applicative instances:

    1. []
    2. ZipList
    3. Data.Sequence.Seq, whose Applicative instance declaration runs to several hundred lines.
    4. IO
    5. (->) r
    6. Parsers in parsec, attoparsec, regex-applicative.
    7. Proxy in the pipes package.

    There very little uniformity here, and most of the instances are non-obvious.

    As David Young comments, the [] and ZipList instances "are both, ultimately, two different, equally valid Applicative instances for the list type."