Copyright | (C) 2014 Ryan Scott |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Ryan Scott |
Stability | Experimental |
Portability | GHC |
Safe Haskell | None |
Language | Haskell98 |
Exports deriveShow
, which automatically derives a Show
instance for a
data
type or newtype
. You need to enable the TemplateHaskell
language extension in order to use deriveShow
.
As an example:
{-# LANGUAGE TemplateHaskell #-} import Text.Show.Text.TH (deriveShow) data D a = Nullary | Unary Int | Product String Char a | Record { testOne :: Double , testTwo :: Bool , testThree :: D a } $(deriveShow ''D)
D
now has a Show
instance equivalent to that which would be generated
by a deriving Show
clause.
Note that at the moment, deriveShow
does not support data families,
so it is impossible to use deriveShow
with data instance
s or newtype
instance
s.
- deriveShow :: Name -> Q [Dec]