summaryrefslogtreecommitdiff
path: root/compiler/typecheck/TcDeriv.hs
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2018-04-18 23:55:14 +0200
committerAlan Zimmerman <alan.zimm@gmail.com>2018-04-27 15:38:46 +0200
commitc3823cba2147c74b2c727b5458b9e95350496988 (patch)
treee9afa7f5fd6b1a3f2f1a2ee87d659342803e6a2d /compiler/typecheck/TcDeriv.hs
parent313720a453889ddd05da02f4f2c31eb3bc3734d2 (diff)
downloadhaskell-c3823cba2147c74b2c727b5458b9e95350496988.tar.gz
TTG : complete for balance of hsSyn AST
Summary: - remove PostRn/PostTc fields - remove the HsVect In/Out distinction for Type, Class and Instance - remove PlaceHolder in favour of NoExt - Simplify OutputableX constraint Updates haddock submodule Test Plan: ./validate Reviewers: goldfire, bgamari Subscribers: goldfire, thomie, mpickering, carter Differential Revision: https://phabricator.haskell.org/D4625
Diffstat (limited to 'compiler/typecheck/TcDeriv.hs')
-rw-r--r--compiler/typecheck/TcDeriv.hs18
1 files changed, 12 insertions, 6 deletions
diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs
index 610fe5d6b1..b6a8185526 100644
--- a/compiler/typecheck/TcDeriv.hs
+++ b/compiler/typecheck/TcDeriv.hs
@@ -607,7 +607,7 @@ deriveStandalone :: LDerivDecl GhcRn -> TcM (Maybe EarlyDerivSpec)
--
-- This returns a Maybe because the user might try to derive Typeable, which is
-- a no-op nowadays.
-deriveStandalone (L loc (DerivDecl deriv_ty deriv_strat' overlap_mode))
+deriveStandalone (L loc (DerivDecl _ deriv_ty deriv_strat' overlap_mode))
= setSrcSpan loc $
addErrCtxt (standaloneCtxt deriv_ty) $
do { traceTc "Standalone deriving decl for" (ppr deriv_ty)
@@ -649,6 +649,7 @@ deriveStandalone (L loc (DerivDecl deriv_ty deriv_strat' overlap_mode))
bale_out $
text "The last argument of the instance must be a data or newtype application"
}
+deriveStandalone (L _ (XDerivDecl _)) = panic "deriveStandalone"
-- Typecheck the type in a standalone deriving declaration.
--
@@ -673,20 +674,21 @@ tcStandaloneDerivInstType
:: LHsSigWcType GhcRn
-> TcM ([TyVar], DerivContext, Class, [Type])
tcStandaloneDerivInstType
- (HsWC { hswc_body = deriv_ty@(HsIB { hsib_vars = vars
- , hsib_closed = closed
+ (HsWC { hswc_body = deriv_ty@(HsIB { hsib_ext = HsIBRn
+ { hsib_vars = vars
+ , hsib_closed = closed }
, hsib_body = deriv_ty_body })})
| (tvs, theta, rho) <- splitLHsSigmaTy deriv_ty_body
, L _ [wc_pred] <- theta
, L _ (HsWildCardTy (AnonWildCard (L wc_span _))) <- ignoreParens wc_pred
= do (deriv_tvs, _deriv_theta, deriv_cls, deriv_inst_tys)
<- tc_hs_cls_inst_ty $
- HsIB { hsib_vars = vars
- , hsib_closed = closed
+ HsIB { hsib_ext = HsIBRn { hsib_vars = vars
+ , hsib_closed = closed }
, hsib_body
= L (getLoc deriv_ty_body) $
HsForAllTy { hst_bndrs = tvs
- , hst_xforall = PlaceHolder
+ , hst_xforall = noExt
, hst_body = rho }}
pure (deriv_tvs, InferContext (Just wc_span), deriv_cls, deriv_inst_tys)
| otherwise
@@ -695,6 +697,10 @@ tcStandaloneDerivInstType
pure (deriv_tvs, SupplyContext deriv_theta, deriv_cls, deriv_inst_tys)
where
tc_hs_cls_inst_ty = tcHsClsInstType TcType.InstDeclCtxt
+tcStandaloneDerivInstType (HsWC _ (XHsImplicitBndrs _))
+ = panic "tcStandaloneDerivInstType"
+tcStandaloneDerivInstType (XHsWildCardBndrs _)
+ = panic "tcStandaloneDerivInstType"
warnUselessTypeable :: TcM ()
warnUselessTypeable