aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Interface/Rename.hs
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2017-08-22 23:02:51 -0400
committerRyan Scott <ryan.gl.scott@gmail.com>2017-08-23 14:47:29 -0400
commit815d2deb9c0222c916becccf8464b740c26255fd (patch)
treed9ad3d510fac4bdc516f51e2966ca46034650f2c /haddock-api/src/Haddock/Interface/Rename.hs
parent648410f64b4a2423f2afe8afb6089b7749ebd4af (diff)
Update for #14131
Diffstat (limited to 'haddock-api/src/Haddock/Interface/Rename.hs')
-rw-r--r--haddock-api/src/Haddock/Interface/Rename.hs69
1 files changed, 42 insertions, 27 deletions
diff --git a/haddock-api/src/Haddock/Interface/Rename.hs b/haddock-api/src/Haddock/Interface/Rename.hs
index 2e9a311a..70962d9c 100644
--- a/haddock-api/src/Haddock/Interface/Rename.hs
+++ b/haddock-api/src/Haddock/Interface/Rename.hs
@@ -415,7 +415,7 @@ renameFamilyInfo :: FamilyInfo GhcRn -> RnM (FamilyInfo DocNameI)
renameFamilyInfo DataFamily = return DataFamily
renameFamilyInfo OpenTypeFamily = return OpenTypeFamily
renameFamilyInfo (ClosedTypeFamily eqns)
- = do { eqns' <- mapM (mapM renameLTyFamInstEqn) eqns
+ = do { eqns' <- mapM (mapM (mapM renameTyFamInstEqn)) eqns
; return $ ClosedTypeFamily eqns' }
renameDataDefn :: HsDataDefn GhcRn -> RnM (HsDataDefn DocNameI)
@@ -542,39 +542,54 @@ renameClsInstD (ClsInstDecl { cid_overlap_mode = omode
renameTyFamInstD :: TyFamInstDecl GhcRn -> RnM (TyFamInstDecl DocNameI)
renameTyFamInstD (TyFamInstDecl { tfid_eqn = eqn })
- = do { eqn' <- renameLTyFamInstEqn eqn
- ; return (TyFamInstDecl { tfid_eqn = eqn'
- , tfid_fvs = placeHolderNames }) }
-
-renameLTyFamInstEqn :: LTyFamInstEqn GhcRn -> RnM (LTyFamInstEqn DocNameI)
-renameLTyFamInstEqn (L loc (TyFamEqn { tfe_tycon = tc, tfe_pats = pats, tfe_fixity = fixity, tfe_rhs = rhs }))
- = do { tc' <- renameL tc
- ; pats' <- renameImplicit (mapM renameLType) pats
- ; rhs' <- renameLType rhs
- ; return (L loc (TyFamEqn { tfe_tycon = tc'
- , tfe_pats = pats'
- , tfe_fixity = fixity
- , tfe_rhs = rhs' })) }
+ = do { eqn' <- renameTyFamInstEqn eqn
+ ; return (TyFamInstDecl { tfid_eqn = eqn' }) }
+
+renameTyFamInstEqn :: TyFamInstEqn GhcRn -> RnM (TyFamInstEqn DocNameI)
+renameTyFamInstEqn eqn
+ = renameImplicit rename_ty_fam_eqn eqn
+ where
+ rename_ty_fam_eqn
+ :: FamEqn GhcRn (HsTyPats GhcRn) (LHsType GhcRn)
+ -> RnM (FamEqn DocNameI (HsTyPats DocNameI) (LHsType DocNameI))
+ rename_ty_fam_eqn (FamEqn { feqn_tycon = tc, feqn_pats = pats
+ , feqn_fixity = fixity, feqn_rhs = rhs })
+ = do { tc' <- renameL tc
+ ; pats' <- mapM renameLType pats
+ ; rhs' <- renameLType rhs
+ ; return (FamEqn { feqn_tycon = tc'
+ , feqn_pats = pats'
+ , feqn_fixity = fixity
+ , feqn_rhs = rhs' }) }
renameLTyFamDefltEqn :: LTyFamDefltEqn GhcRn -> RnM (LTyFamDefltEqn DocNameI)
-renameLTyFamDefltEqn (L loc (TyFamEqn { tfe_tycon = tc, tfe_pats = tvs, tfe_fixity = fixity, tfe_rhs = rhs }))
+renameLTyFamDefltEqn (L loc (FamEqn { feqn_tycon = tc, feqn_pats = tvs
+ , feqn_fixity = fixity, feqn_rhs = rhs }))
= do { tc' <- renameL tc
; tvs' <- renameLHsQTyVars tvs
; rhs' <- renameLType rhs
- ; return (L loc (TyFamEqn { tfe_tycon = tc'
- , tfe_pats = tvs'
- , tfe_fixity = fixity
- , tfe_rhs = rhs' })) }
+ ; return (L loc (FamEqn { feqn_tycon = tc'
+ , feqn_pats = tvs'
+ , feqn_fixity = fixity
+ , feqn_rhs = rhs' })) }
renameDataFamInstD :: DataFamInstDecl GhcRn -> RnM (DataFamInstDecl DocNameI)
-renameDataFamInstD (DataFamInstDecl { dfid_tycon = tc, dfid_pats = pats, dfid_fixity = fixity, dfid_defn = defn })
- = do { tc' <- renameL tc
- ; pats' <- renameImplicit (mapM renameLType) pats
- ; defn' <- renameDataDefn defn
- ; return (DataFamInstDecl { dfid_tycon = tc'
- , dfid_pats = pats'
- , dfid_fixity = fixity
- , dfid_defn = defn', dfid_fvs = placeHolderNames }) }
+renameDataFamInstD (DataFamInstDecl { dfid_eqn = eqn })
+ = do { eqn' <- renameImplicit rename_data_fam_eqn eqn
+ ; return (DataFamInstDecl { dfid_eqn = eqn' }) }
+ where
+ rename_data_fam_eqn
+ :: FamEqn GhcRn (HsTyPats GhcRn) (HsDataDefn GhcRn)
+ -> RnM (FamEqn DocNameI (HsTyPats DocNameI) (HsDataDefn DocNameI))
+ rename_data_fam_eqn (FamEqn { feqn_tycon = tc, feqn_pats = pats
+ , feqn_fixity = fixity, feqn_rhs = defn })
+ = do { tc' <- renameL tc
+ ; pats' <- mapM renameLType pats
+ ; defn' <- renameDataDefn defn
+ ; return (FamEqn { feqn_tycon = tc'
+ , feqn_pats = pats'
+ , feqn_fixity = fixity
+ , feqn_rhs = defn' }) }
renameImplicit :: (in_thing -> RnM out_thing)
-> HsImplicitBndrs GhcRn in_thing