diff options
author | HaskellMouse <rinat.stryungis@serokell.io> | 2020-06-19 21:51:59 +0300 |
---|---|---|
committer | HaskellMouse <rinat.stryungis@serokell.io> | 2020-10-13 13:05:49 +0300 |
commit | 8f4f5794eb3504bf2ca093dc5895742395fdbde9 (patch) | |
tree | 827d862d79d1ff20f4206e225aecb2ca7c1e882a /testsuite/tests/ghci | |
parent | 0a5f29185921cf2af908988ab3608602bcb40290 (diff) | |
download | haskell-8f4f5794eb3504bf2ca093dc5895742395fdbde9.tar.gz |
Unification of Nat and Naturals
This commit removes the separate kind 'Nat' and enables promotion
of type 'Natural' for using as type literal.
It partially solves #10776
Now the following code will be successfully typechecked:
data C = MkC Natural
type CC = MkC 1
Before this change we had to create the separate type for promotion
data C = MkC Natural
data CP = MkCP Nat
type CC = MkCP 1
But CP is uninhabited in terms.
For backward compatibility type synonym `Nat` has been made:
type Nat = Natural
The user's documentation and tests have been updated.
The haddock submodule also have been updated.
Diffstat (limited to 'testsuite/tests/ghci')
-rw-r--r-- | testsuite/tests/ghci/scripts/T9181.stdout | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/testsuite/tests/ghci/scripts/T9181.stdout b/testsuite/tests/ghci/scripts/T9181.stdout index c523624fe2..170e17b995 100644 --- a/testsuite/tests/ghci/scripts/T9181.stdout +++ b/testsuite/tests/ghci/scripts/T9181.stdout @@ -39,47 +39,53 @@ GHC.TypeLits.symbolVal :: GHC.TypeLits.KnownSymbol n => proxy n -> String GHC.TypeLits.symbolVal' :: GHC.TypeLits.KnownSymbol n => GHC.Prim.Proxy# n -> String -type (GHC.TypeNats.*) :: GHC.Types.Nat - -> GHC.Types.Nat -> GHC.Types.Nat +type (GHC.TypeNats.*) :: GHC.Num.Natural.Natural + -> GHC.Num.Natural.Natural -> GHC.Num.Natural.Natural type family (GHC.TypeNats.*) a b -type (GHC.TypeNats.+) :: GHC.Types.Nat - -> GHC.Types.Nat -> GHC.Types.Nat +type (GHC.TypeNats.+) :: GHC.Num.Natural.Natural + -> GHC.Num.Natural.Natural -> GHC.Num.Natural.Natural type family (GHC.TypeNats.+) a b -type (GHC.TypeNats.-) :: GHC.Types.Nat - -> GHC.Types.Nat -> GHC.Types.Nat +type (GHC.TypeNats.-) :: GHC.Num.Natural.Natural + -> GHC.Num.Natural.Natural -> GHC.Num.Natural.Natural type family (GHC.TypeNats.-) a b -type (GHC.TypeNats.<=) :: GHC.Types.Nat - -> GHC.Types.Nat -> Constraint +type (GHC.TypeNats.<=) :: GHC.Num.Natural.Natural + -> GHC.Num.Natural.Natural -> Constraint type (GHC.TypeNats.<=) x y = (x GHC.TypeNats.<=? y) ~ 'True :: Constraint -type (GHC.TypeNats.<=?) :: GHC.Types.Nat -> GHC.Types.Nat -> Bool +type (GHC.TypeNats.<=?) :: GHC.Num.Natural.Natural + -> GHC.Num.Natural.Natural -> Bool type family (GHC.TypeNats.<=?) a b -type GHC.TypeNats.CmpNat :: GHC.Types.Nat - -> GHC.Types.Nat -> Ordering +type GHC.TypeNats.CmpNat :: GHC.Num.Natural.Natural + -> GHC.Num.Natural.Natural -> Ordering type family GHC.TypeNats.CmpNat a b -type GHC.TypeNats.Div :: GHC.Types.Nat - -> GHC.Types.Nat -> GHC.Types.Nat +type GHC.TypeNats.Div :: GHC.Num.Natural.Natural + -> GHC.Num.Natural.Natural -> GHC.Num.Natural.Natural type family GHC.TypeNats.Div a b -type GHC.TypeNats.KnownNat :: GHC.Types.Nat -> Constraint +type GHC.TypeNats.KnownNat :: GHC.TypeNats.Nat -> Constraint class GHC.TypeNats.KnownNat n where GHC.TypeNats.natSing :: GHC.TypeNats.SNat n {-# MINIMAL natSing #-} -type GHC.TypeNats.Log2 :: GHC.Types.Nat -> GHC.Types.Nat +type GHC.TypeNats.Log2 :: GHC.Num.Natural.Natural + -> GHC.Num.Natural.Natural type family GHC.TypeNats.Log2 a -type GHC.TypeNats.Mod :: GHC.Types.Nat - -> GHC.Types.Nat -> GHC.Types.Nat +type GHC.TypeNats.Mod :: GHC.Num.Natural.Natural + -> GHC.Num.Natural.Natural -> GHC.Num.Natural.Natural type family GHC.TypeNats.Mod a b -type GHC.Types.Nat :: * -data GHC.Types.Nat +type GHC.TypeNats.Nat :: * +type GHC.TypeNats.Nat = GHC.Num.Natural.Natural +type GHC.Num.Natural.Natural :: * +data GHC.Num.Natural.Natural + = GHC.Num.Natural.NS GHC.Prim.Word# + | GHC.Num.Natural.NB GHC.Prim.ByteArray# type GHC.TypeNats.SomeNat :: * data GHC.TypeNats.SomeNat - = forall (n :: GHC.Types.Nat). + = forall (n :: GHC.TypeNats.Nat). GHC.TypeNats.KnownNat n => GHC.TypeNats.SomeNat (Data.Proxy.Proxy n) type GHC.Types.Symbol :: * data GHC.Types.Symbol -type (GHC.TypeNats.^) :: GHC.Types.Nat - -> GHC.Types.Nat -> GHC.Types.Nat +type (GHC.TypeNats.^) :: GHC.Num.Natural.Natural + -> GHC.Num.Natural.Natural -> GHC.Num.Natural.Natural type family (GHC.TypeNats.^) a b GHC.TypeNats.sameNat :: (GHC.TypeNats.KnownNat a, GHC.TypeNats.KnownNat b) => |