mirror of
https://github.com/joshuaclayton/unused.git
synced 2024-09-11 04:45:28 +03:00
Use applicative style in Parsec
This commit also moves `eol` into the `parseTermMatch` parser, which should be safe since `parseTermMatches` is the only place that `parseTermMatch` is used.
This commit is contained in:
parent
3ff26fceea
commit
985d876ff5
@ -21,15 +21,7 @@ responseFromParse =
|
||||
fmap $ Map.fromList . map (second $ calculateLikelihood . resultsFromMatches) . groupBy tmTerm
|
||||
|
||||
parseTermMatches :: Parser [TermMatch]
|
||||
parseTermMatches = do
|
||||
tm <- many1 $ do
|
||||
m <- parseTermMatch
|
||||
void eol
|
||||
|
||||
return m
|
||||
eof
|
||||
|
||||
return tm
|
||||
parseTermMatches = many1 parseTermMatch <* eof
|
||||
|
||||
parseTermMatch :: Parser TermMatch
|
||||
parseTermMatch = do
|
||||
@ -38,6 +30,7 @@ parseTermMatch = do
|
||||
path' <- pathParser
|
||||
colonSep
|
||||
occurrences' <- occurrenceParser
|
||||
void eol
|
||||
|
||||
return $ TermMatch term' path' $ toInt occurrences'
|
||||
where
|
||||
|
Loading…
Reference in New Issue
Block a user