Skip to content

Commit 2de791e

Browse files
committed
Find cabal file nested a cabal file dir
1 parent c5b0217 commit 2de791e

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/Hie/Locate.hs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ import System.FilePath.Posix
1919
nestedCabalFiles :: FilePath -> IO [FilePath]
2020
nestedCabalFiles f = do
2121
fs <- listDirectory f
22-
case filter ((".cabal" ==) . takeExtension) fs of
23-
h : _ -> pure [f </> h]
24-
_ ->
25-
fmap concat . mapM nestedCabalFiles
26-
=<< filterM
27-
(fmap (fileTypeIsDirectory . fileTypeFromMetadata) . getFileMetadata)
28-
( map (f </>) $
29-
filter
30-
(`notElem` [".git", "dist", "dist-newstyle", ".stack-work"])
31-
fs
32-
)
22+
nf <-
23+
fmap concat . mapM nestedCabalFiles
24+
=<< filterM
25+
(fmap (fileTypeIsDirectory . fileTypeFromMetadata) . getFileMetadata)
26+
( map (f </>) $
27+
filter
28+
(`notElem` [".git", "dist", "dist-newstyle", ".stack-work"])
29+
fs
30+
)
31+
let cf = filter ((".cabal" ==) . takeExtension) fs
32+
pure $ map (f </>) cf <> nf
3333

3434
nestedPkg :: FilePath -> FilePath -> IO (Maybe Package)
3535
nestedPkg parrent child = do

0 commit comments

Comments
 (0)