summaryrefslogtreecommitdiff
path: root/compiler/GHC/Builtin/Types
diff options
context:
space:
mode:
authorHaskellMouse <rinat.stryungis@serokell.io>2020-06-19 21:51:59 +0300
committerHaskellMouse <rinat.stryungis@serokell.io>2020-10-13 13:05:49 +0300
commit8f4f5794eb3504bf2ca093dc5895742395fdbde9 (patch)
tree827d862d79d1ff20f4206e225aecb2ca7c1e882a /compiler/GHC/Builtin/Types
parent0a5f29185921cf2af908988ab3608602bcb40290 (diff)
downloadhaskell-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 'compiler/GHC/Builtin/Types')
-rw-r--r--compiler/GHC/Builtin/Types/Literals.hs14
1 files changed, 6 insertions, 8 deletions
diff --git a/compiler/GHC/Builtin/Types/Literals.hs b/compiler/GHC/Builtin/Types/Literals.hs
index cbb9f9e847..0f609eaad8 100644
--- a/compiler/GHC/Builtin/Types/Literals.hs
+++ b/compiler/GHC/Builtin/Types/Literals.hs
@@ -236,7 +236,7 @@ typeNatLogTyCon = mkTypeNatFunTyCon1 name
typeNatLeqTyCon :: TyCon
typeNatLeqTyCon =
mkFamilyTyCon name
- (mkTemplateAnonTyConBinders [ typeNatKind, typeNatKind ])
+ (mkTemplateAnonTyConBinders [ naturalTy, naturalTy ])
boolTy
Nothing
(BuiltInSynFamTyCon ops)
@@ -255,7 +255,7 @@ typeNatLeqTyCon =
typeNatCmpTyCon :: TyCon
typeNatCmpTyCon =
mkFamilyTyCon name
- (mkTemplateAnonTyConBinders [ typeNatKind, typeNatKind ])
+ (mkTemplateAnonTyConBinders [ naturalTy, naturalTy ])
orderingKind
Nothing
(BuiltInSynFamTyCon ops)
@@ -301,14 +301,12 @@ typeSymbolAppendTyCon = mkTypeSymbolFunTyCon2 name
name = mkWiredInTyConName UserSyntax gHC_TYPELITS (fsLit "AppendSymbol")
typeSymbolAppendFamNameKey typeSymbolAppendTyCon
-
-
-- Make a unary built-in constructor of kind: Nat -> Nat
mkTypeNatFunTyCon1 :: Name -> BuiltInSynFamily -> TyCon
mkTypeNatFunTyCon1 op tcb =
mkFamilyTyCon op
- (mkTemplateAnonTyConBinders [ typeNatKind ])
- typeNatKind
+ (mkTemplateAnonTyConBinders [ naturalTy ])
+ naturalTy
Nothing
(BuiltInSynFamTyCon tcb)
Nothing
@@ -319,8 +317,8 @@ mkTypeNatFunTyCon1 op tcb =
mkTypeNatFunTyCon2 :: Name -> BuiltInSynFamily -> TyCon
mkTypeNatFunTyCon2 op tcb =
mkFamilyTyCon op
- (mkTemplateAnonTyConBinders [ typeNatKind, typeNatKind ])
- typeNatKind
+ (mkTemplateAnonTyConBinders [ naturalTy, naturalTy ])
+ naturalTy
Nothing
(BuiltInSynFamTyCon tcb)
Nothing