[Git][ghc/ghc][wip/T23478] Move definitions of SNat, SChar and SSymbol to ghc-internal

Oleg Grenrus (@phadej) gitlab at gitlab.haskell.org
Fri Dec 8 19:23:26 UTC 2023



Oleg Grenrus pushed to branch wip/T23478 at Glasgow Haskell Compiler / GHC


Commits:
413e4e47 by Oleg Grenrus at 2023-12-08T21:23:14+02:00
Move definitions of SNat, SChar and SSymbol to ghc-internal

... and expose their constructors there

- - - - -


12 changed files:

- libraries/base/src/GHC/TypeLits.hs
- libraries/base/src/GHC/TypeNats.hs
- libraries/ghc-internal/ghc-internal.cabal
- − libraries/ghc-internal/src/Dummy.hs
- + libraries/ghc-internal/src/GHC/Internal/TypeLits.hs
- + libraries/ghc-internal/src/GHC/Internal/TypeNats.hs
- testsuite/tests/ghci/scripts/T9181.stdout
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/plugins/plugins09.stdout
- testsuite/tests/plugins/plugins10.stdout
- testsuite/tests/plugins/plugins11.stdout
- testsuite/tests/plugins/static-plugins.stdout


Changes:

=====================================
libraries/base/src/GHC/TypeLits.hs
=====================================
@@ -17,6 +17,9 @@
 {-# LANGUAGE ViewPatterns #-}
 {-# LANGUAGE RoleAnnotations #-}
 
+-- orphan instances for SChar and SSymbol
+{-# OPTIONS_GHC -Wno-orphans #-}
+
 {-|
 GHC's @DataKinds@ language extension lifts data constructors, natural
 numbers, and strings to the type level. This module provides the
@@ -69,7 +72,7 @@ module GHC.TypeLits
 
   ) where
 
-import GHC.Base ( Bool(..), Eq(..), Functor(..), Ord(..), Ordering(..), String
+import GHC.Base ( Eq(..), Functor(..), Ord(..), Ordering(..), String
                 , (.), otherwise, withDict, Void, (++)
                 , errorWithoutStackTrace)
 import GHC.Types(Symbol, Char, TYPE)
@@ -90,6 +93,8 @@ import Unsafe.Coerce(unsafeCoerce)
 import GHC.TypeLits.Internal(CmpSymbol, CmpChar)
 import qualified GHC.TypeNats as N
 
+import GHC.Internal.TypeLits
+
 --------------------------------------------------------------------------------
 
 -- | This class gives the string associated with a type-level symbol.
@@ -325,24 +330,6 @@ withSomeSNat n k
   | n >= 0    = N.withSomeSNat (fromInteger n) (\sn -> k (Just sn))
   | otherwise = k Nothing
 
--- | A value-level witness for a type-level symbol. This is commonly referred
--- to as a /singleton/ type, as for each @s@, there is a single value that
--- inhabits the type @'SSymbol' s@ (aside from bottom).
---
--- The definition of 'SSymbol' is intentionally left abstract. To obtain an
--- 'SSymbol' value, use one of the following:
---
--- 1. The 'symbolSing' method of 'KnownSymbol'.
---
--- 2. The @SSymbol@ pattern synonym.
---
--- 3. The 'withSomeSSymbol' function, which creates an 'SSymbol' from a
---    'String'.
---
--- @since 4.18.0.0
-newtype SSymbol (s :: Symbol) = UnsafeSSymbol String
-type role SSymbol nominal
-
 -- | A explicitly bidirectional pattern synonym relating an 'SSymbol' to a
 -- 'KnownSymbol' constraint.
 --
@@ -377,14 +364,6 @@ data KnownSymbolInstance (s :: Symbol) where
 knownSymbolInstance :: SSymbol s -> KnownSymbolInstance s
 knownSymbolInstance ss = withKnownSymbol ss KnownSymbolInstance
 
--- | @since 4.19.0.0
-instance Eq (SSymbol s) where
-  _ == _ = True
-
--- | @since 4.19.0.0
-instance Ord (SSymbol s) where
-  compare _ _ = EQ
-
 -- | @since 4.18.0.0
 instance Show (SSymbol s) where
   showsPrec p (UnsafeSSymbol s)
@@ -429,22 +408,7 @@ withSomeSSymbol s k = k (UnsafeSSymbol s)
 -- For details see Note [NOINLINE withSomeSNat] in "GHC.TypeNats"
 -- The issue described there applies to `withSomeSSymbol` as well.
 
--- | A value-level witness for a type-level character. This is commonly referred
--- to as a /singleton/ type, as for each @c@, there is a single value that
--- inhabits the type @'SChar' c@ (aside from bottom).
---
--- The definition of 'SChar' is intentionally left abstract. To obtain an
--- 'SChar' value, use one of the following:
---
--- 1. The 'charSing' method of 'KnownChar'.
---
--- 2. The @SChar@ pattern synonym.
---
--- 3. The 'withSomeSChar' function, which creates an 'SChar' from a 'Char'.
---
--- @since 4.18.0.0
-newtype SChar (s :: Char) = UnsafeSChar Char
-type role SChar nominal
+
 
 -- | A explicitly bidirectional pattern synonym relating an 'SChar' to a
 -- 'KnownChar' constraint.
@@ -480,14 +444,6 @@ data KnownCharInstance (n :: Char) where
 knownCharInstance :: SChar c -> KnownCharInstance c
 knownCharInstance sc = withKnownChar sc KnownCharInstance
 
--- | @since 4.19.0.0
-instance Eq (SChar c) where
-  _ == _ = True
-
--- | @since 4.19.0.0
-instance Ord (SChar c) where
-  compare _ _ = EQ
-
 -- | @since 4.18.0.0
 instance Show (SChar c) where
   showsPrec p (UnsafeSChar c)


=====================================
libraries/base/src/GHC/TypeNats.hs
=====================================
@@ -18,6 +18,9 @@
 {-# LANGUAGE ViewPatterns #-}
 {-# LANGUAGE RoleAnnotations #-}
 
+-- orphan instances for SNat
+{-# OPTIONS_GHC -Wno-orphans #-}
+
 {-| This module is an internal GHC module.  It declares the constants used
 in the implementation of type-level natural numbers.  The programmer interface
 for working with type-level naturals should be defined in a separate library.
@@ -67,6 +70,8 @@ import Unsafe.Coerce(unsafeCoerce)
 
 import GHC.TypeNats.Internal(CmpNat)
 
+import GHC.Internal.TypeNats
+
 -- | A type synonym for 'Natural'.
 --
 -- Previously, this was an opaque data type, but it was changed to a type
@@ -329,23 +334,7 @@ cmpNat x y = case compare (natVal x) (natVal y) of
 --------------------------------------------------------------------------------
 -- Singleton values
 
--- | A value-level witness for a type-level natural number. This is commonly
--- referred to as a /singleton/ type, as for each @n@, there is a single value
--- that inhabits the type @'SNat' n@ (aside from bottom).
---
--- The definition of 'SNat' is intentionally left abstract. To obtain an 'SNat'
--- value, use one of the following:
---
--- 1. The 'natSing' method of 'KnownNat'.
---
--- 2. The @SNat@ pattern synonym.
---
--- 3. The 'withSomeSNat' function, which creates an 'SNat' from a 'Natural'
---    number.
---
--- @since 4.18.0.0
-newtype SNat (n :: Nat) = UnsafeSNat Natural
-type role SNat nominal
+
 
 -- | A explicitly bidirectional pattern synonym relating an 'SNat' to a
 -- 'KnownNat' constraint.
@@ -381,14 +370,6 @@ data KnownNatInstance (n :: Nat) where
 knownNatInstance :: SNat n -> KnownNatInstance n
 knownNatInstance sn = withKnownNat sn KnownNatInstance
 
--- | @since 4.19.0.0
-instance Eq (SNat n) where
-  _ == _ = True
-
--- | @since 4.19.0.0
-instance Ord (SNat n) where
-  compare _ _ = EQ
-
 -- | @since 4.18.0.0
 instance Show (SNat n) where
   showsPrec p (UnsafeSNat n)


=====================================
libraries/ghc-internal/ghc-internal.cabal
=====================================
@@ -23,9 +23,10 @@ common warnings
 
 library
     import:           warnings
+
     exposed-modules:
-    other-modules:    Dummy
-    other-extensions:
+        GHC.Internal.TypeLits
+        GHC.Internal.TypeNats
     build-depends:    rts == 1.0.*,
                       ghc-prim >= 0.5.1.0 && < 0.11,
                       ghc-bignum >= 1.0 && < 2.0


=====================================
libraries/ghc-internal/src/Dummy.hs deleted
=====================================
@@ -1,11 +0,0 @@
-{-# LANGUAGE NoImplicitPrelude #-}
-
--- | This module merely serves as a placeholder since
--- Haskell packages must contain at least one module.
--- This can be dropped once a real module has been introduced to
--- @ghc-internal at .
-module Dummy () where
-
--- for build system dependency ordering
-import GHC.Types ()
-import GHC.Num.BigNat ()


=====================================
libraries/ghc-internal/src/GHC/Internal/TypeLits.hs
=====================================
@@ -0,0 +1,74 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE KindSignatures #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE RoleAnnotations #-}
+{-# LANGUAGE PatternSynonyms #-}
+module GHC.Internal.TypeLits (
+  SChar (UnsafeSChar),
+  SSymbol (UnsafeSSymbol),
+) where
+
+import GHC.Types (Char, Symbol, Bool (..), Ordering (..))
+import GHC.Classes (Eq (..), Ord (..))
+import GHC.Num.Integer () -- Note [Depend on GHC.Num.Integer] in GHC.Base
+
+-- | A value-level witness for a type-level character. This is commonly referred
+-- to as a /singleton/ type, as for each @c@, there is a single value that
+-- inhabits the type @'SChar' c@ (aside from bottom).
+--
+-- The definition of 'SChar' is intentionally left abstract. To obtain an
+-- 'SChar' value, use one of the following:
+--
+-- 1. The 'charSing' method of 'KnownChar'.
+--
+-- 2. The @SChar@ pattern synonym.
+--
+-- 3. The 'withSomeSChar' function, which creates an 'SChar' from a 'Char'.
+--
+-- /since base-4.18.0.0/
+newtype SChar (s :: Char) = UnsafeSChar_ Char
+type role SChar nominal
+
+-- See Note [SNat constructor] in GHC.Internal.TypeNats
+pattern UnsafeSChar :: Char -> SChar n
+pattern UnsafeSChar c = UnsafeSChar_ c
+{-# COMPLETE UnsafeSChar #-}
+
+-- | /since base-4.19.0.0/
+instance Eq (SChar c) where
+  _ == _ = True
+
+-- | /since base-4.19.0.0/
+instance Ord (SChar c) where
+  compare _ _ = EQ
+
+-- | A value-level witness for a type-level symbol. This is commonly referred
+-- to as a /singleton/ type, as for each @s@, there is a single value that
+-- inhabits the type @'SSymbol' s@ (aside from bottom).
+--
+-- The definition of 'SSymbol' is intentionally left abstract. To obtain an
+-- 'SSymbol' value, use one of the following:
+--
+-- 1. The 'symbolSing' method of 'KnownSymbol'.
+--
+-- 2. The @SSymbol@ pattern synonym.
+--
+-- 3. The 'withSomeSSymbol' function, which creates an 'SSymbol' from a
+--    'String'.
+--
+-- /since base-4.18.0.0/
+newtype SSymbol (s :: Symbol) = UnsafeSSymbol_ [Char]
+type role SSymbol nominal
+
+-- See Note [SNat constructor] in GHC.Internal.TypeNats
+pattern UnsafeSSymbol :: [Char] -> SSymbol n
+pattern UnsafeSSymbol s = UnsafeSSymbol_ s
+{-# COMPLETE UnsafeSSymbol #-}
+
+-- | /since base-4.19.0.0/
+instance Eq (SSymbol s) where
+  _ == _ = True
+
+-- | /since base-4.19.0.0/
+instance Ord (SSymbol s) where
+  compare _ _ = EQ


=====================================
libraries/ghc-internal/src/GHC/Internal/TypeNats.hs
=====================================
@@ -0,0 +1,55 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE KindSignatures #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE RoleAnnotations #-}
+{-# LANGUAGE PatternSynonyms #-}
+module GHC.Internal.TypeNats (
+  SNat (UnsafeSNat),
+)where
+
+import GHC.Num.Natural(Natural)
+import GHC.Types (Bool (..), Ordering (..))
+import GHC.Classes (Eq (..), Ord (..))
+import GHC.Num.Integer () -- Note [Depend on GHC.Num.Integer] in GHC.Base
+
+-- | A value-level witness for a type-level natural number. This is commonly
+-- referred to as a /singleton/ type, as for each @n@, there is a single value
+-- that inhabits the type @'SNat' n@ (aside from bottom).
+--
+-- The definition of 'SNat' is intentionally left abstract. To obtain an 'SNat'
+-- value, use one of the following:
+--
+-- 1. The 'natSing' method of 'KnownNat'.
+--
+-- 2. The @SNat@ pattern synonym.
+--
+-- 3. The 'withSomeSNat' function, which creates an 'SNat' from a 'Natural'
+--    number.
+--
+-- /since base-4.18.0.0/
+--
+newtype SNat (n :: Natural) = UnsafeSNat_ Natural
+type role SNat nominal
+
+-- See Note [SNat constructor]
+pattern UnsafeSNat :: Natural -> SNat n
+pattern UnsafeSNat n = UnsafeSNat_ n
+{-# COMPLETE UnsafeSNat #-}
+
+-- | /since base-4.19.0.0/
+instance Eq (SNat n) where
+  _ == _ = True
+
+-- | /since 4.19.0.0/
+instance Ord (SNat n) where
+  compare _ _ = EQ
+
+{-
+Note [SNat constructor]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+There is a concern raised that having the real constructor of SNat exposed may
+allow accidental 'coerce'.  To avoid that, we define a pattern synonym. It
+looks like real constructor, but prevents from coercing SNats when
+(pseudo)constructor is in scope.
+
+-}


=====================================
testsuite/tests/ghci/scripts/T9181.stdout
=====================================
@@ -8,24 +8,20 @@ type GHC.TypeLits.ConsSymbol :: Char
 type family GHC.TypeLits.ConsSymbol a b
 type GHC.TypeLits.KnownChar :: Char -> Constraint
 class GHC.TypeLits.KnownChar n where
-  GHC.TypeLits.charSing :: GHC.TypeLits.SChar n
+  GHC.TypeLits.charSing :: GHC.Internal.TypeLits.SChar n
   {-# MINIMAL charSing #-}
 type GHC.TypeLits.KnownSymbol :: GHC.Types.Symbol -> Constraint
 class GHC.TypeLits.KnownSymbol n where
-  GHC.TypeLits.symbolSing :: GHC.TypeLits.SSymbol n
+  GHC.TypeLits.symbolSing :: GHC.Internal.TypeLits.SSymbol n
   {-# MINIMAL symbolSing #-}
 type GHC.TypeLits.NatToChar :: GHC.Num.Natural.Natural -> Char
 type family GHC.TypeLits.NatToChar a
 pattern GHC.TypeLits.SChar
-  :: () => GHC.TypeLits.KnownChar c => GHC.TypeLits.SChar c
-type role GHC.TypeLits.SChar nominal
-type GHC.TypeLits.SChar :: Char -> *
-newtype GHC.TypeLits.SChar s = GHC.TypeLits.UnsafeSChar Char
+  :: () => GHC.TypeLits.KnownChar c => GHC.Internal.TypeLits.SChar c
 pattern GHC.TypeLits.SSymbol
-  :: () => GHC.TypeLits.KnownSymbol s => GHC.TypeLits.SSymbol s
-type role GHC.TypeLits.SSymbol nominal
-type GHC.TypeLits.SSymbol :: GHC.Types.Symbol -> *
-newtype GHC.TypeLits.SSymbol s = GHC.TypeLits.UnsafeSSymbol String
+  :: () =>
+     GHC.TypeLits.KnownSymbol s =>
+     GHC.Internal.TypeLits.SSymbol s
 type GHC.TypeLits.SomeChar :: *
 data GHC.TypeLits.SomeChar
   = forall (n :: Char).
@@ -62,9 +58,10 @@ GHC.TypeLits.decideSymbol ::
   -> Either
        ((a Data.Type.Equality.:~: b) -> GHC.Base.Void)
        (a Data.Type.Equality.:~: b)
-GHC.TypeLits.fromSChar :: GHC.TypeLits.SChar c -> Char
-GHC.TypeLits.fromSNat :: GHC.TypeNats.SNat n -> Integer
-GHC.TypeLits.fromSSymbol :: GHC.TypeLits.SSymbol s -> String
+GHC.TypeLits.fromSChar :: GHC.Internal.TypeLits.SChar c -> Char
+GHC.TypeLits.fromSNat :: GHC.Internal.TypeNats.SNat n -> Integer
+GHC.TypeLits.fromSSymbol ::
+  GHC.Internal.TypeLits.SSymbol s -> String
 GHC.TypeLits.natVal ::
   GHC.TypeNats.KnownNat n => proxy n -> Integer
 GHC.TypeLits.natVal' ::
@@ -83,19 +80,23 @@ GHC.TypeLits.symbolVal ::
 GHC.TypeLits.symbolVal' ::
   GHC.TypeLits.KnownSymbol n => GHC.Prim.Proxy# n -> String
 GHC.TypeLits.withKnownChar ::
-  GHC.TypeLits.SChar c -> (GHC.TypeLits.KnownChar c => r) -> r
+  GHC.Internal.TypeLits.SChar c
+  -> (GHC.TypeLits.KnownChar c => r) -> r
 GHC.TypeLits.withKnownSymbol ::
-  GHC.TypeLits.SSymbol s -> (GHC.TypeLits.KnownSymbol s => r) -> r
+  GHC.Internal.TypeLits.SSymbol s
+  -> (GHC.TypeLits.KnownSymbol s => r) -> r
 GHC.TypeLits.withSomeSChar ::
-  Char -> (forall (c :: Char). GHC.TypeLits.SChar c -> r) -> r
+  Char
+  -> (forall (c :: Char). GHC.Internal.TypeLits.SChar c -> r) -> r
 GHC.TypeLits.withSomeSNat ::
   Integer
-  -> (forall (n :: GHC.TypeNats.Nat).
-      Maybe (GHC.TypeNats.SNat n) -> r)
+  -> (forall (n :: GHC.Num.Natural.Natural).
+      Maybe (GHC.Internal.TypeNats.SNat n) -> r)
   -> r
 GHC.TypeLits.withSomeSSymbol ::
   String
-  -> (forall (s :: GHC.Types.Symbol). GHC.TypeLits.SSymbol s -> r)
+  -> (forall (s :: GHC.Types.Symbol).
+      GHC.Internal.TypeLits.SSymbol s -> r)
   -> r
 type (GHC.TypeNats.*) :: GHC.Num.Natural.Natural
                          -> GHC.Num.Natural.Natural -> GHC.Num.Natural.Natural
@@ -138,7 +139,7 @@ data GHC.TypeError.ErrorMessage
     GHC.TypeError.ErrorMessage
 type GHC.TypeNats.KnownNat :: GHC.TypeNats.Nat -> Constraint
 class GHC.TypeNats.KnownNat n where
-  GHC.TypeNats.natSing :: GHC.TypeNats.SNat n
+  GHC.TypeNats.natSing :: GHC.Internal.TypeNats.SNat n
   {-# MINIMAL natSing #-}
 type GHC.TypeNats.Log2 :: GHC.Num.Natural.Natural
                           -> GHC.Num.Natural.Natural
@@ -164,12 +165,20 @@ data Data.Type.Ord.OrderingI a b where
   Data.Type.Ord.GTI :: forall {k} (a :: k) (b :: k).
                        (Data.Type.Ord.Compare a b ~ GT) =>
                        Data.Type.Ord.OrderingI a b
+type role GHC.Internal.TypeLits.SChar nominal
+type GHC.Internal.TypeLits.SChar :: Char -> *
+newtype GHC.Internal.TypeLits.SChar s
+  = GHC.Internal.TypeLits.UnsafeSChar_ Char
 pattern GHC.TypeNats.SNat
-  :: () => GHC.TypeNats.KnownNat n => GHC.TypeNats.SNat n
-type role GHC.TypeNats.SNat nominal
-type GHC.TypeNats.SNat :: GHC.TypeNats.Nat -> *
-newtype GHC.TypeNats.SNat n
-  = GHC.TypeNats.UnsafeSNat GHC.Num.Natural.Natural
+  :: () => GHC.TypeNats.KnownNat n => GHC.Internal.TypeNats.SNat n
+type role GHC.Internal.TypeNats.SNat nominal
+type GHC.Internal.TypeNats.SNat :: GHC.Num.Natural.Natural -> *
+newtype GHC.Internal.TypeNats.SNat n
+  = GHC.Internal.TypeNats.UnsafeSNat_ GHC.Num.Natural.Natural
+type role GHC.Internal.TypeLits.SSymbol nominal
+type GHC.Internal.TypeLits.SSymbol :: GHC.Types.Symbol -> *
+newtype GHC.Internal.TypeLits.SSymbol s
+  = GHC.Internal.TypeLits.UnsafeSSymbol_ [Char]
 type GHC.TypeNats.SomeNat :: *
 data GHC.TypeNats.SomeNat
   = forall (n :: GHC.TypeNats.Nat).
@@ -197,4 +206,4 @@ GHC.TypeNats.sameNat ::
   (GHC.TypeNats.KnownNat a, GHC.TypeNats.KnownNat b) =>
   proxy1 a -> proxy2 b -> Maybe (a Data.Type.Equality.:~: b)
 GHC.TypeNats.withKnownNat ::
-  GHC.TypeNats.SNat n -> (GHC.TypeNats.KnownNat n => r) -> r
+  GHC.Internal.TypeNats.SNat n -> (GHC.TypeNats.KnownNat n => r) -> r


=====================================
testsuite/tests/interface-stability/base-exports.stdout
=====================================
@@ -9462,7 +9462,7 @@ module GHC.TypeLits where
   newtype SChar s = ...
   pattern SNat :: forall (n :: Nat). () => KnownNat n => SNat n
   type role SNat nominal
-  type SNat :: Nat -> *
+  type SNat :: Natural -> *
   newtype SNat n = ...
   pattern SSymbol :: forall (s :: Symbol). () => KnownSymbol s => SSymbol s
   type role SSymbol nominal
@@ -9491,7 +9491,7 @@ module GHC.TypeLits where
   decideNat :: forall (a :: Nat) (b :: Nat) (proxy1 :: Nat -> *) (proxy2 :: Nat -> *). (KnownNat a, KnownNat b) => proxy1 a -> proxy2 b -> Data.Either.Either ((a Data.Type.Equality.:~: b) -> GHC.Base.Void) (a Data.Type.Equality.:~: b)
   decideSymbol :: forall (a :: Symbol) (b :: Symbol) (proxy1 :: Symbol -> *) (proxy2 :: Symbol -> *). (KnownSymbol a, KnownSymbol b) => proxy1 a -> proxy2 b -> Data.Either.Either ((a Data.Type.Equality.:~: b) -> GHC.Base.Void) (a Data.Type.Equality.:~: b)
   fromSChar :: forall (c :: GHC.Types.Char). SChar c -> GHC.Types.Char
-  fromSNat :: forall (n :: Nat). SNat n -> GHC.Num.Integer.Integer
+  fromSNat :: forall (n :: Natural). SNat n -> GHC.Num.Integer.Integer
   fromSSymbol :: forall (s :: Symbol). SSymbol s -> GHC.Base.String
   natVal :: forall (n :: Nat) (proxy :: Nat -> *). KnownNat n => proxy n -> GHC.Num.Integer.Integer
   natVal' :: forall (n :: Nat). KnownNat n => GHC.Prim.Proxy# n -> GHC.Num.Integer.Integer
@@ -9504,10 +9504,10 @@ module GHC.TypeLits where
   symbolVal :: forall (n :: Symbol) (proxy :: Symbol -> *). KnownSymbol n => proxy n -> GHC.Base.String
   symbolVal' :: forall (n :: Symbol). KnownSymbol n => GHC.Prim.Proxy# n -> GHC.Base.String
   withKnownChar :: forall (c :: GHC.Types.Char) (rep :: GHC.Types.RuntimeRep) (r :: TYPE rep). SChar c -> (KnownChar c => r) -> r
-  withKnownNat :: forall (n :: Nat) (rep :: GHC.Types.RuntimeRep) (r :: TYPE rep). SNat n -> (KnownNat n => r) -> r
+  withKnownNat :: forall (n :: Natural) (rep :: GHC.Types.RuntimeRep) (r :: TYPE rep). SNat n -> (KnownNat n => r) -> r
   withKnownSymbol :: forall (s :: Symbol) (rep :: GHC.Types.RuntimeRep) (r :: TYPE rep). SSymbol s -> (KnownSymbol s => r) -> r
   withSomeSChar :: forall (rep :: GHC.Types.RuntimeRep) (r :: TYPE rep). GHC.Types.Char -> (forall (c :: GHC.Types.Char). SChar c -> r) -> r
-  withSomeSNat :: forall (rep :: GHC.Types.RuntimeRep) (r :: TYPE rep). GHC.Num.Integer.Integer -> (forall (n :: Nat). GHC.Maybe.Maybe (SNat n) -> r) -> r
+  withSomeSNat :: forall (rep :: GHC.Types.RuntimeRep) (r :: TYPE rep). GHC.Num.Integer.Integer -> (forall (n :: Natural). GHC.Maybe.Maybe (SNat n) -> r) -> r
   withSomeSSymbol :: forall (rep :: GHC.Types.RuntimeRep) (r :: TYPE rep). GHC.Base.String -> (forall (s :: Symbol). SSymbol s -> r) -> r
 
 module GHC.TypeLits.Internal where
@@ -9549,7 +9549,7 @@ module GHC.TypeNats where
   data Natural = ...
   pattern SNat :: forall (n :: Nat). () => KnownNat n => SNat n
   type role SNat nominal
-  type SNat :: Nat -> *
+  type SNat :: Natural -> *
   newtype SNat n = ...
   type SomeNat :: *
   data SomeNat = forall (n :: Nat). KnownNat n => SomeNat (Data.Proxy.Proxy n)
@@ -9557,13 +9557,13 @@ module GHC.TypeNats where
   type family (^) a b
   cmpNat :: forall (a :: Nat) (b :: Nat) (proxy1 :: Nat -> *) (proxy2 :: Nat -> *). (KnownNat a, KnownNat b) => proxy1 a -> proxy2 b -> Data.Type.Ord.OrderingI a b
   decideNat :: forall (a :: Nat) (b :: Nat) (proxy1 :: Nat -> *) (proxy2 :: Nat -> *). (KnownNat a, KnownNat b) => proxy1 a -> proxy2 b -> Data.Either.Either ((a Data.Type.Equality.:~: b) -> GHC.Base.Void) (a Data.Type.Equality.:~: b)
-  fromSNat :: forall (n :: Nat). SNat n -> Natural
+  fromSNat :: forall (n :: Natural). SNat n -> Natural
   natVal :: forall (n :: Nat) (proxy :: Nat -> *). KnownNat n => proxy n -> Natural
   natVal' :: forall (n :: Nat). KnownNat n => GHC.Prim.Proxy# n -> Natural
   sameNat :: forall (a :: Nat) (b :: Nat) (proxy1 :: Nat -> *) (proxy2 :: Nat -> *). (KnownNat a, KnownNat b) => proxy1 a -> proxy2 b -> GHC.Maybe.Maybe (a Data.Type.Equality.:~: b)
   someNatVal :: Natural -> SomeNat
-  withKnownNat :: forall (n :: Nat) (rep :: GHC.Types.RuntimeRep) (r :: TYPE rep). SNat n -> (KnownNat n => r) -> r
-  withSomeSNat :: forall (rep :: GHC.Types.RuntimeRep) (r :: TYPE rep). Natural -> (forall (n :: Nat). SNat n -> r) -> r
+  withKnownNat :: forall (n :: Natural) (rep :: GHC.Types.RuntimeRep) (r :: TYPE rep). SNat n -> (KnownNat n => r) -> r
+  withSomeSNat :: forall (rep :: GHC.Types.RuntimeRep) (r :: TYPE rep). Natural -> (forall (n :: Natural). SNat n -> r) -> r
 
 module GHC.TypeNats.Internal where
   -- Safety: Trustworthy
@@ -11014,15 +11014,15 @@ instance Data.Traversable.Traversable Data.Semigroup.First -- Defined in ‘Data
 instance Data.Traversable.Traversable Data.Semigroup.Last -- Defined in ‘Data.Semigroup’
 instance Data.Traversable.Traversable Data.Semigroup.Max -- Defined in ‘Data.Semigroup’
 instance Data.Traversable.Traversable Data.Semigroup.Min -- Defined in ‘Data.Semigroup’
-instance Data.Type.Coercion.TestCoercion GHC.TypeLits.SChar -- Defined in ‘GHC.TypeLits’
-instance Data.Type.Coercion.TestCoercion GHC.TypeLits.SSymbol -- Defined in ‘GHC.TypeLits’
-instance Data.Type.Coercion.TestCoercion GHC.TypeNats.SNat -- Defined in ‘GHC.TypeNats’
+instance Data.Type.Coercion.TestCoercion GHC.Internal.TypeLits.SChar -- Defined in ‘GHC.TypeLits’
+instance Data.Type.Coercion.TestCoercion GHC.Internal.TypeLits.SSymbol -- Defined in ‘GHC.TypeLits’
+instance Data.Type.Coercion.TestCoercion GHC.Internal.TypeNats.SNat -- Defined in ‘GHC.TypeNats’
 instance forall k (a :: k). Data.Type.Coercion.TestCoercion ((Data.Type.Equality.:~:) a) -- Defined in ‘Data.Type.Coercion’
 instance forall k1 k (a :: k1). Data.Type.Coercion.TestCoercion ((Data.Type.Equality.:~~:) a) -- Defined in ‘Data.Type.Coercion’
 instance forall k (a :: k). Data.Type.Coercion.TestCoercion (Data.Type.Coercion.Coercion a) -- Defined in ‘Data.Type.Coercion’
-instance Data.Type.Equality.TestEquality GHC.TypeLits.SChar -- Defined in ‘GHC.TypeLits’
-instance Data.Type.Equality.TestEquality GHC.TypeLits.SSymbol -- Defined in ‘GHC.TypeLits’
-instance Data.Type.Equality.TestEquality GHC.TypeNats.SNat -- Defined in ‘GHC.TypeNats’
+instance Data.Type.Equality.TestEquality GHC.Internal.TypeLits.SChar -- Defined in ‘GHC.TypeLits’
+instance Data.Type.Equality.TestEquality GHC.Internal.TypeLits.SSymbol -- Defined in ‘GHC.TypeLits’
+instance Data.Type.Equality.TestEquality GHC.Internal.TypeNats.SNat -- Defined in ‘GHC.TypeNats’
 instance forall k (a :: k). Data.Type.Equality.TestEquality ((Data.Type.Equality.:~:) a) -- Defined in ‘Data.Type.Equality’
 instance forall k1 k (a :: k1). Data.Type.Equality.TestEquality ((Data.Type.Equality.:~~:) a) -- Defined in ‘Data.Type.Equality’
 instance forall k. Data.Type.Equality.TestEquality base-4.19.0.0:Data.Typeable.Internal.TypeRep -- Defined in ‘base-4.19.0.0:Data.Typeable.Internal’
@@ -12076,11 +12076,11 @@ instance GHC.Show.Show GHC.Stack.CloneStack.StackEntry -- Defined in ‘GHC.Stac
 instance GHC.Show.Show GHC.StaticPtr.StaticPtrInfo -- Defined in ‘GHC.StaticPtr’
 instance GHC.Show.Show GHC.Stats.GCDetails -- Defined in ‘GHC.Stats’
 instance GHC.Show.Show GHC.Stats.RTSStats -- Defined in ‘GHC.Stats’
-instance forall (c :: GHC.Types.Char). GHC.Show.Show (GHC.TypeLits.SChar c) -- Defined in ‘GHC.TypeLits’
-instance forall (s :: GHC.Types.Symbol). GHC.Show.Show (GHC.TypeLits.SSymbol s) -- Defined in ‘GHC.TypeLits’
+instance forall (c :: GHC.Types.Char). GHC.Show.Show (GHC.Internal.TypeLits.SChar c) -- Defined in ‘GHC.TypeLits’
+instance forall (s :: GHC.Types.Symbol). GHC.Show.Show (GHC.Internal.TypeLits.SSymbol s) -- Defined in ‘GHC.TypeLits’
 instance GHC.Show.Show GHC.TypeLits.SomeChar -- Defined in ‘GHC.TypeLits’
 instance GHC.Show.Show GHC.TypeLits.SomeSymbol -- Defined in ‘GHC.TypeLits’
-instance forall (n :: GHC.TypeNats.Nat). GHC.Show.Show (GHC.TypeNats.SNat n) -- Defined in ‘GHC.TypeNats’
+instance forall (n :: GHC.Num.Natural.Natural). GHC.Show.Show (GHC.Internal.TypeNats.SNat n) -- Defined in ‘GHC.TypeNats’
 instance GHC.Show.Show GHC.TypeNats.SomeNat -- Defined in ‘GHC.TypeNats’
 instance [safe] GHC.Show.Show System.Timeout.Timeout -- Defined in ‘System.Timeout’
 instance GHC.Show.Show Text.Read.Lex.Lexeme -- Defined in ‘Text.Read.Lex’
@@ -12267,12 +12267,12 @@ instance GHC.Classes.Eq GHC.Num.BigNat.BigNat -- Defined in ‘GHC.Num.BigNat’
 instance GHC.Classes.Eq GHC.Num.Natural.Natural -- Defined in ‘GHC.Num.Natural’
 instance forall a. GHC.Classes.Eq (GHC.StableName.StableName a) -- Defined in ‘GHC.StableName’
 instance GHC.Classes.Eq GHC.Stack.CloneStack.StackEntry -- Defined in ‘GHC.Stack.CloneStack’
-instance forall (c :: GHC.Types.Char). GHC.Classes.Eq (GHC.TypeLits.SChar c) -- Defined in ‘GHC.TypeLits’
-instance forall (s :: GHC.Types.Symbol). GHC.Classes.Eq (GHC.TypeLits.SSymbol s) -- Defined in ‘GHC.TypeLits’
 instance GHC.Classes.Eq GHC.TypeLits.SomeChar -- Defined in ‘GHC.TypeLits’
 instance GHC.Classes.Eq GHC.TypeLits.SomeSymbol -- Defined in ‘GHC.TypeLits’
-instance forall (n :: GHC.TypeNats.Nat). GHC.Classes.Eq (GHC.TypeNats.SNat n) -- Defined in ‘GHC.TypeNats’
 instance GHC.Classes.Eq GHC.TypeNats.SomeNat -- Defined in ‘GHC.TypeNats’
+instance forall (c :: GHC.Types.Char). GHC.Classes.Eq (GHC.Internal.TypeLits.SChar c) -- Defined in ‘GHC.Internal.TypeLits’
+instance forall (s :: GHC.Types.Symbol). GHC.Classes.Eq (GHC.Internal.TypeLits.SSymbol s) -- Defined in ‘GHC.Internal.TypeLits’
+instance forall (n :: GHC.Num.Natural.Natural). GHC.Classes.Eq (GHC.Internal.TypeNats.SNat n) -- Defined in ‘GHC.Internal.TypeNats’
 instance [safe] GHC.Classes.Eq System.Timeout.Timeout -- Defined in ‘System.Timeout’
 instance GHC.Classes.Eq Text.Read.Lex.Lexeme -- Defined in ‘Text.Read.Lex’
 instance GHC.Classes.Eq Text.Read.Lex.Number -- Defined in ‘Text.Read.Lex’
@@ -12394,9 +12394,9 @@ instance GHC.Classes.Ord GHC.IO.IOMode.IOMode -- Defined in ‘GHC.IO.IOMode’
 instance GHC.Classes.Ord GHC.Num.Integer.Integer -- Defined in ‘GHC.Num.Integer’
 instance GHC.Classes.Ord GHC.Num.BigNat.BigNat -- Defined in ‘GHC.Num.BigNat’
 instance GHC.Classes.Ord GHC.Num.Natural.Natural -- Defined in ‘GHC.Num.Natural’
-instance forall (c :: GHC.Types.Char). GHC.Classes.Ord (GHC.TypeLits.SChar c) -- Defined in ‘GHC.TypeLits’
-instance forall (s :: GHC.Types.Symbol). GHC.Classes.Ord (GHC.TypeLits.SSymbol s) -- Defined in ‘GHC.TypeLits’
 instance GHC.Classes.Ord GHC.TypeLits.SomeChar -- Defined in ‘GHC.TypeLits’
 instance GHC.Classes.Ord GHC.TypeLits.SomeSymbol -- Defined in ‘GHC.TypeLits’
-instance forall (n :: GHC.TypeNats.Nat). GHC.Classes.Ord (GHC.TypeNats.SNat n) -- Defined in ‘GHC.TypeNats’
 instance GHC.Classes.Ord GHC.TypeNats.SomeNat -- Defined in ‘GHC.TypeNats’
+instance forall (c :: GHC.Types.Char). GHC.Classes.Ord (GHC.Internal.TypeLits.SChar c) -- Defined in ‘GHC.Internal.TypeLits’
+instance forall (s :: GHC.Types.Symbol). GHC.Classes.Ord (GHC.Internal.TypeLits.SSymbol s) -- Defined in ‘GHC.Internal.TypeLits’
+instance forall (n :: GHC.Num.Natural.Natural). GHC.Classes.Ord (GHC.Internal.TypeNats.SNat n) -- Defined in ‘GHC.Internal.TypeNats’


=====================================
testsuite/tests/plugins/plugins09.stdout
=====================================
@@ -2,6 +2,8 @@ parsePlugin(a,b)
 interfacePlugin: Prelude
 interfacePlugin: GHC.Base
 interfacePlugin: GHC.Float
+interfacePlugin: GHC.TypeLits
+interfacePlugin: GHC.TypeNats
 interfacePlugin: GHC.Prim.Ext
 typeCheckPlugin (rn)
 typeCheckPlugin (tc)


=====================================
testsuite/tests/plugins/plugins10.stdout
=====================================
@@ -4,6 +4,8 @@ interfacePlugin: Language.Haskell.TH
 interfacePlugin: Language.Haskell.TH.Quote
 interfacePlugin: GHC.Base
 interfacePlugin: GHC.Float
+interfacePlugin: GHC.TypeLits
+interfacePlugin: GHC.TypeNats
 interfacePlugin: GHC.Prim.Ext
 interfacePlugin: Language.Haskell.TH.Syntax
 typeCheckPlugin (rn)


=====================================
testsuite/tests/plugins/plugins11.stdout
=====================================
@@ -2,6 +2,8 @@ parsePlugin()
 interfacePlugin: Prelude
 interfacePlugin: GHC.Base
 interfacePlugin: GHC.Float
+interfacePlugin: GHC.TypeLits
+interfacePlugin: GHC.TypeNats
 interfacePlugin: GHC.Prim.Ext
 typeCheckPlugin (rn)
 typeCheckPlugin (tc)


=====================================
testsuite/tests/plugins/static-plugins.stdout
=====================================
@@ -3,6 +3,8 @@ parsePlugin()
 interfacePlugin: Prelude
 interfacePlugin: GHC.Base
 interfacePlugin: GHC.Float
+interfacePlugin: GHC.TypeLits
+interfacePlugin: GHC.TypeNats
 interfacePlugin: GHC.Prim.Ext
 interfacePlugin: System.IO
 interfacePlugin: GHC.Types



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/413e4e47c445d4fa3d72b3ccad23fc1b4ae83626

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/413e4e47c445d4fa3d72b3ccad23fc1b4ae83626
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20231208/21b49ebe/attachment-0001.html>


More information about the ghc-commits mailing list