summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Deriv.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Tc/Deriv.hs')
-rw-r--r--compiler/GHC/Tc/Deriv.hs19
1 files changed, 8 insertions, 11 deletions
diff --git a/compiler/GHC/Tc/Deriv.hs b/compiler/GHC/Tc/Deriv.hs
index 9e9adbb961..407cb6a21b 100644
--- a/compiler/GHC/Tc/Deriv.hs
+++ b/compiler/GHC/Tc/Deriv.hs
@@ -500,7 +500,7 @@ derivePred tc tys mb_lderiv_strat via_tvs deriv_pred =
-- We carefully set up uses of recoverM to minimize error message
-- cascades. See Note [Recovering from failures in deriving clauses].
recoverM (pure Nothing) $
- setSrcSpan (getLoc (hsSigType deriv_pred)) $ do
+ setSrcSpan (getLoc deriv_pred) $ do
traceTc "derivePred" $ vcat
[ text "tc" <+> ppr tc
, text "tys" <+> ppr tys
@@ -718,18 +718,15 @@ tcStandaloneDerivInstType
:: UserTypeCtxt -> LHsSigWcType GhcRn
-> TcM ([TyVar], DerivContext, Class, [Type])
tcStandaloneDerivInstType ctxt
- (HsWC { hswc_body = deriv_ty@(HsIB { hsib_ext = vars
- , hsib_body = deriv_ty_body })})
- | (tvs, theta, rho) <- splitLHsSigmaTyInvis deriv_ty_body
+ (HsWC { hswc_body = deriv_ty@(L loc (HsSig { sig_bndrs = outer_bndrs
+ , sig_body = deriv_ty_body }))})
+ | (theta, rho) <- splitLHsQualTy deriv_ty_body
, L _ [wc_pred] <- theta
, L wc_span (HsWildCardTy _) <- ignoreParens wc_pred
- = do dfun_ty <- tcHsClsInstType ctxt $
- HsIB { hsib_ext = vars
- , hsib_body
- = L (getLoc deriv_ty_body) $
- HsForAllTy { hst_tele = mkHsForAllInvisTele tvs
- , hst_xforall = noExtField
- , hst_body = rho }}
+ = do dfun_ty <- tcHsClsInstType ctxt $ L loc $
+ HsSig { sig_ext = noExtField
+ , sig_bndrs = outer_bndrs
+ , sig_body = rho }
let (tvs, _theta, cls, inst_tys) = tcSplitDFunTy dfun_ty
pure (tvs, InferContext (Just wc_span), cls, inst_tys)
| otherwise