aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/GhcUtils.hs
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2021-05-16 21:21:03 +0100
committerAlan Zimmerman <alan.zimm@gmail.com>2021-05-20 19:05:09 +0100
commit3fe1ccd2393837c4e8bc788368c18b40f7dac918 (patch)
tree787f1a4cd2d37e3933fd909d8c25ed05b3359836 /haddock-api/src/Haddock/GhcUtils.hs
parent2fec1b44e0ee7e263286709aa528b4ecb99ac6c2 (diff)
Remove Maybe from HsQualTy
Match changes in GHC for #19845
Diffstat (limited to 'haddock-api/src/Haddock/GhcUtils.hs')
-rw-r--r--haddock-api/src/Haddock/GhcUtils.hs11
1 files changed, 4 insertions, 7 deletions
diff --git a/haddock-api/src/Haddock/GhcUtils.hs b/haddock-api/src/Haddock/GhcUtils.hs
index 1d6b8bc3..9353708a 100644
--- a/haddock-api/src/Haddock/GhcUtils.hs
+++ b/haddock-api/src/Haddock/GhcUtils.hs
@@ -171,7 +171,7 @@ getGADTConType (ConDeclGADT { con_bndrs = L _ outer_bndrs
, sig_body = theta_ty })
where
theta_ty | Just theta <- mcxt
- = noLocA (HsQualTy { hst_xqual = noAnn, hst_ctxt = Just theta, hst_body = tau_ty })
+ = noLocA (HsQualTy { hst_xqual = noAnn, hst_ctxt = theta, hst_body = tau_ty })
| otherwise
= tau_ty
@@ -226,12 +226,11 @@ addClassContext cls tvs0 (L pos (ClassOpSig _ _ lname ltype))
, hst_ctxt = add_ctxt ctxt, hst_body = ty })
go_ty (L loc ty)
= L loc (HsQualTy { hst_xqual = noExtField
- , hst_ctxt = add_ctxt Nothing, hst_body = L loc ty })
+ , hst_ctxt = add_ctxt (noLocA []), hst_body = L loc ty })
extra_pred = nlHsTyConApp Prefix cls (lHsQTyVarsToTypes tvs0)
- add_ctxt Nothing = Just $ noLocA [extra_pred]
- add_ctxt (Just (L loc preds)) = Just $ L loc (extra_pred : preds)
+ add_ctxt (L loc preds) = L loc (extra_pred : preds)
addClassContext _ _ sig = sig -- E.g. a MinimalSig is fine
@@ -356,9 +355,7 @@ reparenTypePrec = go
go p (HsQualTy x ctxt ty)
= let p' [_] = PREC_CTX
p' _ = PREC_TOP -- parens will get added anyways later...
- ctxt' = case ctxt of
- Nothing -> Nothing
- Just c -> Just $ mapXRec @a (\xs -> map (goL (p' xs)) xs) c
+ ctxt' = mapXRec @a (\xs -> map (goL (p' xs)) xs) ctxt
in paren p PREC_CTX $ HsQualTy x ctxt' (goL PREC_TOP ty)
-- = paren p PREC_FUN $ HsQualTy x (fmap (mapXRec @a (map reparenLType)) ctxt) (reparenLType ty)
go p (HsFunTy x w ty1 ty2)