- Failed err -> failWithRn Nothing err
- Succeeded (PIface iface) ->
- if opt_D_show_rn_imports then
- putDocRn (hcat[ptext SLIT("Read "), text file_path]) `thenRn_`
- returnRn (Just iface)
- else
- returnRn (Just iface)
-
- Left err ->
- if isDoesNotExistError err then
- returnRn Nothing
- else
- failWithRn Nothing (cannaeReadFile file_path err)
+ 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)
+