HORIZON HASKELLDocslts/ghc-9.14.xd82dee82026-10-12Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · d82dee8 · 2026-10-12

Modulederiving-compat-0.6.8Haskell2010

Text.Show.Deriving

Exports functions to mechanically derive Show, Show1, and Show2 instances. Note that upstream GHC does not have the ability to derive Show1 or Show2 instances, but since the functionality to derive Show extends very naturally Show1 and Show2, the ability to derive the latter two classes is provided as a convenience.

  • 1 type
  • 26 values

Show

8 declarations
valuederiveShow :: Name -> Q [Dec]
#

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

valuemakeShow :: Name -> Q Exp
#

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

Show1

8 declarations
valuederiveShow1 :: Name -> Q [Dec]
#

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

valuemakeLiftShowsPrec :: Name -> Q Exp
#

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

This function is not available with transformers-0.4.

valuemakeLiftShowList :: 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.

valuemakeShowsPrec1 :: Name -> Q Exp
#

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

Show2

8 declarations
valuederiveShow2 :: Name -> Q [Dec]
#

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

This function is not available with transformers-0.4.

valuemakeLiftShowsPrec2 :: Name -> Q Exp
#

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

This function is not available with transformers-0.4.

valuemakeLiftShowList2 :: 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.

valuemakeShowsPrec2 :: 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.

ShowOptions

3 declarations
datadata ShowOptions
#

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

Constructors

  • ShowOptions
    • ghc8ShowBehavior :: Bool

      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 (#).

    • 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.)

Instances4Eq, Ord, Read, Show
  • Eq ShowOptionsDefined in deriving-compat-0.6.8 · Text.Show.Deriving.Internal
  • Ord ShowOptionsDefined in deriving-compat-0.6.8 · Text.Show.Deriving.Internal
  • Read ShowOptionsDefined in deriving-compat-0.6.8 · Text.Show.Deriving.Internal
  • Show ShowOptionsDefined in deriving-compat-0.6.8 · Text.Show.Deriving.Internal

deriveShow limitations

0 declarations

Be aware of the following potential gotchas:

  • Type variables of kind * are assumed to have Show constraints. Type variables of kind * -> * are assumed to have Show1 constraints. Type variables of kind * -> * -> * are assumed to have Show2 constraints. If this is not desirable, use makeShowsPrec or one of its cousins.

  • The Show1 class had a different definition in transformers-0.4, and as a result, deriveShow1 implements different instances for the transformers-0.4 Show1 than it otherwise does. Also, makeLiftShowsPrec and makeLiftShowList are not available when this library is built against transformers-0.4, only 'makeShowsPrec1.

  • The Show2 class is not available in transformers-0.4, and as a result, neither are Template Haskell functions that deal with Show2 when this library is built against transformers-0.4.