Make ordering consistent with hie-bios + Fix stack

This commit is contained in:
Avi Dessauer 2020-05-12 20:29:25 -04:00
parent b794a576b7
commit 58d729310b
2 changed files with 5 additions and 1 deletions

View File

@ -23,6 +23,7 @@ main = do
let name =
if | any (("dist-newstyle" ==) . takeFileName) files -> "cabal"
| any ((".stack-work" ==) . takeFileName) files -> "stack"
| any (("cabal.project" ==) . takeFileName) files -> "cabal"
| any (("stack.yaml" ==) . takeFileName) files -> "stack"
| otherwise -> "cabal"
cfs <- runMaybeT $ case name of

View File

@ -37,7 +37,10 @@ instance FromJSON Pkgs where
stackYamlPkgs :: FilePath -> MaybeT IO [FilePath]
stackYamlPkgs p = liftIO $
decodeFileEither (p </> "stack.yaml") >>= \case
Right (Pkgs f) -> pure f
Right (Pkgs f) ->
liftIO $
map (p </>)
<$> getDirectoryFiles p (map (</> "*.cabal") f)
Left e -> fail $ show e
cabalPkgs :: FilePath -> MaybeT IO [FilePath]