deriving-compat-0.5.8: Backports of GHC deriving extensions

Copyright(C) 2015-2017 Ryan Scott
LicenseBSD-style (see the file LICENSE)
MaintainerRyan Scott
PortabilityTemplate Haskell
Safe HaskellNone
LanguageHaskell2010

Text.Show.Deriving.Internal

Contents

Description

Exports functions to mechanically derive ShowClass, Show1, and Show2 instances.

Note: this is an internal module, and as such, the API presented here is not guaranteed to be stable, even between minor releases of this library.

Synopsis

ShowClass

deriveShow :: Name -> Q [Dec] Source #

Generates a ShowClass instance declaration for the given data type or data family instance.

deriveShowOptions :: ShowOptions -> Name -> Q [Dec] Source #

Like deriveShow, but takes a ShowOptions argument.

makeShowsPrec :: Name -> Q Exp Source #

Generates a lambda expression which behaves like showsPrec (without requiring a ShowClass instance).

makeShow :: Name -> Q Exp Source #

Generates a lambda expression which behaves like show (without requiring a ShowClass instance).

makeShowOptions :: ShowOptions -> Name -> Q Exp Source #

Like makeShow, but takes a ShowOptions argument.

makeShowList :: Name -> Q Exp Source #

Generates a lambda expression which behaves like showList (without requiring a ShowClass instance).

Show1

deriveShow1 :: Name -> Q [Dec] Source #

Generates a Show1 instance declaration for the given data type or data family instance.

deriveShow1Options :: ShowOptions -> Name -> Q [Dec] Source #

Like deriveShow1, but takes a ShowOptions argument.

makeLiftShowsPrec :: Name -> Q Exp Source #

Generates a lambda expression which behaves like liftShowsPrec (without requiring a Show1 instance).

This function is not available with transformers-0.4.

makeLiftShowsPrecOptions :: ShowOptions -> Name -> Q Exp Source #

Like makeLiftShowsPrec, but takes a ShowOptions argument.

This function is not available with transformers-0.4.

makeLiftShowList :: Name -> Q Exp Source #

Generates a lambda expression which behaves like liftShowList (without requiring a ShowClass instance).

This function is not available with transformers-0.4.

makeLiftShowListOptions :: ShowOptions -> Name -> Q Exp Source #

Like makeLiftShowList, but takes a ShowOptions argument.

This function is not available with transformers-0.4.

makeShowsPrec1 :: Name -> Q Exp Source #

Generates a lambda expression which behaves like showsPrec1 (without requiring a Show1 instance).

Show2

deriveShow2 :: Name -> Q [Dec] Source #

Generates a Show2 instance declaration for the given data type or data family instance.

This function is not available with transformers-0.4.

deriveShow2Options :: ShowOptions -> Name -> Q [Dec] Source #

Like deriveShow2, but takes a ShowOptions argument.

This function is not available with transformers-0.4.

makeLiftShowsPrec2 :: Name -> Q Exp Source #

Generates a lambda expression which behaves like liftShowsPrec2 (without requiring a Show2 instance).

This function is not available with transformers-0.4.

makeLiftShowsPrec2Options :: ShowOptions -> Name -> Q Exp Source #

Like makeLiftShowsPrec2, but takes a ShowOptions argument.

This function is not available with transformers-0.4.

makeLiftShowList2 :: Name -> Q Exp Source #

Generates a lambda expression which behaves like liftShowList2 (without requiring a ShowClass instance).

This function is not available with transformers-0.4.

makeLiftShowList2Options :: ShowOptions -> Name -> Q Exp Source #

Like makeLiftShowList2, but takes a ShowOptions argument.

This function is not available with transformers-0.4.

makeShowsPrec2 :: Name -> Q Exp Source #

Generates a lambda expression which behaves like showsPrec2 (without requiring a Show2 instance).

This function is not available with transformers-0.4.

makeShowsPrec2Options :: ShowOptions -> Name -> Q Exp Source #

Like makeShowsPrec2, but takes a ShowOptions argument.

This function is not available with transformers-0.4.

ShowOptions

data ShowOptions Source #

Options that further configure how the functions in Text.Show.Deriving should behave.

Constructors

ShowOptions 

Fields

  • ghc8ShowBehavior :: Bool

    If True, the derived ShowClass, 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 (#).

  • showEmptyCaseBehavior :: Bool

    If True, derived instances for empty data types (i.e., ones with no data constructors) will use the EmptyCase language extension. If False, derived instances will simply use seq instead. (This has no effect on GHCs before 7.8, since EmptyCase is only available in 7.8 or later.)

defaultShowOptions :: ShowOptions Source #

ShowOptions that match the behavior of the most recent GHC release.

legacyShowOptions :: ShowOptions Source #

ShowOptions that match the behavior of the installed version of GHC.