| Copyright | (C) 2015-2017 Ryan Scott | 
|---|---|
| License | BSD-style (see the file LICENSE) | 
| Maintainer | Ryan Scott | 
| Portability | Template Haskell | 
| Safe Haskell | None | 
| Language | Haskell2010 | 
Text.Show.Deriving
Description
Exports functions to mechanically derive Show, Show1, and Show2 instances.
Synopsis
- deriveShow :: Name -> Q [Dec]
 - deriveShowOptions :: ShowOptions -> Name -> Q [Dec]
 - makeShowsPrec :: Name -> Q Exp
 - makeShowsPrecOptions :: ShowOptions -> Name -> Q Exp
 - makeShow :: Name -> Q Exp
 - makeShowOptions :: ShowOptions -> Name -> Q Exp
 - makeShowList :: Name -> Q Exp
 - makeShowListOptions :: ShowOptions -> Name -> Q Exp
 - deriveShow1 :: Name -> Q [Dec]
 - deriveShow1Options :: ShowOptions -> Name -> Q [Dec]
 - makeLiftShowsPrec :: Name -> Q Exp
 - makeLiftShowsPrecOptions :: ShowOptions -> Name -> Q Exp
 - makeLiftShowList :: Name -> Q Exp
 - makeLiftShowListOptions :: ShowOptions -> Name -> Q Exp
 - makeShowsPrec1 :: Name -> Q Exp
 - makeShowsPrec1Options :: ShowOptions -> Name -> Q Exp
 - deriveShow2 :: Name -> Q [Dec]
 - deriveShow2Options :: ShowOptions -> Name -> Q [Dec]
 - makeLiftShowsPrec2 :: Name -> Q Exp
 - makeLiftShowsPrec2Options :: ShowOptions -> Name -> Q Exp
 - makeLiftShowList2 :: Name -> Q Exp
 - makeLiftShowList2Options :: ShowOptions -> Name -> Q Exp
 - makeShowsPrec2 :: Name -> Q Exp
 - makeShowsPrec2Options :: ShowOptions -> Name -> Q Exp
 - data ShowOptions = ShowOptions {}
 - defaultShowOptions :: ShowOptions
 - legacyShowOptions :: ShowOptions
 
Show
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).
makeShowsPrecOptions :: ShowOptions -> Name -> Q Exp Source #
Like makeShowsPrec, but takes a ShowOptions argument.
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).
makeShowListOptions :: ShowOptions -> Name -> Q Exp Source #
Like makeShowList, but takes a ShowOptions argument.
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).
makeShowsPrec1Options :: ShowOptions -> Name -> Q Exp Source #
Like makeShowsPrec1, but takes a ShowOptions argument.
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 
  | |
Instances
| Eq ShowOptions Source # | |
Defined in Text.Show.Deriving.Internal  | |
| Ord ShowOptions Source # | |
Defined in Text.Show.Deriving.Internal Methods compare :: ShowOptions -> ShowOptions -> Ordering # (<) :: ShowOptions -> ShowOptions -> Bool # (<=) :: ShowOptions -> ShowOptions -> Bool # (>) :: ShowOptions -> ShowOptions -> Bool # (>=) :: ShowOptions -> ShowOptions -> Bool # max :: ShowOptions -> ShowOptions -> ShowOptions # min :: ShowOptions -> ShowOptions -> ShowOptions #  | |
| Read ShowOptions Source # | |
Defined in Text.Show.Deriving.Internal Methods readsPrec :: Int -> ReadS ShowOptions # readList :: ReadS [ShowOptions] # readPrec :: ReadPrec ShowOptions # readListPrec :: ReadPrec [ShowOptions] #  | |
| Show ShowOptions Source # | |
Defined in Text.Show.Deriving.Internal Methods showsPrec :: Int -> ShowOptions -> ShowS # show :: ShowOptions -> String # showList :: [ShowOptions] -> ShowS #  | |
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.
deriveShow limitations
Be aware of the following potential gotchas:
- Type variables of kind 
*are assumed to haveShowconstraints. Type variables of kind* -> *are assumed to haveShow1constraints. Type variables of kind* -> * -> *are assumed to haveShow2constraints. If this is not desirable, usemakeShowsPrecor one of its cousins. - The 
Show1class had a different definition intransformers-0.4, and as a result,deriveShow1implements different instances for thetransformers-0.4Show1than it otherwise does. Also,makeLiftShowsPrecandmakeLiftShowListare not available when this library is built againsttransformers-0.4, only 'makeShowsPrec1. - The 
Show2class is not available intransformers-0.4, and as a result, neither are Template Haskell functions that deal withShow2when this library is built againsttransformers-0.4.