Copyright | (C) 2015-2017 Ryan Scott |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Ryan Scott |
Portability | Template Haskell |
Safe Haskell | None |
Language | Haskell2010 |
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
- makeReplace :: Name -> Q Exp
- makeReplaceOptions :: 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.
makeReplace :: Name -> Q Exp Source #
Generates a lambda expression which behaves like (<$
) (without requiring a
FunctorClass
instance).
makeReplaceOptions :: FFTOptions -> Name -> Q Exp Source #
Like makeReplace
, 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'.)
Instances
Eq FFTOptions Source # | |
Defined in Data.Functor.Deriving.Internal (==) :: FFTOptions -> FFTOptions -> Bool # (/=) :: FFTOptions -> FFTOptions -> Bool # | |
Ord FFTOptions Source # | |
Defined in Data.Functor.Deriving.Internal 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 readsPrec :: Int -> ReadS FFTOptions # readList :: ReadS [FFTOptions] # readPrec :: ReadPrec FFTOptions # readListPrec :: ReadPrec [FFTOptions] # | |
Show FFTOptions Source # | |
Defined in Data.Functor.Deriving.Internal 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.)