- case maybe_found of {
- Found loc pkg -> foundOk loc hi_boot_file pkg;
- err -> return (Left err) ;
- }}
- where
- foundOk loc hi_boot_file pkg = do { -- Don't need module returned by finder
-
- -- Return the path to M.hi, M.hi-boot, or M.hi-boot-n as appropriate
- let { hi_path = ml_hi_file loc ;
- hi_boot_path = replaceFilenameSuffix hi_path hiBootExt ;
- hi_boot_ver_path = replaceFilenameSuffix hi_path hiBootVerExt
- };
-
- if not hi_boot_file then
- return (Right (hi_path,pkg))
- else do {
- hi_ver_exists <- doesFileExist hi_boot_ver_path ;
- if hi_ver_exists then return (Right (hi_boot_ver_path,pkg))
- else return (Right (hi_boot_path,pkg))
- }}
+ case maybe_found of
+ Found loc pkg
+ | hi_boot_file -> do { hi_boot_path <- hiBootFilePath loc
+ ; return (Succeeded (hi_boot_path, pkg)) }
+ | otherwise -> return (Succeeded (ml_hi_file loc, pkg)) ;
+ err -> return (Failed err)
+ }