-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Backports of GHC deriving extensions
--
-- Provides Template Haskell functions that mimic deriving extensions
-- that were introduced or modified in recent versions of GHC. Currently,
-- the following extensions are covered:
--
--
-- DeriveFoldable
-- DeriveFunctor
-- DeriveTraversable
--
--
-- The following changes have been backported:
--
--
-- - In GHC 8.0, DeriveFoldable was changed to allow folding
-- over data types with existential constraints.
-- - In GHC 8.0, DeriveFoldable and DeriveTraversable
-- were changed so as not to generate superfluous mempty or
-- pure expressions in generated code. As a result, this allows
-- deriving Traversable instances for datatypes with unlifted
-- argument types.
-- - In GHC 8.0, deriving Show was changed so that constructor
-- fields with unlifted types are no longer shown with parentheses, and
-- the output of showing an unlifted type is suffixed with the same
-- number of hash signs as the corresponding primitive literals.
-- - In GHC 8.2, deriving Ord was changed so that it generates
-- concrete if-expressions that are not subject to
-- RebindableSyntax.
--
--
-- Note that some recent GHC extensions are not covered by this package:
--
--
-- - DeriveGeneric, which was introducted in GHC 7.2 for
-- deriving Generic instances, and modified in GHC 7.6 to allow
-- derivation of Generic1 instances. Use
-- Generics.Deriving.TH from generic-deriving to
-- derive Generic(1) using Template Haskell.
-- - DeriveLift, which was introduced in GHC 8.0 for deriving
-- Lift instances. Use Language.Haskell.TH.Lift from
-- th-lift to derive Lift using Template
-- Haskell.
--
@package deriving-compat
@version 0.3
-- | Exports functions to mechanically derive Show, Show1,
-- and Show2 instances.
module Text.Show.Deriving
-- | Generates a Show instance declaration for the given data type
-- or data family instance.
deriveShow :: Name -> Q [Dec]
-- | Like deriveShow, but takes a ShowOptions argument.
deriveShowOptions :: ShowOptions -> Name -> Q [Dec]
-- | Generates a lambda expression which behaves like showsPrec
-- (without requiring a Show instance).
makeShowsPrec :: Name -> Q Exp
-- | Like makeShowsPrec, but takes a ShowOptions argument.
makeShowsPrecOptions :: ShowOptions -> Name -> Q Exp
-- | Generates a lambda expression which behaves like show (without
-- requiring a Show instance).
makeShow :: Name -> Q Exp
-- | Like makeShow, but takes a ShowOptions argument.
makeShowOptions :: ShowOptions -> Name -> Q Exp
-- | Generates a lambda expression which behaves like showList
-- (without requiring a Show instance).
makeShowList :: Name -> Q Exp
-- | Like makeShowList, but takes a ShowOptions argument.
makeShowListOptions :: ShowOptions -> Name -> Q Exp
-- | Generates a Show1 instance declaration for the given data type
-- or data family instance.
deriveShow1 :: Name -> Q [Dec]
-- | Like deriveShow1, but takes a ShowOptions argument.
deriveShow1Options :: ShowOptions -> Name -> Q [Dec]
-- | Generates a lambda expression which behaves like
-- liftShowsPrec (without requiring a Show1 instance).
--
-- This function is not available with transformers-0.4.
makeLiftShowsPrec :: Name -> Q Exp
-- | Like makeLiftShowsPrec, but takes a ShowOptions
-- argument.
--
-- This function is not available with transformers-0.4.
makeLiftShowsPrecOptions :: ShowOptions -> Name -> Q Exp
-- | Generates a lambda expression which behaves like liftShowList
-- (without requiring a Show instance).
--
-- This function is not available with transformers-0.4.
makeLiftShowList :: Name -> Q Exp
-- | Like makeLiftShowList, but takes a ShowOptions argument.
--
-- This function is not available with transformers-0.4.
makeLiftShowListOptions :: ShowOptions -> Name -> Q Exp
-- | Generates a lambda expression which behaves like showsPrec1
-- (without requiring a Show1 instance).
makeShowsPrec1 :: Name -> Q Exp
-- | Like makeShowsPrec1, but takes a ShowOptions argument.
makeShowsPrec1Options :: ShowOptions -> Name -> Q Exp
-- | Generates a Show2 instance declaration for the given data type
-- or data family instance.
--
-- This function is not available with transformers-0.4.
deriveShow2 :: Name -> Q [Dec]
-- | Like deriveShow2, but takes a ShowOptions argument.
--
-- This function is not available with transformers-0.4.
deriveShow2Options :: ShowOptions -> Name -> Q [Dec]
-- | Generates a lambda expression which behaves like
-- liftShowsPrec2 (without requiring a Show2 instance).
--
-- This function is not available with transformers-0.4.
makeLiftShowsPrec2 :: Name -> Q Exp
-- | Like makeLiftShowsPrec2, but takes a ShowOptions
-- argument.
--
-- This function is not available with transformers-0.4.
makeLiftShowsPrec2Options :: ShowOptions -> Name -> Q Exp
-- | Generates a lambda expression which behaves like
-- liftShowList2 (without requiring a Show instance).
--
-- This function is not available with transformers-0.4.
makeLiftShowList2 :: Name -> Q Exp
-- | Like makeLiftShowList2, but takes a ShowOptions
-- argument.
--
-- This function is not available with transformers-0.4.
makeLiftShowList2Options :: ShowOptions -> Name -> Q Exp
-- | Generates a lambda expression which behaves like showsPrec2
-- (without requiring a Show2 instance).
--
-- This function is not available with transformers-0.4.
makeShowsPrec2 :: Name -> Q Exp
-- | Like makeShowsPrec2, but takes a ShowOptions argument.
--
-- This function is not available with transformers-0.4.
makeShowsPrec2Options :: ShowOptions -> Name -> Q Exp
-- | Options that further configure how the functions in
-- Text.Show.Deriving should behave.
newtype ShowOptions
ShowOptions :: Bool -> ShowOptions
-- | If True, the derived Show, Show1, or Show2
-- instance will not surround the output of showing fields of unlifted
-- types with parentheses, and the output will be suffixed with hash
-- signs (#).
[ghc8ShowBehavior] :: ShowOptions -> Bool
-- | ShowOptions that match the behavior of the most recent GHC
-- release.
defaultShowOptions :: ShowOptions
-- | ShowOptions that match the behavior of the installed version of
-- GHC.
legacyShowOptions :: ShowOptions
-- | Exports functions to mechanically derive Read, Read1,
-- and Read2 instances.
module Text.Read.Deriving
-- | Generates a Read instance declaration for the given data type
-- or data family instance.
deriveRead :: Name -> Q [Dec]
-- | Like deriveRead, but takes a ReadOptions argument.
deriveReadOptions :: ReadOptions -> Name -> Q [Dec]
-- | Generates a lambda expression which behaves like readsPrec
-- (without requiring a Read instance).
makeReadsPrec :: Name -> Q Exp
-- | Generates a lambda expression which behaves like readPrec
-- (without requiring a Read instance).
makeReadPrec :: Name -> Q Exp
-- | Generates a Read1 instance declaration for the given data type
-- or data family instance.
deriveRead1 :: Name -> Q [Dec]
-- | Like deriveRead1, but takes a ReadOptions argument.
deriveRead1Options :: ReadOptions -> Name -> Q [Dec]
-- | Generates a lambda expression which behaves like
-- liftReadsPrec (without requiring a Read1 instance).
--
-- This function is not available with transformers-0.4.
makeLiftReadsPrec :: Name -> Q Exp
-- | Generates a lambda expression which behaves like readsPrec1
-- (without requiring a Read1 instance).
makeReadsPrec1 :: Name -> Q Exp
-- | Generates a Read2 instance declaration for the given data type
-- or data family instance.
--
-- This function is not available with transformers-0.4.
deriveRead2 :: Name -> Q [Dec]
-- | Like deriveRead2, but takes a ReadOptions argument.
--
-- This function is not available with transformers-0.4.
deriveRead2Options :: ReadOptions -> Name -> Q [Dec]
-- | Generates a lambda expression which behaves like
-- liftReadsPrec2 (without requiring a Read2 instance).
--
-- This function is not available with transformers-0.4.
makeLiftReadsPrec2 :: Name -> Q Exp
-- | Generates a lambda expression which behaves like readsPrec2
-- (without requiring a Read2 instance).
--
-- This function is not available with transformers-0.4.
makeReadsPrec2 :: Name -> Q Exp
-- | Options that further configure how the functions in
-- Text.Read.Deriving should behave.
newtype ReadOptions
ReadOptions :: Bool -> ReadOptions
-- | If True:
--
--
-- - Derived Read instances will implement readPrec,
-- not readsPrec, and will provide a default implementation of
-- readListPrec in terms of readPrec.
-- - If built against base-4.10 or later, derived
-- 'Read1'/'Read2' instances will implement
-- 'liftReadPrec'/'liftReadPrec2', not 'liftReadsPrec'/'liftReadsPrec2',
-- and will provide default implementations of
-- 'liftReadListPrec'/'liftReadListPrec2' in terms of
-- 'liftReadPrec'/'liftReadPrec2'. If built against an earlier version of
-- base, derived 'Read1'/'Read2' instances are not affected, so
-- they will act as if this flag were False.
--
--
-- If False:
--
--
-- - Derived Read instances will implement
-- readsPrec.
-- - Derived Read1 instances will implement readsPrec1
-- (if built against transformers-0.4) or liftReadsPrec
-- (otherwise). If not built against transformers-0.4, derived
-- Read2 instances will implement liftReadsPrec2.
--
--
-- It's generally a good idea to enable this option, since
-- readPrec and friends are more efficient than readsPrec
-- and friends, since the former use the efficient ReadPrec
-- parser datatype while the latter use the slower, list-based
-- ReadS type.
[useReadPrec] :: ReadOptions -> Bool
-- | ReadOptions that favor readPrec over readsPrec.
defaultReadOptions :: ReadOptions
-- | 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.
module Data.Traversable.Deriving
-- | Generates a Traversable instance declaration for the given data
-- type or data family instance.
deriveTraversable :: Name -> Q [Dec]
-- | Generates a lambda expression which behaves like traverse
-- (without requiring a Traversable instance).
makeTraverse :: Name -> Q Exp
-- | Generates a lambda expression which behaves like sequenceA
-- (without requiring a Traversable instance).
makeSequenceA :: Name -> Q Exp
-- | Generates a lambda expression which behaves like mapM (without
-- requiring a Traversable instance).
makeMapM :: Name -> Q Exp
-- | Generates a lambda expression which behaves like sequence
-- (without requiring a Traversable instance).
makeSequence :: Name -> Q Exp
-- | Exports functions to mechanically derive Ord, Ord1,
-- and Ord2 instances.
module Data.Ord.Deriving
-- | Generates an Ord instance declaration for the given data type
-- or data family instance.
deriveOrd :: Name -> Q [Dec]
-- | Generates a lambda expression which behaves like compare
-- (without requiring an Ord instance).
makeCompare :: Name -> Q Exp
-- | Generates a lambda expression which behaves like '(<)' (without
-- requiring an Ord instance).
makeLT :: Name -> Q Exp
-- | Generates a lambda expression which behaves like '(<=)' (without
-- requiring an Ord instance).
makeLE :: Name -> Q Exp
-- | Generates a lambda expression which behaves like '(>)' (without
-- requiring an Ord instance).
makeGT :: Name -> Q Exp
-- | Generates a lambda expression which behaves like '(>=)' (without
-- requiring an Ord instance).
makeGE :: Name -> Q Exp
-- | Generates a lambda expression which behaves like max (without
-- requiring an Ord instance).
makeMax :: Name -> Q Exp
-- | Generates a lambda expression which behaves like min (without
-- requiring an Ord instance).
makeMin :: Name -> Q Exp
-- | Generates an Ord1 instance declaration for the given data type
-- or data family instance.
deriveOrd1 :: Name -> Q [Dec]
-- | Generates a lambda expression which behaves like liftCompare
-- (without requiring an Ord1 instance).
--
-- This function is not available with transformers-0.4.
makeLiftCompare :: Name -> Q Exp
-- | Generates a lambda expression which behaves like compare1
-- (without requiring an Ord1 instance).
makeCompare1 :: Name -> Q Exp
-- | Generates an Ord2 instance declaration for the given data type
-- or data family instance.
--
-- This function is not available with transformers-0.4.
deriveOrd2 :: Name -> Q [Dec]
-- | Generates a lambda expression which behaves like liftCompare2
-- (without requiring an Ord2 instance).
--
-- This function is not available with transformers-0.4.
makeLiftCompare2 :: Name -> Q Exp
-- | Generates a lambda expression which behaves like compare2
-- (without requiring an Ord2 instance).
--
-- This function is not available with transformers-0.4.
makeCompare2 :: Name -> Q Exp
-- | Exports functions to mechanically derive Functor instances.
--
-- For more info on how deriving Functor works, see this GHC
-- wiki page.
module Data.Functor.Deriving
-- | Generates a Functor instance declaration for the given data
-- type or data family instance.
deriveFunctor :: Name -> Q [Dec]
-- | Generates a lambda expression which behaves like fmap (without
-- requiring a Functor instance).
makeFmap :: Name -> Q Exp
-- | Exports functions to mechanically derive Foldable instances in
-- a way that mimics how the -XDeriveFoldable extension works
-- since GHC 8.0.
--
-- These changes make it possible to derive Foldable instances
-- for data types with existential constraints, e.g.,
--
--
-- data WrappedSet a where
-- WrapSet :: Ord a => a -> WrappedSet a
--
-- deriving instance Foldable WrappedSet -- On GHC 8.0 on later
-- $(deriveFoldable ''WrappedSet) -- On GHC 7.10 and earlier
--
--
-- In addition, derived Foldable instances from this module do not
-- generate superfluous mempty expressions in its implementation
-- of foldMap. One can verify this by compiling a module that uses
-- deriveFoldable with the -ddump-splices GHC flag.
--
-- For more info on these changes, see this GHC wiki page.
module Data.Foldable.Deriving
-- | Generates a Foldable instance declaration for the given data
-- type or data family instance.
deriveFoldable :: Name -> Q [Dec]
-- | Generates a lambda expression which behaves like foldMap
-- (without requiring a Foldable instance).
makeFoldMap :: Name -> Q Exp
-- | Generates a lambda expression which behaves like foldr (without
-- requiring a Foldable instance).
makeFoldr :: Name -> Q Exp
-- | Generates a lambda expression which behaves like fold
-- (without requiring a Foldable instance).
makeFold :: Name -> Q Exp
-- | Generates a lambda expression which behaves like foldl (without
-- requiring a Foldable instance).
makeFoldl :: Name -> Q Exp
-- | Exports functions to mechanically derive Eq, Eq1, and
-- Eq2 instances.
module Data.Eq.Deriving
-- | Generates an Eq instance declaration for the given data type or
-- data family instance.
deriveEq :: Name -> Q [Dec]
-- | Generates a lambda expression which behaves like '(==)' (without
-- requiring an Eq instance).
makeEq :: Name -> Q Exp
-- | Generates a lambda expression which behaves like '(/=)' (without
-- requiring an Eq instance).
makeNotEq :: Name -> Q Exp
-- | Generates an Eq1 instance declaration for the given data type
-- or data family instance.
deriveEq1 :: Name -> Q [Dec]
-- | Generates a lambda expression which behaves like liftEq
-- (without requiring an Eq1 instance).
--
-- This function is not available with transformers-0.4.
makeLiftEq :: Name -> Q Exp
-- | Generates a lambda expression which behaves like eq1 (without
-- requiring an Eq1 instance).
makeEq1 :: Name -> Q Exp
-- | Generates an Eq2 instance declaration for the given data type
-- or data family instance.
--
-- This function is not available with transformers-0.4.
deriveEq2 :: Name -> Q [Dec]
-- | Generates a lambda expression which behaves like liftEq2
-- (without requiring an Eq2 instance).
--
-- This function is not available with transformers-0.4.
makeLiftEq2 :: Name -> Q Exp
-- | Generates a lambda expression which behaves like eq2 (without
-- requiring an Eq2 instance).
--
-- This function is not available with transformers-0.4.
makeEq2 :: Name -> Q Exp
-- | This module reexports all of the functionality of the other modules in
-- this library. It also provides a high-level tutorial on
-- deriving-compat's naming conventions and best practices.
-- Typeclass-specific information can be found in their respective
-- modules.
module Data.Deriving