-- 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.
--
--
-- 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.2.2
-- | 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 an Options argument.
deriveShowOptions :: Options -> Name -> Q [Dec]
-- | Generates a lambda expression which behaves like showsPrec
-- (without requiring a Show instance).
makeShowsPrec :: Name -> Q Exp
-- | Like makeShowsPrec, but takes an Options argument.
makeShowsPrecOptions :: Options -> Name -> Q Exp
-- | Generates a lambda expression which behaves like show (without
-- requiring a Show instance).
makeShow :: Name -> Q Exp
-- | Like makeShow, but takes an Options argument.
makeShowOptions :: Options -> Name -> Q Exp
-- | Generates a lambda expression which behaves like showList
-- (without requiring a Show instance).
makeShowList :: Name -> Q Exp
-- | Like makeShowList, but takes an Options argument.
makeShowListOptions :: Options -> 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 an Options argument.
deriveShow1Options :: Options -> 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 an Options argument.
--
-- This function is not available with transformers-0.4.
makeLiftShowsPrecOptions :: Options -> 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 an Options argument.
--
-- This function is not available with transformers-0.4.
makeLiftShowListOptions :: Options -> Name -> Q Exp
-- | Generates a lambda expression which behaves like showsPrec1
-- (without requiring a Show1 instance).
makeShowsPrec1 :: Name -> Q Exp
-- | Like makeShowsPrec1, but takes an Options argument.
makeShowsPrec1Options :: Options -> 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 an Options argument.
--
-- This function is not available with transformers-0.4.
deriveShow2Options :: Options -> 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 an Options argument.
--
-- This function is not available with transformers-0.4.
makeLiftShowsPrec2Options :: Options -> 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 an Options argument.
--
-- This function is not available with transformers-0.4.
makeLiftShowList2Options :: Options -> 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 an Options argument.
--
-- This function is not available with transformers-0.4.
makeShowsPrec2Options :: Options -> Name -> Q Exp
-- | Options that further configure how the functions in
-- Text.Show.Deriving should behave.
newtype Options
Options :: Bool -> Options
-- | 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] :: Options -> Bool
-- | Options that match the behavior of the most recent GHC release.
defaultOptions :: Options
-- | Options that match the behavior of the installed version of GHC.
legacyOptions :: Options
-- | 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 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
-- | 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