Fix occurences of name-shadowing
This commit is contained in:
parent
b6b06224c5
commit
2a7a447a7d
|
@ -64,13 +64,13 @@ defaultMakeAbsolutePath origPath = do
|
||||||
Nothing -> getCurrentDirectory
|
Nothing -> getCurrentDirectory
|
||||||
Just v -> demand v $ \case
|
Just v -> demand v $ \case
|
||||||
NVPath s -> pure $ takeDirectory s
|
NVPath s -> pure $ takeDirectory s
|
||||||
v ->
|
val ->
|
||||||
throwError
|
throwError
|
||||||
$ ErrorCall
|
$ ErrorCall
|
||||||
$ "when resolving relative path,"
|
$ "when resolving relative path,"
|
||||||
++ " __cur_file is in scope,"
|
++ " __cur_file is in scope,"
|
||||||
++ " but is not a path; it is: "
|
++ " but is not a path; it is: "
|
||||||
++ show v
|
++ show val
|
||||||
pure $ cwd <///> origPathExpanded
|
pure $ cwd <///> origPathExpanded
|
||||||
removeDotDotIndirections <$> canonicalizePath absPath
|
removeDotDotIndirections <$> canonicalizePath absPath
|
||||||
|
|
||||||
|
@ -111,13 +111,13 @@ findEnvPathM name = do
|
||||||
where
|
where
|
||||||
nixFilePath :: MonadEffects t f m => FilePath -> m (Maybe FilePath)
|
nixFilePath :: MonadEffects t f m => FilePath -> m (Maybe FilePath)
|
||||||
nixFilePath path = do
|
nixFilePath path = do
|
||||||
path <- makeAbsolutePath @t @f path
|
absPath <- makeAbsolutePath @t @f path
|
||||||
exists <- doesDirectoryExist path
|
isDir <- doesDirectoryExist absPath
|
||||||
path' <- if exists
|
absFile <- if isDir
|
||||||
then makeAbsolutePath @t @f $ path </> "default.nix"
|
then makeAbsolutePath @t @f $ absPath </> "default.nix"
|
||||||
else pure path
|
else return absPath
|
||||||
exists <- doesFileExist path'
|
exists <- doesFileExist absFile
|
||||||
pure $ if exists then Just path' else Nothing
|
pure $ if exists then Just absFile else Nothing
|
||||||
|
|
||||||
findPathBy
|
findPathBy
|
||||||
:: forall e t f m
|
:: forall e t f m
|
||||||
|
@ -226,13 +226,13 @@ findPathM
|
||||||
=> [NValue t f m]
|
=> [NValue t f m]
|
||||||
-> FilePath
|
-> FilePath
|
||||||
-> m FilePath
|
-> m FilePath
|
||||||
findPathM = findPathBy path
|
findPathM = findPathBy existingPath
|
||||||
where
|
where
|
||||||
path :: MonadEffects t f m => FilePath -> m (Maybe FilePath)
|
existingPath :: MonadEffects t f m => FilePath -> m (Maybe FilePath)
|
||||||
path path = do
|
existingPath path = do
|
||||||
path <- makeAbsolutePath @t @f path
|
apath <- makeAbsolutePath @t @f path
|
||||||
exists <- doesPathExist path
|
exists <- doesPathExist apath
|
||||||
pure $ if exists then Just path else Nothing
|
pure $ if exists then Just apath else Nothing
|
||||||
|
|
||||||
defaultImportPath
|
defaultImportPath
|
||||||
:: (MonadNix e t f m, MonadState (HashMap FilePath NExprLoc) m)
|
:: (MonadNix e t f m, MonadState (HashMap FilePath NExprLoc) m)
|
||||||
|
|
Loading…
Reference in a new issue