summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2020-06-13 23:28:11 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-06-15 13:11:20 -0400
commitcf01477f03da13caaf78caacc5b001cb46a86685 (patch)
treecc4afae8540224c7337db4a328270fdd4c98df7a /compiler/GHC/Tc
parent761dcb84cd4c50c6fbb361eb26fb429af87392a3 (diff)
downloadhaskell-cf01477f03da13caaf78caacc5b001cb46a86685.tar.gz
User's Guide: KnownNat evidence is Natural
This bit of documentation got outdated after commit 1fcede43d2b30f33b7505e25eb6b1f321be0407f
Diffstat (limited to 'compiler/GHC/Tc')
-rw-r--r--compiler/GHC/Tc/Instance/Class.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/GHC/Tc/Instance/Class.hs b/compiler/GHC/Tc/Instance/Class.hs
index 43c2092c70..aec5c85e20 100644
--- a/compiler/GHC/Tc/Instance/Class.hs
+++ b/compiler/GHC/Tc/Instance/Class.hs
@@ -259,12 +259,12 @@ Note [KnownNat & KnownSymbol and EvLit]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A part of the type-level literals implementation are the classes
"KnownNat" and "KnownSymbol", which provide a "smart" constructor for
-defining singleton values. Here is the key stuff from GHC.TypeLits
+defining singleton values. Here is the key stuff from GHC.TypeNats
class KnownNat (n :: Nat) where
natSing :: SNat n
- newtype SNat (n :: Nat) = SNat Integer
+ newtype SNat (n :: Nat) = SNat Natural
Conceptually, this class has infinitely many instances:
@@ -291,10 +291,10 @@ Also note that `natSing` and `SNat` are never actually exposed from the
library---they are just an implementation detail. Instead, users see
a more convenient function, defined in terms of `natSing`:
- natVal :: KnownNat n => proxy n -> Integer
+ natVal :: KnownNat n => proxy n -> Natural
The reason we don't use this directly in the class is that it is simpler
-and more efficient to pass around an integer rather than an entire function,
+and more efficient to pass around a Natural rather than an entire function,
especially when the `KnowNat` evidence is packaged up in an existential.
The story for kind `Symbol` is analogous: