Skip to content

Commit e0215ae

Browse files
committed
Fix occurences of name-shadowing
1 parent f42e4c9 commit e0215ae

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/Nix/Effects/Basic.hs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ defaultMakeAbsolutePath origPath = do
6464
Nothing -> getCurrentDirectory
6565
Just v -> demand v $ \case
6666
NVPath s -> pure $ takeDirectory s
67-
v ->
67+
val ->
6868
throwError
6969
$ ErrorCall
7070
$ "when resolving relative path,"
7171
++ " __cur_file is in scope,"
7272
++ " but is not a path; it is: "
73-
++ show v
73+
++ show val
7474
pure $ cwd <///> origPathExpanded
7575
removeDotDotIndirections <$> canonicalizePath absPath
7676

@@ -111,13 +111,13 @@ findEnvPathM name = do
111111
where
112112
nixFilePath :: MonadEffects t f m => FilePath -> m (Maybe FilePath)
113113
nixFilePath path = do
114-
path <- makeAbsolutePath @t @f path
115-
exists <- doesDirectoryExist path
116-
path' <- if exists
117-
then makeAbsolutePath @t @f $ path </> "default.nix"
118-
else pure path
119-
exists <- doesFileExist path'
120-
pure $ if exists then Just path' else Nothing
114+
absPath <- makeAbsolutePath @t @f path
115+
isDir <- doesDirectoryExist absPath
116+
absFile <- if isDir
117+
then makeAbsolutePath @t @f $ absPath </> "default.nix"
118+
else return absPath
119+
exists <- doesFileExist absFile
120+
pure $ if exists then Just absFile else Nothing
121121

122122
findPathBy
123123
:: forall e t f m
@@ -226,13 +226,13 @@ findPathM
226226
=> [NValue t f m]
227227
-> FilePath
228228
-> m FilePath
229-
findPathM = findPathBy path
229+
findPathM = findPathBy existingPath
230230
where
231-
path :: MonadEffects t f m => FilePath -> m (Maybe FilePath)
232-
path path = do
233-
path <- makeAbsolutePath @t @f path
234-
exists <- doesPathExist path
235-
pure $ if exists then Just path else Nothing
231+
existingPath :: MonadEffects t f m => FilePath -> m (Maybe FilePath)
232+
existingPath path = do
233+
apath <- makeAbsolutePath @t @f path
234+
exists <- doesPathExist apath
235+
pure $ if exists then Just apath else Nothing
236236

237237
defaultImportPath
238238
:: (MonadNix e t f m, MonadState (HashMap FilePath NExprLoc) m)

0 commit comments

Comments
 (0)