Generates a Traversable instance declaration for the given data type or data family instance.
Modulederiving-compat-0.6.8Haskell2010
Data.Traversable.Deriving
Exports functions to mechanically derive Traversable instances in a way that mimics
how the -XDeriveTraversable extension works since GHC 8.0.
Derived Traversable instances from this module do not generate
superfluous pure expressions in its implementation of traverse. One can
verify this by compiling a module that uses deriveTraversable with the
-ddump-splices GHC flag.
These changes make it possible to derive Traversable instances for data types with
unlifted argument types, e.g.,
data IntHash a = IntHash Int# a
deriving instance Traversable IntHash -- On GHC 8.0 on later
$(deriveTraversable ''IntHash) -- On GHC 7.10 and earlier
For more info on these changes, see this GHC wiki page.
Synopsis
- value deriveTraversable
- value deriveTraversableOptions
- value makeTraverse
- value makeTraverseOptions
- value makeSequenceA
- value makeSequenceAOptions
- value makeMapM
- value makeMapMOptions
- value makeSequence
- value makeSequenceOptions
- newtype FFTOptions
- value defaultFFTOptions
- Packagederiving-compat-0.6.8
- Exports12
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceDeriving.hs
Like deriveTraverse, but takes an FFTOptions argument.
Generates a lambda expression which behaves like traverse (without requiring a Traversable instance).
Like makeTraverse, but takes an FFTOptions argument.
Generates a lambda expression which behaves like sequenceA (without requiring a Traversable instance).
Like makeSequenceA, but takes an FFTOptions argument.
Generates a lambda expression which behaves like mapM (without requiring a Traversable instance).
Like makeMapM, but takes an FFTOptions argument.
Generates a lambda expression which behaves like sequence (without requiring a Traversable instance).
Like makeSequence, but takes an FFTOptions argument.
Options that further configure how the functions in Data.Functor.Deriving
should behave. (FFT stands for FunctorFoldableTraversable.)
Constructors
Instances4Eq, Ord, Read, Show
Eq FFTOptionsDefined in deriving-compat-0.6.8 · Data.Functor.Deriving.InternalOrd FFTOptionsDefined in deriving-compat-0.6.8 · Data.Functor.Deriving.InternalRead FFTOptionsDefined in deriving-compat-0.6.8 · Data.Functor.Deriving.InternalShow FFTOptionsDefined in deriving-compat-0.6.8 · Data.Functor.Deriving.Internal
Conservative FFTOptions that doesn't attempt to use EmptyCase (to
prevent users from having to enable that extension at use sites.)
deriveTraversable limitations
Be aware of the following potential gotchas:
If you are using the
-XGADTsor-XExistentialQuantificationextensions, an existential constraint cannot mention the last type variable. For example,data Illegal a = forall a. Show a => Illegal acannot have a derived Traversable instance.Type variables of kind
* -> *are assumed to have Traversable constraints. If this is not desirable, use makeTraverse.