diff options
Diffstat (limited to 'compiler/iface')
-rw-r--r-- | compiler/iface/BuildTyCl.hs | 5 | ||||
-rw-r--r-- | compiler/iface/IfaceSyn.hs | 30 | ||||
-rw-r--r-- | compiler/iface/MkIface.hs | 5 | ||||
-rw-r--r-- | compiler/iface/TcIface.hs | 8 |
4 files changed, 16 insertions, 32 deletions
diff --git a/compiler/iface/BuildTyCl.hs b/compiler/iface/BuildTyCl.hs index 007f458c80..f23bbb3794 100644 --- a/compiler/iface/BuildTyCl.hs +++ b/compiler/iface/BuildTyCl.hs @@ -285,11 +285,10 @@ buildClass :: Name -- Name of the class/tycon (they have the same Name) -> [ClassATItem] -- Associated types -> [TcMethInfo] -- Method info -> ClassMinimalDef -- Minimal complete definition - -> RecFlag -- Info for type constructor -> TcRnIf m n Class buildClass tycon_name binders roles sc_theta - fds at_items sig_stuff mindef tc_isrec + fds at_items sig_stuff mindef = fixM $ \ rec_clas -> -- Only name generation inside loop do { traceIf (text "buildClass") @@ -356,7 +355,7 @@ buildClass tycon_name binders roles sc_theta else return (mkDataTyConRhs [dict_con]) ; let { tycon = mkClassTyCon tycon_name binders roles - rhs rec_clas tc_isrec tc_rep_name + rhs rec_clas tc_rep_name -- A class can be recursive, and in the case of newtypes -- this matters. For example -- class C a where { op :: C b => a -> b -> Int } diff --git a/compiler/iface/IfaceSyn.hs b/compiler/iface/IfaceSyn.hs index 283da53e87..689452f859 100644 --- a/compiler/iface/IfaceSyn.hs +++ b/compiler/iface/IfaceSyn.hs @@ -101,7 +101,6 @@ data IfaceDecl ifRoles :: [Role], -- Roles ifCtxt :: IfaceContext, -- The "stupid theta" ifCons :: IfaceConDecls, -- Includes new/data/data family info - ifRec :: RecFlag, -- Recursive or not? ifGadtSyntax :: Bool, -- True <=> declared using -- GADT syntax ifParent :: IfaceTyConParent -- The axiom, for a newtype, @@ -130,9 +129,7 @@ data IfaceDecl ifFDs :: [FunDep FastString], -- Functional dependencies ifATs :: [IfaceAT], -- Associated type families ifSigs :: [IfaceClassOp], -- Method signatures - ifMinDef :: BooleanFormula IfLclName, -- Minimal complete definition - ifRec :: RecFlag -- Is newtype/datatype associated - -- with the class recursive? + ifMinDef :: BooleanFormula IfLclName -- Minimal complete definition } | IfaceAxiom { ifName :: IfaceTopBndr, -- Axiom name @@ -625,7 +622,7 @@ pprIfaceDecl :: ShowSub -> IfaceDecl -> SDoc pprIfaceDecl ss (IfaceData { ifName = tycon, ifCType = ctype, ifCtxt = context, ifRoles = roles, ifCons = condecls, - ifParent = parent, ifRec = isrec, + ifParent = parent, ifGadtSyntax = gadt, ifBinders = binders }) @@ -671,10 +668,10 @@ pprIfaceDecl ss (IfaceData { ifName = tycon, ifCType = ctype, IfDataTyCon{} -> text "data" IfNewTyCon{} -> text "newtype" - pp_extra = vcat [pprCType ctype, pprRec isrec] + pp_extra = vcat [pprCType ctype] -pprIfaceDecl ss (IfaceClass { ifATs = ats, ifSigs = sigs, ifRec = isrec +pprIfaceDecl ss (IfaceClass { ifATs = ats, ifSigs = sigs , ifCtxt = context, ifName = clas , ifRoles = roles , ifFDs = fds, ifMinDef = minDef @@ -682,14 +679,13 @@ pprIfaceDecl ss (IfaceClass { ifATs = ats, ifSigs = sigs, ifRec = isrec = vcat [ pprRoles (== Nominal) (pprPrefixIfDeclBndr ss clas) binders roles , text "class" <+> pprIfaceDeclHead context ss clas binders Nothing <+> pprFundeps fds <+> pp_where - , nest 2 (vcat [ vcat asocs, vcat dsigs, pprec + , nest 2 (vcat [ vcat asocs, vcat dsigs , ppShowAllSubs ss (pprMinDef minDef)])] where pp_where = ppShowRhs ss $ ppUnless (null sigs && null ats) (text "where") asocs = ppr_trim $ map maybeShowAssoc ats dsigs = ppr_trim $ map maybeShowSig sigs - pprec = ppShowIface ss (pprRec isrec) maybeShowAssoc :: IfaceAT -> Maybe SDoc maybeShowAssoc asc@(IfaceAT d _) @@ -805,10 +801,6 @@ pprRoles suppress_if tyCon bndrs roles in ppUnless (all suppress_if roles || null froles) $ text "type role" <+> tyCon <+> hsep (map ppr froles) -pprRec :: RecFlag -> SDoc -pprRec NonRecursive = Outputable.empty -pprRec Recursive = text "RecFlag: Recursive" - pprInfixIfDeclBndr, pprPrefixIfDeclBndr :: ShowSub -> OccName -> SDoc pprInfixIfDeclBndr (ShowSub { ss_ppr_bndr = ppr_bndr }) occ = pprInfixVar (isSymOcc occ) (ppr_bndr occ) @@ -1453,7 +1445,7 @@ instance Binary IfaceDecl where put_ bh details put_ bh idinfo - put_ bh (IfaceData a1 a2 a3 a4 a5 a6 a7 a8 a9 a10) = do + put_ bh (IfaceData a1 a2 a3 a4 a5 a6 a7 a8 a9) = do putByte bh 2 put_ bh (occNameFS a1) put_ bh a2 @@ -1464,7 +1456,6 @@ instance Binary IfaceDecl where put_ bh a7 put_ bh a8 put_ bh a9 - put_ bh a10 put_ bh (IfaceSynonym a1 a2 a3 a4 a5) = do putByte bh 3 @@ -1483,7 +1474,7 @@ instance Binary IfaceDecl where put_ bh a5 put_ bh a6 - put_ bh (IfaceClass a1 a2 a3 a4 a5 a6 a7 a8 a9) = do + put_ bh (IfaceClass a1 a2 a3 a4 a5 a6 a7 a8) = do putByte bh 5 put_ bh a1 put_ bh (occNameFS a2) @@ -1493,7 +1484,6 @@ instance Binary IfaceDecl where put_ bh a6 put_ bh a7 put_ bh a8 - put_ bh a9 put_ bh (IfaceAxiom a1 a2 a3 a4) = do putByte bh 6 @@ -1535,9 +1525,8 @@ instance Binary IfaceDecl where a7 <- get bh a8 <- get bh a9 <- get bh - a10 <- get bh occ <- return $! mkTcOccFS a1 - return (IfaceData occ a2 a3 a4 a5 a6 a7 a8 a9 a10) + return (IfaceData occ a2 a3 a4 a5 a6 a7 a8 a9) 3 -> do a1 <- get bh a2 <- get bh a3 <- get bh @@ -1561,9 +1550,8 @@ instance Binary IfaceDecl where a6 <- get bh a7 <- get bh a8 <- get bh - a9 <- get bh occ <- return $! mkClsOccFS a2 - return (IfaceClass a1 occ a3 a4 a5 a6 a7 a8 a9) + return (IfaceClass a1 occ a3 a4 a5 a6 a7 a8) 6 -> do a1 <- get bh a2 <- get bh a3 <- get bh diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs index 1aa3111655..d6a70e4d43 100644 --- a/compiler/iface/MkIface.hs +++ b/compiler/iface/MkIface.hs @@ -1409,7 +1409,6 @@ tyConToIfaceDecl env tycon ifRoles = tyConRoles tycon, ifCtxt = tidyToIfaceContext tc_env1 (tyConStupidTheta tycon), ifCons = ifaceConDecls (algTyConRhs tycon) (algTcFields tycon), - ifRec = boolToRecFlag (isRecursiveTyCon tycon), ifGadtSyntax = isGadtSyntaxTyCon tycon, ifParent = parent }) @@ -1425,7 +1424,6 @@ tyConToIfaceDecl env tycon ifRoles = tyConRoles tycon, ifCtxt = [], ifCons = IfDataTyCon [] False [], - ifRec = boolToRecFlag False, ifGadtSyntax = False, ifParent = IfNoParent }) where @@ -1526,8 +1524,7 @@ classToIfaceDecl env clas ifFDs = map toIfaceFD clas_fds, ifATs = map toIfaceAT clas_ats, ifSigs = map toIfaceClassOp op_stuff, - ifMinDef = fmap getOccFS (classMinimalDef clas), - ifRec = boolToRecFlag (isRecursiveTyCon tycon) }) + ifMinDef = fmap getOccFS (classMinimalDef clas) }) where (_, clas_fds, sc_theta, _, clas_ats, op_stuff) = classExtraBigSig clas diff --git a/compiler/iface/TcIface.hs b/compiler/iface/TcIface.hs index d0ddd55197..5ffef1acfe 100644 --- a/compiler/iface/TcIface.hs +++ b/compiler/iface/TcIface.hs @@ -320,7 +320,7 @@ tc_iface_decl _ _ (IfaceData {ifName = occ_name, ifRoles = roles, ifCtxt = ctxt, ifGadtSyntax = gadt_syn, ifCons = rdr_cons, - ifRec = is_rec, ifParent = mb_parent }) + ifParent = mb_parent }) = bindIfaceTyConBinders_AT binders $ \ binders' -> do { tc_name <- lookupIfaceTop occ_name ; res_kind' <- tcIfaceType res_kind @@ -331,7 +331,7 @@ tc_iface_decl _ _ (IfaceData {ifName = occ_name, ; cons <- tcIfaceDataCons tc_name tycon binders' rdr_cons ; return (mkAlgTyCon tc_name binders' res_kind' roles cType stupid_theta - cons parent' is_rec gadt_syn) } + cons parent' gadt_syn) } ; traceIf (text "tcIfaceDecl4" <+> ppr tycon) ; return (ATyCon tycon) } where @@ -397,7 +397,7 @@ tc_iface_decl _parent ignore_prags ifBinders = binders, ifFDs = rdr_fds, ifATs = rdr_ats, ifSigs = rdr_sigs, - ifMinDef = mindef_occ, ifRec = tc_isrec }) + ifMinDef = mindef_occ }) -- ToDo: in hs-boot files we should really treat abstract classes specially, -- as we do abstract tycons = bindIfaceTyConBinders binders $ \ binders' -> do @@ -412,7 +412,7 @@ tc_iface_decl _parent ignore_prags ; cls <- fixM $ \ cls -> do { ats <- mapM (tc_at cls) rdr_ats ; traceIf (text "tc-iface-class4" <+> ppr tc_occ) - ; buildClass tc_name binders' roles ctxt fds ats sigs mindef tc_isrec } + ; buildClass tc_name binders' roles ctxt fds ats sigs mindef } ; return (ATyCon (classTyCon cls)) } where tc_sc pred = forkM (mk_sc_doc pred) (tcIfaceType pred) |