summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Validity.hs
diff options
context:
space:
mode:
authorM Farkas-Dyck <strake888@proton.me>2022-10-22 15:04:11 -0800
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-11-23 21:59:03 -0500
commit040bfdc359fcc5415ab8836b38982c07c31ea6a2 (patch)
tree0787c8d7b473e6fca98231ce975209081c132573 /compiler/GHC/Tc/Validity.hs
parent99aca26b652603bc62953157a48e419f737d352d (diff)
downloadhaskell-040bfdc359fcc5415ab8836b38982c07c31ea6a2.tar.gz
Scrub some no-warning pragmas.
Diffstat (limited to 'compiler/GHC/Tc/Validity.hs')
-rw-r--r--compiler/GHC/Tc/Validity.hs20
1 files changed, 7 insertions, 13 deletions
diff --git a/compiler/GHC/Tc/Validity.hs b/compiler/GHC/Tc/Validity.hs
index 5072b8eeff..15168ddd2f 100644
--- a/compiler/GHC/Tc/Validity.hs
+++ b/compiler/GHC/Tc/Validity.hs
@@ -1734,15 +1734,12 @@ synonyms, by matching on TyConApp directly.
-}
checkValidInstance :: UserTypeCtxt -> LHsSigType GhcRn -> Type -> TcM ()
-checkValidInstance ctxt hs_type ty
- | not is_tc_app
- = failWithTc (TcRnNoClassInstHead tau)
-
- | isNothing mb_cls
- = failWithTc (TcRnIllegalClassInst (tyConFlavour tc))
-
- | otherwise
- = do { setSrcSpanA head_loc $
+checkValidInstance ctxt hs_type ty = case tau of
+ -- See Note [Instances and constraint synonyms]
+ TyConApp tc inst_tys -> case tyConClass_maybe tc of
+ Nothing -> failWithTc (TcRnIllegalClassInst (tyConFlavour tc))
+ Just clas -> do
+ { setSrcSpanA head_loc $
checkValidInstHead ctxt clas inst_tys
; traceTc "checkValidInstance {" (ppr ty)
@@ -1775,12 +1772,9 @@ checkValidInstance ctxt hs_type ty
; traceTc "End checkValidInstance }" empty
; return () }
+ _ -> failWithTc (TcRnNoClassInstHead tau)
where
(_tvs, theta, tau) = tcSplitSigmaTy ty
- is_tc_app = case tau of { TyConApp {} -> True; _ -> False }
- TyConApp tc inst_tys = tau -- See Note [Instances and constraint synonyms]
- mb_cls = tyConClass_maybe tc
- Just clas = mb_cls
-- The location of the "head" of the instance
head_loc = getLoc (getLHsInstDeclHead hs_type)