summaryrefslogtreecommitdiff
path: root/compiler/prelude/PrelNames.lhs
diff options
context:
space:
mode:
authorIavor S. Diatchki <diatchki@galois.com>2013-10-09 19:22:35 -0700
committerIavor S. Diatchki <diatchki@galois.com>2013-10-09 19:26:41 -0700
commitc3762fa4d0156ba0446cee92a035b6454a62a1ae (patch)
tree8b98516667744d514cb98f9defd43ec8bbec99df /compiler/prelude/PrelNames.lhs
parenta83652ed4aee321063c17df1ad8560712b33103a (diff)
downloadhaskell-c3762fa4d0156ba0446cee92a035b6454a62a1ae.tar.gz
Update and clean-up the implmenation of GHC.TypeLits
* Replace class `SingI` with two separate classes: `KnownNat` and `KnownSymbol` * Rename `magicSingId` to `magicDictId`. * Simplify and clean-up the "magic" implementation. This version makes a lot more sense, at least to me :-) * Update notes about how it all works: Note [KnownNat & KnownSymbol and EvLit] explains the evidence for the built-in classes Note [magicDictId magic] explains how we coerce singleton values into dictionaries. This is used to turn run-time integers and strings into Proxy singletons of unknwon type (using an existential).
Diffstat (limited to 'compiler/prelude/PrelNames.lhs')
-rw-r--r--compiler/prelude/PrelNames.lhs22
1 files changed, 14 insertions, 8 deletions
diff --git a/compiler/prelude/PrelNames.lhs b/compiler/prelude/PrelNames.lhs
index a176cb6e75..7d156146b6 100644
--- a/compiler/prelude/PrelNames.lhs
+++ b/compiler/prelude/PrelNames.lhs
@@ -294,7 +294,7 @@ basicKnownKeyNames
randomClassName, randomGenClassName, monadPlusClassName,
-- Type-level naturals
- singIClassName,
+ knownNatClassName, knownSymbolClassName,
-- Implicit parameters
ipClassName,
@@ -1137,8 +1137,10 @@ randomGenClassName = clsQual rANDOM (fsLit "RandomGen") randomGenClassKey
isStringClassName = clsQual dATA_STRING (fsLit "IsString") isStringClassKey
-- Type-level naturals
-singIClassName :: Name
-singIClassName = clsQual gHC_TYPELITS (fsLit "SingI") singIClassNameKey
+knownNatClassName :: Name
+knownNatClassName = clsQual gHC_TYPELITS (fsLit "KnownNat") knownNatClassNameKey
+knownSymbolClassName :: Name
+knownSymbolClassName = clsQual gHC_TYPELITS (fsLit "KnownSymbol") knownSymbolClassNameKey
-- Implicit parameters
ipClassName :: Name
@@ -1260,9 +1262,13 @@ datatypeClassKey = mkPreludeClassUnique 39
constructorClassKey = mkPreludeClassUnique 40
selectorClassKey = mkPreludeClassUnique 41
--- SingI: see Note [SingI and EvLit] in TcEvidence
-singIClassNameKey :: Unique
-singIClassNameKey = mkPreludeClassUnique 42
+-- KnownNat: see Note [KnowNat & KnownSymbol and EvLit] in TcEvidence
+knownNatClassNameKey :: Unique
+knownNatClassNameKey = mkPreludeClassUnique 42
+
+-- KnownSymbol: see Note [KnownNat & KnownSymbol and EvLit] in TcEvidence
+knownSymbolClassNameKey :: Unique
+knownSymbolClassNameKey = mkPreludeClassUnique 43
ghciIoClassKey :: Unique
ghciIoClassKey = mkPreludeClassUnique 44
@@ -1713,8 +1719,8 @@ checkDotnetResNameIdKey = mkPreludeMiscIdUnique 154
undefinedKey :: Unique
undefinedKey = mkPreludeMiscIdUnique 155
-magicSingIKey :: Unique
-magicSingIKey = mkPreludeMiscIdUnique 156
+magicDictKey :: Unique
+magicDictKey = mkPreludeMiscIdUnique 156
coerceKey :: Unique
coerceKey = mkPreludeMiscIdUnique 157