What exactly does “deriving Functor” do?

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)