diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2016-09-25 03:50:13 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2016-10-21 17:16:03 +0100 |
commit | 9417e57983dbcf7f500cca16163b11d1abb699e6 (patch) | |
tree | bf40da0f06104b8cb43ee3d1cb51af3f1957f371 /compiler/prelude | |
parent | 1f09b246d377a0007a953e5a77545d81671d2e36 (diff) | |
download | haskell-9417e57983dbcf7f500cca16163b11d1abb699e6.tar.gz |
Refactor occurrence-check logic
This patch does two related things
* Combines the occurrence-check logic in the on-the-fly unifier with
that in the constraint solver. They are both doing the same job,
after all. The resulting code is now in TcUnify:
metaTyVarUpdateOK
occCheckExpand
occCheckForErrors (called in TcErrors)
* In doing this I disovered checking for family-free-ness and foralls
can be unnecessarily inefficient, because it expands type synonyms.
It's easy just to cache this info in the type syononym TyCon, which
I am now doing.
Diffstat (limited to 'compiler/prelude')
-rw-r--r-- | compiler/prelude/TysPrim.hs | 2 | ||||
-rw-r--r-- | compiler/prelude/TysWiredIn.hs | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/compiler/prelude/TysPrim.hs b/compiler/prelude/TysPrim.hs index 7430ec82c1..364aea41f1 100644 --- a/compiler/prelude/TysPrim.hs +++ b/compiler/prelude/TysPrim.hs @@ -454,6 +454,8 @@ tYPETyCon = mkKindTyCon tYPETyConName unliftedTypeKindTyCon = mkSynonymTyCon unliftedTypeKindTyConName [] liftedTypeKind [] (tYPE (TyConApp ptrRepUnliftedDataConTyCon [])) + True -- no foralls + True -- family free -------------------------- -- ... and now their names diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs index a954f0472f..7f4d072bfd 100644 --- a/compiler/prelude/TysWiredIn.hs +++ b/compiler/prelude/TysWiredIn.hs @@ -1055,15 +1055,15 @@ liftedTypeKindTyCon, starKindTyCon, unicodeStarKindTyCon :: TyCon -- type * = tYPE 'PtrRepLifted -- type * = tYPE 'PtrRepLifted -- Unicode variant -liftedTypeKindTyCon = mkSynonymTyCon liftedTypeKindTyConName +liftedTypeKindTyCon = buildSynTyCon liftedTypeKindTyConName [] liftedTypeKind [] (tYPE ptrRepLiftedTy) -starKindTyCon = mkSynonymTyCon starKindTyConName +starKindTyCon = buildSynTyCon starKindTyConName [] liftedTypeKind [] (tYPE ptrRepLiftedTy) -unicodeStarKindTyCon = mkSynonymTyCon unicodeStarKindTyConName +unicodeStarKindTyCon = buildSynTyCon unicodeStarKindTyConName [] liftedTypeKind [] (tYPE ptrRepLiftedTy) |