summaryrefslogtreecommitdiff
path: root/libraries/template-haskell/Language/Haskell
diff options
context:
space:
mode:
authorDaniel Rogozin <daniel.rogozin@serokell.io>2020-05-27 13:35:24 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-02-06 09:26:51 -0500
commit7f3524efcbd58ca6837ec0ffca6ddd121d64e4de (patch)
treeaa296d28ed6475799ef369b0608736afcb467495 /libraries/template-haskell/Language/Haskell
parent640a3ece333d1b0d0af8f353c3e1df9dd0cb9ef3 (diff)
downloadhaskell-7f3524efcbd58ca6837ec0ffca6ddd121d64e4de.tar.gz
The Char kind (#11342)
Co-authored-by: Rinat Stryungis <rinat.stryungis@serokell.io> Implement GHC Proposal #387 * Parse char literals 'x' at the type level * New built-in type families CmpChar, ConsSymbol, UnconsSymbol * New KnownChar class (cf. KnownSymbol and KnownNat) * New SomeChar type (cf. SomeSymbol and SomeNat) * CharTyLit support in template-haskell Updated submodules: binary, haddock. Metric Decrease: T5205 haddock.base Metric Increase: Naperian T13035
Diffstat (limited to 'libraries/template-haskell/Language/Haskell')
-rw-r--r--libraries/template-haskell/Language/Haskell/TH/Lib.hs2
-rw-r--r--libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs3
-rw-r--r--libraries/template-haskell/Language/Haskell/TH/Ppr.hs1
-rw-r--r--libraries/template-haskell/Language/Haskell/TH/Syntax.hs1
4 files changed, 6 insertions, 1 deletions
diff --git a/libraries/template-haskell/Language/Haskell/TH/Lib.hs b/libraries/template-haskell/Language/Haskell/TH/Lib.hs
index 1f8175a735..3e05081619 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Lib.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Lib.hs
@@ -61,7 +61,7 @@ module Language.Haskell.TH.Lib (
sigT, litT, wildCardT, promotedT, promotedTupleT, promotedNilT,
promotedConsT, implicitParamT,
-- **** Type literals
- numTyLit, strTyLit,
+ numTyLit, strTyLit, charTyLit,
-- **** Strictness
noSourceUnpackedness, sourceNoUnpack, sourceUnpack,
noSourceStrictness, sourceLazy, sourceStrict,
diff --git a/libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs b/libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs
index ed1aa022c5..67017d4926 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs
@@ -832,6 +832,9 @@ numTyLit n = if n >= 0 then pure (NumTyLit n)
strTyLit :: Quote m => String -> m TyLit
strTyLit s = pure (StrTyLit s)
+charTyLit :: Quote m => Char -> m TyLit
+charTyLit c = pure (CharTyLit c)
+
-------------------------------------------------------------------------------
-- * Kind
diff --git a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs
index b19c74f6fb..54f138539f 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs
@@ -869,6 +869,7 @@ split t = go t []
pprTyLit :: TyLit -> Doc
pprTyLit (NumTyLit n) = integer n
pprTyLit (StrTyLit s) = text (show s)
+pprTyLit (CharTyLit c) = text (show c)
instance Ppr TyLit where
ppr = pprTyLit
diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
index a3104ed684..6508c07a65 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
@@ -2562,6 +2562,7 @@ data InjectivityAnn = InjectivityAnn Name [Name]
data TyLit = NumTyLit Integer -- ^ @2@
| StrTyLit String -- ^ @\"Hello\"@
+ | CharTyLit Char -- ^ @\'C\'@, @since 4.16.0.0
deriving ( Show, Eq, Ord, Data, Generic )
-- | Role annotations