deriving-compat-0.3.6: Backports of GHC deriving extensions

Copyright | (C) 2015-2017 Ryan Scott
License | BSD-style (see the file LICENSE)
Maintainer | Ryan Scott
Portability | Template Haskell
Safe Haskell | None
Language | Haskell2010

Data.Functor.Deriving

Contents

- `Functor`
- `deriveFunctor` limitations

Description

Exports functions to mechanically derive `Functor` instances.

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

Synopsis

- deriveFunctor :: Name -> Q [Dec]
- makeFmap :: Name -> Q Exp

# `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`.