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

Oleg Grenrus (@phadej) gitlab at gitlab.haskell.org
Thu Dec 7 00:44:45 UTC 2023



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


Commits:
4a8d3c51 by Oleg Grenrus at 2023-12-07T02:43:05+02:00
Move definitions of SNat, SChar and SSymbol to ghc-internal

... and expose their constructors there

- - - - -


11 changed files:

- libraries/base/src/GHC/TypeLits.hs
- libraries/base/src/GHC/TypeNats.hs
- libraries/ghc-internal/ghc-internal.cabal
- + libraries/ghc-internal/src/GHC/TypeLits/Internal.hs
- + libraries/ghc-internal/src/GHC/TypeNats/Internal.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
=====================================
@@ -12,11 +12,15 @@
 {-# LANGUAGE MagicHash #-}
 {-# LANGUAGE TypeApplications #-}
 {-# LANGUAGE GADTs #-}
+{-# LANGUAGE PackageImports #-}
 {-# LANGUAGE PatternSynonyms #-}
 {-# LANGUAGE PolyKinds #-}
 {-# 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 +73,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 +94,11 @@ import Unsafe.Coerce(unsafeCoerce)
 import GHC.TypeLits.Internal(CmpSymbol, CmpChar)
 import qualified GHC.TypeNats as N
 
+-- PackageImports can be removed once base's GHC.TypeLits.Internal
+-- is hidden and renamed
+-- https://github.com/haskell/core-libraries-committee/issues/217
+import "ghc-internal" GHC.TypeLits.Internal
+
 --------------------------------------------------------------------------------
 
 -- | This class gives the string associated with a type-level symbol.
@@ -325,24 +334,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 +368,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 +412,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 +448,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
=====================================
@@ -14,10 +14,14 @@
 {-# LANGUAGE PolyKinds #-}
 {-# LANGUAGE TypeApplications #-}
 {-# LANGUAGE GADTs #-}
+{-# LANGUAGE PackageImports #-}
 {-# LANGUAGE PatternSynonyms #-}
 {-# 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 +71,11 @@ import Unsafe.Coerce(unsafeCoerce)
 
 import GHC.TypeNats.Internal(CmpNat)
 
+-- PackageImports can be removed once base's GHC.TypeNats.Internal
+-- is hidden and renamed
+-- https://github.com/haskell/core-libraries-committee/issues/217
+import "ghc-internal" GHC.TypeNats.Internal
+
 -- | A type synonym for 'Natural'.
 --
 -- Previously, this was an opaque data type, but it was changed to a type
@@ -329,23 +338,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 +374,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.TypeLits.Internal
+        GHC.TypeNats.Internal
     build-depends:    rts == 1.0.*,
                       ghc-prim >= 0.5.1.0 && < 0.11,
                       ghc-bignum >= 1.0 && < 2.0


=====================================
libraries/ghc-internal/src/GHC/TypeLits/Internal.hs
=====================================
@@ -0,0 +1,63 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE KindSignatures #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE RoleAnnotations #-}
+module GHC.TypeLits.Internal (
+  SChar (..),
+  SSymbol (..),
+) 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
+
+-- | /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
+
+-- | /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/TypeNats/Internal.hs
=====================================
@@ -0,0 +1,39 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE KindSignatures #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE RoleAnnotations #-}
+module GHC.TypeNats.Internal (
+  SNat (..),
+)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
+
+-- | /since base-4.19.0.0/
+instance Eq (SNat n) where
+  _ == _ = True
+
+-- | /since 4.19.0.0/
+instance Ord (SNat n) where
+  compare _ _ = EQ


=====================================
testsuite/tests/ghci/scripts/T9181.stdout
=====================================
@@ -8,24 +8,24 @@ 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-0.1.0.0:GHC.TypeLits.Internal.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-0.1.0.0:GHC.TypeLits.Internal.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-0.1.0.0:GHC.TypeLits.Internal.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-0.1.0.0:GHC.TypeLits.Internal.SSymbol s
 type GHC.TypeLits.SomeChar :: *
 data GHC.TypeLits.SomeChar
   = forall (n :: Char).
@@ -62,9 +62,12 @@ 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-0.1.0.0:GHC.TypeLits.Internal.SChar c -> Char
+GHC.TypeLits.fromSNat ::
+  ghc-internal-0.1.0.0:GHC.TypeNats.Internal.SNat n -> Integer
+GHC.TypeLits.fromSSymbol ::
+  ghc-internal-0.1.0.0:GHC.TypeLits.Internal.SSymbol s -> String
 GHC.TypeLits.natVal ::
   GHC.TypeNats.KnownNat n => proxy n -> Integer
 GHC.TypeLits.natVal' ::
@@ -83,19 +86,25 @@ 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-0.1.0.0:GHC.TypeLits.Internal.SChar c
+  -> (GHC.TypeLits.KnownChar c => r) -> r
 GHC.TypeLits.withKnownSymbol ::
-  GHC.TypeLits.SSymbol s -> (GHC.TypeLits.KnownSymbol s => r) -> r
+  ghc-internal-0.1.0.0:GHC.TypeLits.Internal.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-0.1.0.0:GHC.TypeLits.Internal.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-0.1.0.0:GHC.TypeNats.Internal.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-0.1.0.0:GHC.TypeLits.Internal.SSymbol s -> r)
   -> r
 type (GHC.TypeNats.*) :: GHC.Num.Natural.Natural
                          -> GHC.Num.Natural.Natural -> GHC.Num.Natural.Natural
@@ -115,14 +124,15 @@ type (Data.Type.Ord.<=?) :: forall k. k -> k -> Bool
 type (Data.Type.Ord.<=?) m n =
   Data.Type.Ord.OrdCond (Data.Type.Ord.Compare m n) True True False
   :: Bool
-type GHC.TypeLits.Internal.CmpChar :: Char -> Char -> Ordering
-type family GHC.TypeLits.Internal.CmpChar a b
-type GHC.TypeNats.Internal.CmpNat :: GHC.Num.Natural.Natural
-                                     -> GHC.Num.Natural.Natural -> Ordering
-type family GHC.TypeNats.Internal.CmpNat a b
-type GHC.TypeLits.Internal.CmpSymbol :: GHC.Types.Symbol
-                                        -> GHC.Types.Symbol -> Ordering
-type family GHC.TypeLits.Internal.CmpSymbol a b
+type base-4.19.0.0:GHC.TypeLits.Internal.CmpChar :: Char
+                                                    -> Char -> Ordering
+type family base-4.19.0.0:GHC.TypeLits.Internal.CmpChar a b
+type base-4.19.0.0:GHC.TypeNats.Internal.CmpNat :: GHC.Num.Natural.Natural
+                                                   -> GHC.Num.Natural.Natural -> Ordering
+type family base-4.19.0.0:GHC.TypeNats.Internal.CmpNat a b
+type base-4.19.0.0:GHC.TypeLits.Internal.CmpSymbol :: GHC.Types.Symbol
+                                                      -> GHC.Types.Symbol -> Ordering
+type family base-4.19.0.0:GHC.TypeLits.Internal.CmpSymbol a b
 type GHC.TypeNats.Div :: GHC.Num.Natural.Natural
                          -> GHC.Num.Natural.Natural -> GHC.Num.Natural.Natural
 type family GHC.TypeNats.Div a b
@@ -138,7 +148,8 @@ 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-0.1.0.0:GHC.TypeNats.Internal.SNat
+                            n
   {-# MINIMAL natSing #-}
 type GHC.TypeNats.Log2 :: GHC.Num.Natural.Natural
                           -> GHC.Num.Natural.Natural
@@ -164,12 +175,24 @@ 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-0.1.0.0:GHC.TypeLits.Internal.SChar nominal
+type ghc-internal-0.1.0.0:GHC.TypeLits.Internal.SChar :: Char -> *
+newtype ghc-internal-0.1.0.0:GHC.TypeLits.Internal.SChar s
+  = ghc-internal-0.1.0.0:GHC.TypeLits.Internal.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-0.1.0.0:GHC.TypeNats.Internal.SNat n
+type role ghc-internal-0.1.0.0:GHC.TypeNats.Internal.SNat nominal
+type ghc-internal-0.1.0.0:GHC.TypeNats.Internal.SNat :: GHC.Num.Natural.Natural
+                                                        -> *
+newtype ghc-internal-0.1.0.0:GHC.TypeNats.Internal.SNat n
+  = ghc-internal-0.1.0.0:GHC.TypeNats.Internal.UnsafeSNat GHC.Num.Natural.Natural
+type role ghc-internal-0.1.0.0:GHC.TypeLits.Internal.SSymbol nominal
+type ghc-internal-0.1.0.0:GHC.TypeLits.Internal.SSymbol :: GHC.Types.Symbol
+                                                           -> *
+newtype ghc-internal-0.1.0.0:GHC.TypeLits.Internal.SSymbol s
+  = ghc-internal-0.1.0.0:GHC.TypeLits.Internal.UnsafeSSymbol [Char]
 type GHC.TypeNats.SomeNat :: *
 data GHC.TypeNats.SomeNat
   = forall (n :: GHC.TypeNats.Nat).
@@ -197,4 +220,5 @@ 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-0.1.0.0:GHC.TypeNats.Internal.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-0.1.0.0:GHC.TypeLits.Internal.SChar -- Defined in ‘GHC.TypeLits’
+instance Data.Type.Coercion.TestCoercion ghc-internal-0.1.0.0:GHC.TypeLits.Internal.SSymbol -- Defined in ‘GHC.TypeLits’
+instance Data.Type.Coercion.TestCoercion ghc-internal-0.1.0.0:GHC.TypeNats.Internal.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-0.1.0.0:GHC.TypeLits.Internal.SChar -- Defined in ‘GHC.TypeLits’
+instance Data.Type.Equality.TestEquality ghc-internal-0.1.0.0:GHC.TypeLits.Internal.SSymbol -- Defined in ‘GHC.TypeLits’
+instance Data.Type.Equality.TestEquality ghc-internal-0.1.0.0:GHC.TypeNats.Internal.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-0.1.0.0:GHC.TypeLits.Internal.SChar c) -- Defined in ‘GHC.TypeLits’
+instance forall (s :: GHC.Types.Symbol). GHC.Show.Show (ghc-internal-0.1.0.0:GHC.TypeLits.Internal.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-0.1.0.0:GHC.TypeNats.Internal.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-0.1.0.0:GHC.TypeLits.Internal.SChar c) -- Defined in ‘ghc-internal-0.1.0.0:GHC.TypeLits.Internal’
+instance forall (s :: GHC.Types.Symbol). GHC.Classes.Eq (ghc-internal-0.1.0.0:GHC.TypeLits.Internal.SSymbol s) -- Defined in ‘ghc-internal-0.1.0.0:GHC.TypeLits.Internal’
+instance forall (n :: GHC.Num.Natural.Natural). GHC.Classes.Eq (ghc-internal-0.1.0.0:GHC.TypeNats.Internal.SNat n) -- Defined in ‘ghc-internal-0.1.0.0:GHC.TypeNats.Internal’
 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-0.1.0.0:GHC.TypeLits.Internal.SChar c) -- Defined in ‘ghc-internal-0.1.0.0:GHC.TypeLits.Internal’
+instance forall (s :: GHC.Types.Symbol). GHC.Classes.Ord (ghc-internal-0.1.0.0:GHC.TypeLits.Internal.SSymbol s) -- Defined in ‘ghc-internal-0.1.0.0:GHC.TypeLits.Internal’
+instance forall (n :: GHC.Num.Natural.Natural). GHC.Classes.Ord (ghc-internal-0.1.0.0:GHC.TypeNats.Internal.SNat n) -- Defined in ‘ghc-internal-0.1.0.0:GHC.TypeNats.Internal’


=====================================
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/4a8d3c5178171a89e61ba145b166dc072df4328b

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4a8d3c5178171a89e61ba145b166dc072df4328b
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/20231206/55a37ee1/attachment-0001.html>


More information about the ghc-commits mailing list