import HsSyn ( HsDecl(..), TyClDecl(..), InstDecl(..), IfaceSig(..),
HsType(..), ConDecl(..), IE(..), ConDetails(..), Sig(..),
FixitySig(..),
- hsDeclName, countTyClDecls, isDataDecl, nonFixitySigs
+ hsDeclName, countTyClDecls, isDataDecl, isClassOpSig
)
import BasicTypes ( Version, NewOrData(..) )
import RdrHsSyn ( RdrNameHsDecl, RdrNameInstDecl, RdrNameTyClDecl,
version
avail@(AvailTC tycon_name _)
ty_decl@(TyData new_or_data context tycon tyvars condecls derivings pragmas src_loc)
- | needed_name == tycon_name
- && opt_PruneTyDecls
+ | null condecls ||
+ -- HACK ALERT! If the data type is abstract then it must from a
+ -- hand-written hi-boot file. We put it in the deferred pile unconditionally,
+ -- because we don't want to read it in, and then later find a decl for a constructor
+ -- from that type, read the real interface file, and read in the full data type
+ -- decl again!!!
+
+ (needed_name == tycon_name
+ && opt_PruneTyDecls
-- don't prune newtypes, as the code generator may
-- want to peer inside a newtype type constructor
-- (ClosureInfo.fun_result_ty is the culprit.)
- && not (new_or_data == NewType)
- && not (nameUnique needed_name `elem` cCallishTyKeys)
+ && not (new_or_data == NewType)
+ && not (nameUnique needed_name `elem` cCallishTyKeys))
-- Hack! Don't prune these tycons whose constructors
-- the desugarer must be able to see when desugaring
-- a CCall. Ugh!
getImportedInstDecls
= -- First load any special-instance modules that aren't aready loaded
getSpecialInstModules `thenRn` \ inst_mods ->
- mapRn load_it inst_mods `thenRn_`
+ mapRn_ load_it inst_mods `thenRn_`
-- Now we're ready to grab the instance declarations
-- Find the un-gated ones and return them,
not (isLocallyDefined name)
]
in
- mapRn load (nub home_modules) `thenRn_`
+ mapRn_ load (nub home_modules) `thenRn_`
-- Now we can snaffle the fixity env
getIfacesRn `thenRn` \ ifaces ->
-- Record the names for the class ops
let
- -- ignoring fixity declarations
- nonfix_sigs = nonFixitySigs sigs
+ -- just want class-op sigs
+ op_sigs = filter isClassOpSig sigs
in
- mapRn (getClassOpNames new_name) nonfix_sigs `thenRn` \ sub_names ->
+ mapRn (getClassOpNames new_name) op_sigs `thenRn` \ sub_names ->
returnRn (Just (AvailTC class_name (class_name : sub_names)))