Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
philderbeast committed Aug 2, 2024
1 parent a6f9190 commit 8e172fa
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/Hint/Comment.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,15 @@ directives = words $
"CONLIKE LINE SPECIALIZE SPECIALISE UNPACK NOUNPACK SOURCE"

data Comments = Comments
{ commBlocks :: [[LEpaComment]]
, commRuns :: [[LEpaComment]]
, commLines :: [LEpaComment]
{ commBlocks :: ![LEpaComment]

Check failure on line 37 in src/Hint/Comment.hs

View workflow job for this annotation

GitHub Actions / test (macOS-latest, 9.8)

Defined but not used: record field of Comments ‘commBlocks’
, commRuns :: ![[LEpaComment]]

Check failure on line 38 in src/Hint/Comment.hs

View workflow job for this annotation

GitHub Actions / test (macOS-latest, 9.8)

Defined but not used: record field of Comments ‘commRuns’
, commLines :: ![LEpaComment]

Check failure on line 39 in src/Hint/Comment.hs

View workflow job for this annotation

GitHub Actions / test (macOS-latest, 9.8)

Defined but not used: record field of Comments ‘commLines’
}

classifyComments :: [LEpaComment] -> Comments
classifyComments xs = Comments blocks runs lines
where
blocks = []
runs = commentRuns xs
lines = []

commentBlocks :: [LEpaComment] -> [[LEpaComment]]
commentBlocks = undefined
classifyComments xs = Comments blocks runs lines where
(blocks, singles) = partition isCommentMultiline xs
(concat -> lines, runs) = partition ((== 1) . length) $ commentRuns singles

commentRuns :: [LEpaComment] -> [[LEpaComment]]
commentRuns comments =
Expand Down Expand Up @@ -114,6 +109,9 @@ commentHint _ m =
-- b) runs of single-line comments
-- c) single-line comments
-- TODO: Remove (True, _) runs and then run the other checks on the rest.
traceShow ("blocks", commentText <$> blocks) $
traceShow ("runs", fmap commentText <$> rawRuns) $
traceShow ("lines", commentText <$> lines) $
if any fst runs
then concatMap snd runs
else concatMap (check singleLines someLines) comments
Expand All @@ -127,7 +125,7 @@ commentHint _ m =
singleLines = sort $ commentLine <$> filter isSingle comments
someLines = sort $ commentLine <$> filter isSingleSome comments

Comments _blocks rawRuns _lines = classifyComments comments
Comments blocks rawRuns lines = classifyComments comments

runs = dropBlankLinesHint <$> rawRuns

Expand Down

0 comments on commit 8e172fa

Please sign in to comment.