Skip to content

Commit 1e864d7

Browse files
committed
Print project type
1 parent 8f76871 commit 1e864d7

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

app/Main.hs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,20 @@ main = do
1717
pwd <- getCurrentDirectory
1818
files <- listDirectory pwd
1919
cfs <- cabalFiles pwd
20-
let sOrC =
21-
if | any (("dist-newstyle" ==) . takeFileName) files -> cabalHieYaml
22-
| any ((".stack-work" ==) . takeFileName) files -> stackHieYaml
23-
| any (("stack.yaml" ==) . takeFileName) files -> stackHieYaml
24-
| otherwise -> cabalHieYaml
20+
let cabal = (cabalHieYaml, "Cabal ")
21+
stack = (stackHieYaml, "Stack ")
22+
sOrC =
23+
if | any (("dist-newstyle" ==) . takeFileName) files -> cabal
24+
| any ((".stack-work" ==) . takeFileName) files -> stack
25+
| any (("stack.yaml" ==) . takeFileName) files -> stack
26+
| otherwise -> cabal
2527
gen f = do
2628
f' <- T.readFile f
2729
case parseOnly parsePackage f' of
2830
Right r -> do
2931
let hiePath = fst (splitFileName f) </> "hie.yaml"
30-
T.writeFile hiePath $ sOrC r
31-
pure ("wrote " <> hiePath)
32+
T.writeFile hiePath $ fst sOrC r
33+
pure ("wrote " <> snd sOrC <> hiePath)
3234
_ -> pure $ "Could not parse " <> f
3335
when (null cfs) $ error $
3436
"No .cabal files found under"

0 commit comments

Comments
 (0)