summaryrefslogtreecommitdiff
path: root/compiler/GHC/HsToCore/Expr.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/HsToCore/Expr.hs')
-rw-r--r--compiler/GHC/HsToCore/Expr.hs18
1 files changed, 8 insertions, 10 deletions
diff --git a/compiler/GHC/HsToCore/Expr.hs b/compiler/GHC/HsToCore/Expr.hs
index 5feee52901..834be5907d 100644
--- a/compiler/GHC/HsToCore/Expr.hs
+++ b/compiler/GHC/HsToCore/Expr.hs
@@ -773,23 +773,21 @@ dsHsConLike (PatSynCon ps)
| otherwise
= pprPanic "dsConLike" (ppr ps)
-dsConLike :: ConLike -> [TcTyVar] -> [Scaled Type] -> DsM CoreExpr
--- This function desugars ConLikeTc
+-- | This function desugars 'ConLikeTc': it eta-expands
+-- data constructors to make linear types work.
+--
-- See Note [Typechecking data constructors] in GHC.Tc.Gen.Head
--- for what is going on here
+dsConLike :: ConLike -> [TcTyVar] -> [Scaled Type] -> DsM CoreExpr
dsConLike con tvs tys
= do { ds_con <- dsHsConLike con
; ids <- newSysLocalsDs tys
- -- newSysLocalDs: /can/ be lev-poly; see
+ -- NB: these 'Id's may be representation-polymorphic;
+ -- see Wrinkle [Representation-polymorphic lambda] in
+ -- Note [Typechecking data constructors] in GHC.Tc.Gen.Head.
; return (mkLams tvs $
mkLams ids $
ds_con `mkTyApps` mkTyVarTys tvs
- `mkVarApps` drop_stupid ids) }
- where
-
- drop_stupid = dropList (conLikeStupidTheta con)
- -- drop_stupid: see Note [Instantiating stupid theta]
- -- in GHC.Tc.Gen.Head
+ `mkVarApps` ids) }
{-
************************************************************************