Commit 051d694f authored by eir@cis.upenn.edu's avatar eir@cis.upenn.edu
Browse files

Fix #9097.

`Any` is now an abstract (that is, no equations) closed type family.
parent 0f584ae3
...@@ -701,7 +701,7 @@ threadIdPrimTyCon = pcPrimTyCon0 threadIdPrimTyConName PtrRep ...@@ -701,7 +701,7 @@ threadIdPrimTyCon = pcPrimTyCon0 threadIdPrimTyConName PtrRep
Note [Any types] Note [Any types]
~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
The type constructor Any of kind forall k. k -> k has these properties: The type constructor Any of kind forall k. k has these properties:
* It is defined in module GHC.Prim, and exported so that it is * It is defined in module GHC.Prim, and exported so that it is
available to users. For this reason it's treated like any other available to users. For this reason it's treated like any other
...@@ -714,7 +714,7 @@ The type constructor Any of kind forall k. k -> k has these properties: ...@@ -714,7 +714,7 @@ The type constructor Any of kind forall k. k -> k has these properties:
g :: ty ~ (Fst ty, Snd ty) g :: ty ~ (Fst ty, Snd ty)
If Any was a *data* type, then we'd get inconsistency because 'ty' If Any was a *data* type, then we'd get inconsistency because 'ty'
could be (Any '(k1,k2)) and then we'd have an equality with Any on could be (Any '(k1,k2)) and then we'd have an equality with Any on
one side and '(,) on the other one side and '(,) on the other. See also #9097.
* It is lifted, and hence represented by a pointer * It is lifted, and hence represented by a pointer
...@@ -771,20 +771,12 @@ anyTy :: Type ...@@ -771,20 +771,12 @@ anyTy :: Type
anyTy = mkTyConTy anyTyCon anyTy = mkTyConTy anyTyCon
anyTyCon :: TyCon anyTyCon :: TyCon
anyTyCon = mkLiftedPrimTyCon anyTyConName kind [Nominal] PtrRep anyTyCon = mkSynTyCon anyTyConName kind [kKiVar] [Nominal]
where kind = ForAllTy kKiVar (mkTyVarTy kKiVar)
{- Can't do this yet without messing up kind proxies
-- RAE: I think you can now.
anyTyCon :: TyCon
anyTyCon = mkSynTyCon anyTyConName kind [kKiVar]
syn_rhs syn_rhs
NoParentTyCon NoParentTyCon
where where
kind = ForAllTy kKiVar (mkTyVarTy kKiVar) kind = ForAllTy kKiVar (mkTyVarTy kKiVar)
syn_rhs = SynFamilyTyCon { synf_open = False, synf_injective = True } syn_rhs = AbstractClosedSynFamilyTyCon
-- NB Closed, injective
-}
anyTypeOfKind :: Kind -> Type anyTypeOfKind :: Kind -> Type
anyTypeOfKind kind = TyConApp anyTyCon [kind] anyTypeOfKind kind = TyConApp anyTyCon [kind]
......
...@@ -2437,7 +2437,7 @@ pseudoop "seq" ...@@ -2437,7 +2437,7 @@ pseudoop "seq"
{ Evaluates its first argument to head normal form, and then returns its second { Evaluates its first argument to head normal form, and then returns its second
argument as the result. } argument as the result. }
primtype Any k primtype Any
{ The type constructor {\tt Any} is type to which you can unsafely coerce any { The type constructor {\tt Any} is type to which you can unsafely coerce any
lifted type, and back. lifted type, and back.
...@@ -2462,8 +2462,11 @@ primtype Any k ...@@ -2462,8 +2462,11 @@ primtype Any k
{\tt length (Any *) ([] (Any *))} {\tt length (Any *) ([] (Any *))}
Note that {\tt Any} is kind polymorphic, and takes a kind {\tt k} as its Above, we print kinds explicitly, as if with
first argument. The kind of {\tt Any} is thus {\tt forall k. k -> k}.} {\tt -fprint-explicit-kinds}.
Note that {\tt Any} is kind polymorphic; its kind is thus
{\tt forall k. k}.}
primtype AnyK primtype AnyK
{ The kind {\tt AnyK} is the kind level counterpart to {\tt Any}. In a { The kind {\tt AnyK} is the kind level counterpart to {\tt Any}. In a
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment