What exactly does "deriving Functor" do?
functor, haskell
Solution
To use `deriving Functor` you must enable the `DeriveFunctor` language pragma and apply it to a polymorphic type which has a covariant final type variable---in other words, a type which admits a valid `Functor` instance. It'll then derive the "obvious" `Functor` instance.
There's been some concern in the past that the derived instance is not as efficient as a hand coded one is, though I cannot seem to find that material.
The algorithm itself was, as far as I could find, first proposed by Twan Van Laarhoven in 2007 and makes heavy use of Generic Haskell programming.
Problem
I'm trying to figure out what exactly are the rules for `deriving Functor` in Haskell. I've seen message postings about it, and I've seen test code about it, but I can't seem to find official documentation about what the rules are. Can someone please clarify and/or point me to the right place?