summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorIavor S. Diatchki <iavor.diatchki@gmail.com>2015-06-21 12:24:42 -0700
committerIavor S. Diatchki <iavor.diatchki@gmail.com>2015-06-21 12:25:24 -0700
commit4854fcea4f73897bbdcdfede382c826da7b64b97 (patch)
tree433dda51f7cde892030bb3c98b54e792d578275e /libraries
parent13ba87f8a28154e33b5b6d6b8302e18f7c56760b (diff)
downloadhaskell-4854fcea4f73897bbdcdfede382c826da7b64b97.tar.gz
Change `Typeable` instance for type-lis to use the Known* classes.
This should fix T10348
Diffstat (limited to 'libraries')
-rw-r--r--libraries/base/Data/Typeable/Internal.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs
index 477247384d..e35d794a62 100644
--- a/libraries/base/Data/Typeable/Internal.hs
+++ b/libraries/base/Data/Typeable/Internal.hs
@@ -51,12 +51,14 @@ module Data.Typeable.Internal (
rnfTyCon,
listTc, funTc,
typeRepKinds,
- typeLitTypeRep
+ typeNatTypeRep,
+ typeSymbolTypeRep
) where
import GHC.Base
import GHC.Word
import GHC.Show
+import GHC.TypeLits
import Data.Proxy
import GHC.Fingerprint.Type
@@ -330,6 +332,13 @@ funTc :: TyCon
funTc = typeRepTyCon (typeRep (Proxy :: Proxy (->)))
+-- | Used to make `'Typeable' instance for things of kind Nat
+typeNatTypeRep :: KnownNat a => Proxy# a -> TypeRep
+typeNatTypeRep p = typeLitTypeRep (show (natVal' p))
+
+-- | Used to make `'Typeable' instance for things of kind Symbol
+typeSymbolTypeRep :: KnownSymbol a => Proxy# a -> TypeRep
+typeSymbolTypeRep p = typeLitTypeRep (show (symbolVal' p))
-- | An internal function, to make representations for type literals.
typeLitTypeRep :: String -> TypeRep