[commit: ghc] wip/generalized-arrow: CoreLint: Check that there are no saturated (->) applications (89b2685)
git at git.haskell.org
git at git.haskell.org
Fri Mar 25 23:24:28 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/generalized-arrow
Link : http://ghc.haskell.org/trac/ghc/changeset/89b26858b53be665cc1de3c5f4b36170fd67d01e/ghc
>---------------------------------------------------------------
commit 89b26858b53be665cc1de3c5f4b36170fd67d01e
Author: Ben Gamari <ben at smart-cactus.org>
Date: Fri Mar 25 13:28:40 2016 +0100
CoreLint: Check that there are no saturated (->) applications
>---------------------------------------------------------------
89b26858b53be665cc1de3c5f4b36170fd67d01e
compiler/coreSyn/CoreLint.hs | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs
index ef44aff..1c40049 100644
--- a/compiler/coreSyn/CoreLint.hs
+++ b/compiler/coreSyn/CoreLint.hs
@@ -127,6 +127,12 @@ Outstanding issues:
-- may well be happening...);
+Note [Linting function types]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+As described in Note [Representation of function types], all saturated
+applications of funTyCon are represented with ForAllTy. We check this
+invariant in lintType.
+
Note [Linting type lets]
~~~~~~~~~~~~~~~~~~~~~~~~
In the desugarer, it's very very convenient to be able to say (in effect)
@@ -1033,6 +1039,12 @@ lintType ty@(TyConApp tc tys)
= lintType ty' -- Expand type synonyms, so that we do not bogusly complain
-- about un-saturated type synonyms
+ -- We should never see a saturated application of funTyCon; such applications
+ -- should be represented with ForAllTy. See Note [Linting function types].
+ | isFunTyCon tc
+ , length tys == 4
+ = failWithL (hang (text "Saturated application of (->)") 2 (ppr ty))
+
| isUnliftedTyCon tc || isTypeSynonymTyCon tc || isTypeFamilyTyCon tc
-- Also type synonyms and type families
, length tys < tyConArity tc
More information about the ghc-commits
mailing list