| 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
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]
- deriveFunctorOptions :: FFTOptions -> Name -> Q [Dec]
- makeFmap :: Name -> Q Exp
- makeFmapOptions :: FFTOptions -> Name -> Q Exp
- newtype FFTOptions = FFTOptions {}
- defaultFFTOptions :: FFTOptions
Functor
deriveFunctor :: Name -> Q [Dec] Source #
Generates a FunctorClass instance declaration for the given data type or data
family instance.
deriveFunctorOptions :: FFTOptions -> Name -> Q [Dec] Source #
Like deriveFunctor, but takes an FFTOptions argument.
makeFmap :: Name -> Q Exp Source #
Generates a lambda expression which behaves like fmap (without requiring a
FunctorClass instance).
makeFmapOptions :: FFTOptions -> Name -> Q Exp Source #
Like makeFmap, but takes an FFTOptions argument.
FFTOptions
newtype FFTOptions Source #
Options that further configure how the functions in Data.Functor.Deriving
should behave. (FFT stands for 'Functor'/'Foldable'/'Traversable'.)
Constructors
| FFTOptions | |
Fields | |
Instances
| Eq FFTOptions Source # | |
Defined in Data.Functor.Deriving.Internal | |
| Ord FFTOptions Source # | |
Defined in Data.Functor.Deriving.Internal Methods compare :: FFTOptions -> FFTOptions -> Ordering # (<) :: FFTOptions -> FFTOptions -> Bool # (<=) :: FFTOptions -> FFTOptions -> Bool # (>) :: FFTOptions -> FFTOptions -> Bool # (>=) :: FFTOptions -> FFTOptions -> Bool # max :: FFTOptions -> FFTOptions -> FFTOptions # min :: FFTOptions -> FFTOptions -> FFTOptions # | |
| Read FFTOptions Source # | |
Defined in Data.Functor.Deriving.Internal Methods readsPrec :: Int -> ReadS FFTOptions # readList :: ReadS [FFTOptions] # readPrec :: ReadPrec FFTOptions # readListPrec :: ReadPrec [FFTOptions] # | |
| Show FFTOptions Source # | |
Defined in Data.Functor.Deriving.Internal Methods showsPrec :: Int -> FFTOptions -> ShowS # show :: FFTOptions -> String # showList :: [FFTOptions] -> ShowS # | |
defaultFFTOptions :: FFTOptions Source #
Conservative FFTOptions that doesn't attempt to use EmptyCase (to
prevent users from having to enable that extension at use sites.)