- case parseIface contents 1 of
- Failed err ->
- --traceRn (ptext SLIT("parse err")) `thenRn_`
- failWithRn Nothing err
- Succeeded iface ->
- --traceRn (ptext SLIT("parse cool")) `thenRn_`
- returnRn (Just iface)
-
-#if __GLASGOW_HASKELL__ >= 202
- Left err ->
- if isDoesNotExistError err then
- --traceRn (ptext SLIT("no file")) `thenRn_`
- returnRn Nothing
- else
- --traceRn (ptext SLIT("uh-oh..")) `thenRn_`
- failWithRn Nothing (cannaeReadFile file_path err)
-#else /* 2.01 and 0.2x */
- Left (NoSuchThing _) -> returnRn Nothing
-
- Left err -> failWithRn Nothing
- (cannaeReadFile file_path err)
-#endif
+ case parseIface contents (mkSrcLoc (mkFastString file_path) 1) of
+ Failed err -> failWithRn Nothing err
+ Succeeded (PIface mod_nm iface) ->
+ (if mod_nm /= moduleFS requested_mod then
+ addWarnRn (hsep [ ptext SLIT("Something is amiss; requested module name")
+ , pprModule requested_mod
+ , ptext SLIT("differs from name found in the interface file ")
+ , pprEncodedFS mod_nm
+ ])
+ else
+ returnRn ()) `thenRn_`
+ let
+ the_mod
+ | is_dll = mkDynamicModule requested_mod
+ | otherwise = requested_mod
+ in
+ if opt_D_show_rn_imports then
+ putDocRn (hcat[ptext SLIT("Read module "), pprEncodedFS mod_nm,
+ ptext SLIT(" from "), text file_path]) `thenRn_`
+ returnRn (Just (the_mod, iface))
+ else
+ returnRn (Just (the_mod, iface))
+
+ Left err
+ | isDoesNotExistError err -> returnRn Nothing
+ | otherwise -> failWithRn Nothing (cannaeReadFile file_path err)