Closed
Description
I am trying to build hls-hlint-plugin in the above mentioned combination.
I get the following error:
src/Ide/Plugin/Hlint.hs:132:44: error:
• The constructor ‘GHC.RealSrcSpan’ should have 2 arguments, but has been given 1
• In the pattern: GHC.RealSrcSpan x
In the pattern: (GHC.RealSrcSpan x, y)
In the pattern: (, Nothing) -> (GHC.RealSrcSpan x, y)
|
132 | pattern RealSrcSpan x y <- ((,Nothing) -> (GHC.RealSrcSpan x, y))
| ^^^^^^^^^^^^^^^^^
src/Ide/Plugin/Hlint.hs:230:23: error:
• The constructor ‘RealSrcSpan’ should have no arguments, but has been given 2
• In the pattern: RealSrcSpan span _
In an equation for ‘srcSpanToRange’:
srcSpanToRange (RealSrcSpan span _)
= Range
{_start = Position
{_line = fromIntegral $ srcSpanStartLine span - 1,
_character = fromIntegral $ srcSpanStartCol span - 1},
_end = Position
{_line = fromIntegral $ srcSpanEndLine span - 1,
_character = fromIntegral $ srcSpanEndCol span - 1}}
In an equation for ‘rules’:
rules plugin
= do define $ \ GetHlintDiagnostics file -> ... defineNoFile $ \ GetHlintSettings -> ...
action
$ do files <- getFilesOfInterestUntracked
....
where
diagnostics ::
NormalizedFilePath -> Either ParseError [Idea] -> [FileDiagnostic]
diagnostics file (Right ideas)
= [(file, ShowDiag, ideaToDiagnostic i) |
i <- ideas, ideaSeverity i /= Ignore]
diagnostics file (Left parseErr)
= [(file, ShowDiag, parseErrorToDiagnostic parseErr)]
ideaToDiagnostic :: Idea -> Diagnostic
ideaToDiagnostic idea
= Diagnostic
{_range = srcSpanToRange $ ideaSpan idea, _severity = Just DsInfo,
_code = Just (InR $ T.pack $ codePre ++ ideaHint idea),
_source = Just "hlint", _message = idea2Message idea,
_relatedInformation = Nothing, _tags = Nothing}
where
codePre = ...
....
|
230 | srcSpanToRange (RealSrcSpan span _) = Range {
I might be holding it wrong, but my impression is, that this line should not compare ghc, but ghc-lib versions.
If someone more knowledgeable (e.g. @fendor) could tell me if that’s right, I‘d be very grateful.