deriving-compat-0.3.3: Backports of GHC deriving extensions

Copyright(C) 2015-2016 Ryan Scott
LicenseBSD-style (see the file LICENSE)
MaintainerRyan Scott
PortabilityTemplate Haskell
Safe HaskellNone
LanguageHaskell2010

Data.Functor.Deriving

Contents

Description

Exports functions to mechanically derive Functor instances.

For more info on how deriving Functor works, see this GHC wiki page.

Synopsis

Functor

deriveFunctor :: Name -> Q [Dec] Source #

Generates a Functor instance declaration for the given data type or data family instance.

makeFmap :: Name -> Q Exp Source #

Generates a lambda expression which behaves like fmap (without requiring a Functor instance).

deriveFunctor limitations

Be aware of the following potential gotchas:

  • Type variables of kind * -> * are assumed to have Functor constraints. If this is not desirable, use makeFmap.