diff options
author | Thomas Miedema <thomasmiedema@gmail.com> | 2015-03-19 19:13:09 +0100 |
---|---|---|
committer | Thomas Miedema <thomasmiedema@gmail.com> | 2015-03-19 19:13:23 +0100 |
commit | d832b6b4e899b1ec2d1bec9687de821ba8d2b67e (patch) | |
tree | 6d06e1b24b85d028e346b1f8498bf141bb38b222 | |
parent | c718bd85caffceb19707d4bacd63b2d3e405aaa9 (diff) | |
download | haskell-d832b6b4e899b1ec2d1bec9687de821ba8d2b67e.tar.gz |
Refactor: follow hlint suggestions in Linker.hs
Reviewed By: austin
Differential Revision: https://phabricator.haskell.org/D739
-rw-r--r-- | compiler/ghci/Linker.hs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs index cb247027d3..9446e3df2b 100644 --- a/compiler/ghci/Linker.hs +++ b/compiler/ghci/Linker.hs @@ -58,6 +58,7 @@ import Control.Monad import Data.IORef import Data.List +import Data.Maybe import Control.Concurrent.MVar import System.FilePath @@ -314,7 +315,7 @@ linkCmdLineLibs' dflags@(DynFlags { ldInputs = cmdline_ld_inputs else ([],[]) -- Finally do (c),(d),(e) - ; let cmdline_lib_specs = [ l | Just l <- classified_ld_inputs ] + ; let cmdline_lib_specs = catMaybes classified_ld_inputs ++ libspecs ++ map Framework frameworks ; if null cmdline_lib_specs then return pls @@ -368,7 +369,7 @@ classifyLdInput dflags f where platform = targetPlatform dflags preloadLib :: DynFlags -> [String] -> [String] -> PersistentLinkerState - -> LibrarySpec -> IO (PersistentLinkerState) + -> LibrarySpec -> IO PersistentLinkerState preloadLib dflags lib_paths framework_paths pls lib_spec = do maybePutStr dflags ("Loading object " ++ showLS lib_spec ++ " ... ") case lib_spec of @@ -428,7 +429,7 @@ preloadLib dflags lib_paths framework_paths pls lib_spec ++ sys_errmsg ++ ")\nWhilst trying to load: " ++ showLS spec ++ "\nAdditional directories searched:" ++ (if null paths then " (none)" else - (concat (intersperse "\n" (map (" "++) paths))))) + intercalate "\n" (map (" "++) paths))) -- Not interested in the paths in the static case. preload_static _paths name @@ -1173,9 +1174,7 @@ load_dyn dll = do r <- loadDLL dll loadFrameworks :: Platform -> PackageConfig -> IO () loadFrameworks platform pkg - = if platformUsesFrameworks platform - then mapM_ load frameworks - else return () + = when (platformUsesFrameworks platform) $ mapM_ load frameworks where fw_dirs = Packages.frameworkDirs pkg frameworks = Packages.frameworks pkg @@ -1235,10 +1234,7 @@ locateLib dflags is_hs dirs lib assumeDll = return (DLL lib) infixr `orElse` - f `orElse` g = do m <- f - case m of - Just x -> return x - Nothing -> g + f `orElse` g = f >>= maybe g return platform = targetPlatform dflags arch = platformArch platform |