[commit: ghc] master: mkHiPath & mkObjPath didn't need to be in IO (a8d81af)

git at git.haskell.org git at git.haskell.org
Fri May 30 08:50:02 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/a8d81afa5eeecab04a4cf8eef577c689b0ebcd3e/ghc

>---------------------------------------------------------------

commit a8d81afa5eeecab04a4cf8eef577c689b0ebcd3e
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Fri May 16 10:18:03 2014 +0100

    mkHiPath & mkObjPath didn't need to be in IO


>---------------------------------------------------------------

a8d81afa5eeecab04a4cf8eef577c689b0ebcd3e
 compiler/main/Finder.lhs | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/compiler/main/Finder.lhs b/compiler/main/Finder.lhs
index c0e9f8a..cbfd4e4 100644
--- a/compiler/main/Finder.lhs
+++ b/compiler/main/Finder.lhs
@@ -434,8 +434,8 @@ mkHomeModLocation2 :: DynFlags
 mkHomeModLocation2 dflags mod src_basename ext = do
    let mod_basename = moduleNameSlashes mod
 
-   obj_fn  <- mkObjPath  dflags src_basename mod_basename
-   hi_fn   <- mkHiPath   dflags src_basename mod_basename
+       obj_fn = mkObjPath  dflags src_basename mod_basename
+       hi_fn  = mkHiPath   dflags src_basename mod_basename
 
    return (ModLocation{ ml_hs_file   = Just (src_basename <.> ext),
                         ml_hi_file   = hi_fn,
@@ -445,7 +445,7 @@ mkHiOnlyModLocation :: DynFlags -> Suffix -> FilePath -> String
                     -> IO ModLocation
 mkHiOnlyModLocation dflags hisuf path basename
  = do let full_basename = path </> basename
-      obj_fn  <- mkObjPath  dflags full_basename basename
+          obj_fn = mkObjPath  dflags full_basename basename
       return ModLocation{    ml_hs_file   = Nothing,
                              ml_hi_file   = full_basename <.> hisuf,
                                 -- Remove the .hi-boot suffix from
@@ -461,16 +461,15 @@ mkObjPath
   :: DynFlags
   -> FilePath           -- the filename of the source file, minus the extension
   -> String             -- the module name with dots replaced by slashes
-  -> IO FilePath
-mkObjPath dflags basename mod_basename
-  = do  let
+  -> FilePath
+mkObjPath dflags basename mod_basename = obj_basename <.> osuf
+  where
                 odir = objectDir dflags
                 osuf = objectSuf dflags
 
                 obj_basename | Just dir <- odir = dir </> mod_basename
                              | otherwise        = basename
 
-        return (obj_basename <.> osuf)
 
 -- | Constructs the filename of a .hi file for a given source file.
 -- Does /not/ check whether the .hi file exists
@@ -478,16 +477,15 @@ mkHiPath
   :: DynFlags
   -> FilePath           -- the filename of the source file, minus the extension
   -> String             -- the module name with dots replaced by slashes
-  -> IO FilePath
-mkHiPath dflags basename mod_basename
-  = do  let
+  -> FilePath
+mkHiPath dflags basename mod_basename = hi_basename <.> hisuf
+ where
                 hidir = hiDir dflags
                 hisuf = hiSuf dflags
 
                 hi_basename | Just dir <- hidir = dir </> mod_basename
                             | otherwise         = basename
 
-        return (hi_basename <.> hisuf)
 
 
 -- -----------------------------------------------------------------------------



More information about the ghc-commits mailing list