diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2021-05-04 08:45:08 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2021-05-06 23:22:19 +0100 |
commit | 2aeee2886818fc66cc23a92de2339fc56f5904c3 (patch) | |
tree | 3b5dae15c959efc50507b6169b715574862bbbb8 /compiler/Language/Haskell/Syntax | |
parent | 30f6923a834ccaca30c3622a0a82421fabcab119 (diff) | |
download | haskell-wip/T18481.tar.gz |
Allow visible type application for levity-poly data conswip/T18481
This patch was driven by #18481, to allow visible type application
for levity-polymorphic newtypes. As so often, it started simple
but grew:
* Significant refactor: I removed HsConLikeOut from the
client-independent Language.Haskell.Syntax.Expr, and put it where it
belongs, as a new constructor `ConLikeTc` in the GHC-specific extension
data type for expressions, `GHC.Hs.Expr.XXExprGhcTc`.
That changed touched a lot of files in a very superficial way.
* Note [Typechecking data constructors] explains the main payload.
The eta-expansion part is no longer done by the typechecker, but
instead deferred to the desugarer, via `ConLikeTc`
* A little side benefit is that I was able to restore VTA for
data types with a "stupid theta": #19775. Not very important,
but the code in GHC.Tc.Gen.Head.tcInferDataCon is is much, much
more elegant now.
* I had to refactor the levity-polymorphism checking code in
GHC.HsToCore.Expr, see
Note [Checking for levity-polymorphic functions]
Note [Checking levity-polymorphic data constructors]
Diffstat (limited to 'compiler/Language/Haskell/Syntax')
-rw-r--r-- | compiler/Language/Haskell/Syntax/Expr.hs | 4 | ||||
-rw-r--r-- | compiler/Language/Haskell/Syntax/Extension.hs | 1 |
2 files changed, 0 insertions, 5 deletions
diff --git a/compiler/Language/Haskell/Syntax/Expr.hs b/compiler/Language/Haskell/Syntax/Expr.hs index f795aa702f..bc60b30e38 100644 --- a/compiler/Language/Haskell/Syntax/Expr.hs +++ b/compiler/Language/Haskell/Syntax/Expr.hs @@ -44,7 +44,6 @@ import GHC.Types.Fixity import GHC.Types.SourceText import GHC.Types.SrcLoc import GHC.Types.Tickish -import GHC.Core.ConLike import GHC.Unit.Module (ModuleName) import GHC.Utils.Outputable import GHC.Utils.Panic @@ -282,9 +281,6 @@ data HsExpr p -- erroring expression will be written after -- solving. See Note [Holes] in GHC.Tc.Types.Constraint. - | HsConLikeOut (XConLikeOut p) - ConLike -- ^ After typechecker only; must be different - -- HsVar for pretty printing | HsRecFld (XRecFld p) (AmbiguousFieldOcc p) -- ^ Variable pointing to record selector diff --git a/compiler/Language/Haskell/Syntax/Extension.hs b/compiler/Language/Haskell/Syntax/Extension.hs index 7489e6fdaa..a7780a0cc1 100644 --- a/compiler/Language/Haskell/Syntax/Extension.hs +++ b/compiler/Language/Haskell/Syntax/Extension.hs @@ -385,7 +385,6 @@ type family XXInjectivityAnn x type family XVar x type family XUnboundVar x -type family XConLikeOut x type family XRecFld x type family XOverLabel x type family XIPVar x |