Skip to content
Snippets Groups Projects
Commit d832b6b4 authored by Thomas Miedema's avatar Thomas Miedema
Browse files

Refactor: follow hlint suggestions in Linker.hs

Reviewed By: austin

Differential Revision: https://phabricator.haskell.org/D739
parent c718bd85
No related branches found
No related tags found
No related merge requests found
...@@ -58,6 +58,7 @@ import Control.Monad ...@@ -58,6 +58,7 @@ import Control.Monad
import Data.IORef import Data.IORef
import Data.List import Data.List
import Data.Maybe
import Control.Concurrent.MVar import Control.Concurrent.MVar
import System.FilePath import System.FilePath
...@@ -314,7 +315,7 @@ linkCmdLineLibs' dflags@(DynFlags { ldInputs = cmdline_ld_inputs ...@@ -314,7 +315,7 @@ linkCmdLineLibs' dflags@(DynFlags { ldInputs = cmdline_ld_inputs
else ([],[]) else ([],[])
-- Finally do (c),(d),(e) -- Finally do (c),(d),(e)
; let cmdline_lib_specs = [ l | Just l <- classified_ld_inputs ] ; let cmdline_lib_specs = catMaybes classified_ld_inputs
++ libspecs ++ libspecs
++ map Framework frameworks ++ map Framework frameworks
; if null cmdline_lib_specs then return pls ; if null cmdline_lib_specs then return pls
...@@ -368,7 +369,7 @@ classifyLdInput dflags f ...@@ -368,7 +369,7 @@ classifyLdInput dflags f
where platform = targetPlatform dflags where platform = targetPlatform dflags
preloadLib :: DynFlags -> [String] -> [String] -> PersistentLinkerState preloadLib :: DynFlags -> [String] -> [String] -> PersistentLinkerState
-> LibrarySpec -> IO (PersistentLinkerState) -> LibrarySpec -> IO PersistentLinkerState
preloadLib dflags lib_paths framework_paths pls lib_spec preloadLib dflags lib_paths framework_paths pls lib_spec
= do maybePutStr dflags ("Loading object " ++ showLS lib_spec ++ " ... ") = do maybePutStr dflags ("Loading object " ++ showLS lib_spec ++ " ... ")
case lib_spec of case lib_spec of
...@@ -428,7 +429,7 @@ preloadLib dflags lib_paths framework_paths pls lib_spec ...@@ -428,7 +429,7 @@ preloadLib dflags lib_paths framework_paths pls lib_spec
++ sys_errmsg ++ ")\nWhilst trying to load: " ++ sys_errmsg ++ ")\nWhilst trying to load: "
++ showLS spec ++ "\nAdditional directories searched:" ++ showLS spec ++ "\nAdditional directories searched:"
++ (if null paths then " (none)" else ++ (if null paths then " (none)" else
(concat (intersperse "\n" (map (" "++) paths))))) intercalate "\n" (map (" "++) paths)))
-- Not interested in the paths in the static case. -- Not interested in the paths in the static case.
preload_static _paths name preload_static _paths name
...@@ -1173,9 +1174,7 @@ load_dyn dll = do r <- loadDLL dll ...@@ -1173,9 +1174,7 @@ load_dyn dll = do r <- loadDLL dll
loadFrameworks :: Platform -> PackageConfig -> IO () loadFrameworks :: Platform -> PackageConfig -> IO ()
loadFrameworks platform pkg loadFrameworks platform pkg
= if platformUsesFrameworks platform = when (platformUsesFrameworks platform) $ mapM_ load frameworks
then mapM_ load frameworks
else return ()
where where
fw_dirs = Packages.frameworkDirs pkg fw_dirs = Packages.frameworkDirs pkg
frameworks = Packages.frameworks pkg frameworks = Packages.frameworks pkg
...@@ -1235,10 +1234,7 @@ locateLib dflags is_hs dirs lib ...@@ -1235,10 +1234,7 @@ locateLib dflags is_hs dirs lib
assumeDll = return (DLL lib) assumeDll = return (DLL lib)
infixr `orElse` infixr `orElse`
f `orElse` g = do m <- f f `orElse` g = f >>= maybe g return
case m of
Just x -> return x
Nothing -> g
platform = targetPlatform dflags platform = targetPlatform dflags
arch = platformArch platform arch = platformArch platform
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment