summaryrefslogtreecommitdiff
path: root/compiler/prelude/TysPrim.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/prelude/TysPrim.hs')
-rw-r--r--compiler/prelude/TysPrim.hs38
1 files changed, 13 insertions, 25 deletions
diff --git a/compiler/prelude/TysPrim.hs b/compiler/prelude/TysPrim.hs
index 3a6dd0341e..d66b48e3b7 100644
--- a/compiler/prelude/TysPrim.hs
+++ b/compiler/prelude/TysPrim.hs
@@ -10,8 +10,6 @@
-- | This module defines TyCons that can't be expressed in Haskell.
-- They are all, therefore, wired-in TyCons. C.f module TysWiredIn
module TysPrim(
- mkPrimTyConName, -- For implicit parameters in TysWiredIn only
-
mkTemplateTyVars,
alphaTyVars, betaTyVars, alphaTyVar, betaTyVar, gammaTyVar, deltaTyVar,
alphaTy, betaTy, gammaTy, deltaTy,
@@ -83,11 +81,12 @@ module TysPrim(
#include "HsVersions.h"
import Var ( TyVar, KindVar, mkTyVar )
-import Name
+import Name ( Name, BuiltInSyntax(..), mkInternalName, mkWiredInName )
+import OccName ( mkTyVarOccFS, mkTcOccFS )
import TyCon
import TypeRep
import SrcLoc
-import Unique
+import Unique ( mkAlphaTyVarUnique )
import PrelNames
import FastString
@@ -259,9 +258,8 @@ funTyConName :: Name
funTyConName = mkPrimTyConName (fsLit "(->)") funTyConKey funTyCon
funTyCon :: TyCon
-funTyCon = mkFunTyCon funTyConName kind tc_rep_nm
- where
- kind = mkArrowKinds [liftedTypeKind, liftedTypeKind] liftedTypeKind
+funTyCon = mkFunTyCon funTyConName $
+ mkArrowKinds [liftedTypeKind, liftedTypeKind] liftedTypeKind
-- You might think that (->) should have type (?? -> ? -> *), and you'd be right
-- But if we do that we get kind errors when saying
-- instance Control.Arrow (->)
@@ -271,8 +269,6 @@ funTyCon = mkFunTyCon funTyConName kind tc_rep_nm
-- a prefix way, thus: (->) Int# Int#. And this is unusual.
-- because they are never in scope in the source
- tc_rep_nm = mkSpecialTyConRepName (fsLit "tcFun") funTyConName
-
-- One step to remove subkinding.
-- (->) :: * -> * -> *
-- but we should have (and want) the following typing rule for fully applied arrows
@@ -322,21 +318,14 @@ superKindTyConName, anyKindTyConName, liftedTypeKindTyConName,
constraintKindTyConName
:: Name
-mk_kind_tycon :: Name -- ^ Name of the kind constructor, e.g. @*@
- -> FastString -- ^ Name of the 'TyConRepName' function,
- -- e.g. @tcLiftedKind :: TyCon@
- -> TyCon -- ^ The kind constructor
-mk_kind_tycon tc_name rep_fs
- = mkKindTyCon tc_name superKind (mkSpecialTyConRepName rep_fs tc_name)
-
-superKindTyCon = mk_kind_tycon superKindTyConName (fsLit "tcBOX")
- -- See Note [SuperKind (BOX)]
+superKindTyCon = mkKindTyCon superKindTyConName superKind
+ -- See Note [SuperKind (BOX)]
-anyKindTyCon = mk_kind_tycon anyKindTyConName (fsLit "tcAnyK")
-constraintKindTyCon = mk_kind_tycon constraintKindTyConName (fsLit "tcConstraint")
-liftedTypeKindTyCon = mk_kind_tycon liftedTypeKindTyConName (fsLit "tcLiftedKind")
-openTypeKindTyCon = mk_kind_tycon openTypeKindTyConName (fsLit "tcOpenKind")
-unliftedTypeKindTyCon = mk_kind_tycon unliftedTypeKindTyConName (fsLit "tcUnliftedKind")
+anyKindTyCon = mkKindTyCon anyKindTyConName superKind
+liftedTypeKindTyCon = mkKindTyCon liftedTypeKindTyConName superKind
+openTypeKindTyCon = mkKindTyCon openTypeKindTyConName superKind
+unliftedTypeKindTyCon = mkKindTyCon unliftedTypeKindTyConName superKind
+constraintKindTyCon = mkKindTyCon constraintKindTyConName superKind
--------------------------
-- ... and now their names
@@ -747,7 +736,6 @@ variables with no constraints on them. It appears in similar circumstances to
Any, but at the kind level. For example:
type family Length (l :: [k]) :: Nat
- type instance Length [] = Zero
f :: Proxy (Length []) -> Int
f = ....
@@ -788,7 +776,7 @@ anyTy = mkTyConTy anyTyCon
anyTyCon :: TyCon
anyTyCon = mkFamilyTyCon anyTyConName kind [kKiVar] Nothing
(ClosedSynFamilyTyCon Nothing)
- Nothing
+ NoParentTyCon
NotInjective
where
kind = ForAllTy kKiVar (mkTyVarTy kKiVar)