File tree Expand file tree Collapse file tree 3 files changed +17
-17
lines changed Expand file tree Collapse file tree 3 files changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,6 @@ main = do
21
21
| otherwise -> stackHieYaml
22
22
when (null path) $ error " No .cabal file found!\n You may need to run stack build."
23
23
file <- T. readFile $ head path
24
- case parseOnly parseSec file of
24
+ case parseOnly parsePackage file of
25
25
Right r -> T. writeFile " hie.yaml" $ sOrC r
26
26
_ -> error " Could not parse *.cabal file"
Original file line number Diff line number Diff line change @@ -24,19 +24,19 @@ data Component = Lib Path | Exe Name Path | Test Name Path
24
24
parseName :: Parser Text
25
25
parseName = " name" >> skipSpace >> char ' :' >> parseString
26
26
27
- parseSec :: Parser Package
28
- parseSec =
27
+ parsePackage :: Parser Package
28
+ parsePackage =
29
29
( do
30
30
n <- parseName
31
- (Package _ t) <- parseSec
31
+ (Package _ t) <- parsePackage
32
32
pure $ Package n t
33
33
)
34
34
<|> ( do
35
35
h <- parseComponent 0
36
- (Package n t) <- parseSec
36
+ (Package n t) <- parsePackage
37
37
pure $ Package n (h : t)
38
38
)
39
- <|> (skipToNextLine >> parseSec )
39
+ <|> (skipToNextLine >> parsePackage )
40
40
<|> pure (Package " " [] )
41
41
42
42
parseComponent :: Indent -> Parser Component
Original file line number Diff line number Diff line change @@ -26,23 +26,23 @@ spec = do
26
26
$ libSection ~> parseLib 0
27
27
`shouldParse` Lib " src"
28
28
describe " Should Succeed"
29
- $ it " successfully parses library section "
30
- $ fullFile ~> parseSec
31
- `shouldParse` Package
32
- " implicit-hie"
33
- [ Lib " src" ,
29
+ $ it " successfully parses package "
30
+ $ fullFile ~> parsePackage
31
+ `shouldParse` Package
32
+ " implicit-hie"
33
+ [ Lib " src" ,
34
34
Exe " implicit-hie-exe" " app" ,
35
35
Test " implicit-hie-test" " test"
36
- ]
37
- describe " Should Succeed"
38
- $ it
39
- " successfully parses library section"
40
- $ let r = " test\n "
36
+ ]
37
+ describe " Should Succeed"
38
+ $ it
39
+ " skips to end of block section"
40
+ $ let r = " test\n "
41
41
in (libSection <> r) ~?> parseLib 0
42
42
`leavesUnconsumed` r
43
43
describe " Should Succeed"
44
44
$ it " successfully generates stack hie.yaml"
45
- $ (stackHieYaml <$> parseOnly parseSec fullFile) `shouldBe` Right stackHie
45
+ $ (stackHieYaml <$> parseOnly parsePackage fullFile) `shouldBe` Right stackHie
46
46
47
47
fullFile :: Text
48
48
fullFile = " name: implicit-hie\n " <> libSection <> exeSection <> testSection
You can’t perform that action at this time.
0 commit comments