Skip to content

Build failure with HLS-hlint-plugin #3839

Closed
@Vekhir

Description

@Vekhir

Your environment

OS: Arch Linux
Kernel: Linux 6.5.6-arch2-1
Built from source (u = updated version):
GHC: 9.2.8 (u)
haskell-apply-refact: 0.11.0.0 (u)
haskell-hls-hlint-plugin: 1.1.1.0
haskell-ghc-exactprint: 1.5.0 (u)
haskell-hls-plugin-api: 1.6.0.0
haskell-ghc-lib-parser: 9.2.8.20230729 (u)
haskell-ghc-lib-parser-ex: 9.2.1.1 (u)

For brevity, all other packages dependent on GHC have been rebuilt aswell. I can provide a complete list of changes on request.

What's wrong?

HLS-Hlint-Plugin in version 1.1.1.0 should work with haskell-apply-refact 0.11.0.0. Instead, however, there are build errors (see below), so the build fails. Due to the various version constraints, I can't cleanly separate the effects of updating GHC, apply-refact, and the other components. Updating apply-refact to 0.13.0.0 has no effect, and updating hls-hlint-plugin to 1.1.2.0 also has no effect.

I don't have this issue with any other plugin.

Do you have an idea where to look for potential issues or solutions? Has this been fixed in later versions? I'm mainly looking for a patch to backport rather than updating HLS, as I'm for example constrained by fourmolu to stay below 2.3.0.0.

Debug information

During building of HLS-Hlint-Plugin, the following series of errors occurs:

Configuring hls-hlint-plugin-1.1.1.0...
Preprocessing library for hls-hlint-plugin-1.1.1.0..
Building library for hls-hlint-plugin-1.1.1.0..
[1 of 1] Compiling Ide.Plugin.Hlint ( src/Ide/Plugin/Hlint.hs, dist/build/Ide/Plugin/Hlint.dyn_o )

src/Ide/Plugin/Hlint.hs:300:38: error:
    • Couldn't match expected type ‘ParsedSource -> b’
                  with actual type ‘ModuleEx’
    • The function ‘createModuleEx’ is applied to two value arguments,
        but its type ‘Located HsModule -> ModuleEx’ has only one
      In the first argument of ‘Right’, namely
        ‘(createModuleEx anns (applyParseFlagsFixities modu))’
      In the expression:
        Right (createModuleEx anns (applyParseFlagsFixities modu))
    • Relevant bindings include
        createModule :: ParsedModule -> Either a b
          (bound at src/Ide/Plugin/Hlint.hs:300:13)
    |
300 |             createModule pm = Right (createModuleEx anns (applyParseFlagsFixities modu))
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Ide/Plugin/Hlint.hs:300:53: error:
    • Couldn't match type ‘()’ with ‘GenLocated SrcSpan HsModule’
      Expected: Located HsModule
        Actual: ApiAnns
    • In the first argument of ‘createModuleEx’, namely ‘anns’
      In the first argument of ‘Right’, namely
        ‘(createModuleEx anns (applyParseFlagsFixities modu))’
      In the expression:
        Right (createModuleEx anns (applyParseFlagsFixities modu))
    |
300 |             createModule pm = Right (createModuleEx anns (applyParseFlagsFixities modu))
    |                                                     ^^^^

src/Ide/Plugin/Hlint.hs:313:42: error:
    • Data constructor not in scope: InfixL
    • Perhaps you meant ‘Infix’ (imported from Development.IDE.GHC.Compat)
    |
313 |                     f LeftAssociative  = InfixL
    |                                          ^^^^^^

src/Ide/Plugin/Hlint.hs:314:42: error:
    • Data constructor not in scope: InfixR
    • Perhaps you meant ‘Infix’ (imported from Development.IDE.GHC.Compat)
    |
314 |                     f RightAssociative = InfixR
    |                                          ^^^^^^

src/Ide/Plugin/Hlint.hs:315:42: error:
    • Data constructor not in scope: InfixN
    • Perhaps you meant ‘Infix’ (imported from Development.IDE.GHC.Compat)
    |
315 |                     f NotAssociative   = InfixN
    |                                          ^^^^^^

src/Ide/Plugin/Hlint.hs:608:35: error:
    • Couldn't match expected type: Rigidity -> t
                  with actual type: Language.Haskell.GHC.ExactPrint.ExactPrint.EPOptions
                                      Data.Functor.Identity.Identity ()
    • The function ‘deltaOptions’ is applied to one value argument,
        but its type ‘Language.Haskell.GHC.ExactPrint.ExactPrint.EPOptions
                        Data.Functor.Identity.Identity ()’
        has none
      In the expression: deltaOptions RigidLayout
      In an equation for ‘rigidLayout’:
          rigidLayout = deltaOptions RigidLayout
    • Relevant bindings include
        rigidLayout :: t (bound at src/Ide/Plugin/Hlint.hs:608:21)
    |
608 |                 let rigidLayout = deltaOptions RigidLayout
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^

src/Ide/Plugin/Hlint.hs:610:45: error:
    • Couldn't match type: IO Refact.Compat.Module
                     with: b0 -> IO (Refact.Compat.Module, t1)
      Expected: Refact.Compat.Module
                -> b0 -> IO (Refact.Compat.Module, t1)
        Actual: Refact.Compat.Module -> IO Refact.Compat.Module
    • In the first argument of ‘uncurry’, namely ‘Refact.applyFixities’
      In the first argument of ‘mapM’, namely
        ‘(uncurry Refact.applyFixities)’
      In the first argument of ‘($)’, namely
        ‘mapM (uncurry Refact.applyFixities)’
    |
610 |                     ExceptT $ mapM (uncurry Refact.applyFixities)
    |                                             ^^^^^^^^^^^^^^^^^^^^

src/Ide/Plugin/Hlint.hs:611:31: error:
    • Couldn't match expected type: t0
                                    -> Either String (Refact.Compat.Module, b0)
                  with actual type: Either a0 ParsedSource
    • The function ‘postParseTransform’
      is applied to two value arguments,
        but its type ‘Either
                        a0 ([GHC.Parser.Annotation.LEpaComment], DynFlags, ParsedSource)
                      -> Either a0 ParsedSource’
        has only one
      In the second argument of ‘($)’, namely
        ‘postParseTransform (Right (anns, [], dflags, modu)) rigidLayout’
      In the second argument of ‘($)’, namely
        ‘mapM (uncurry Refact.applyFixities)
           $ postParseTransform (Right (anns, [], dflags, modu)) rigidLayout’
    |
611 |                             $ postParseTransform (Right (anns, [], dflags, modu)) rigidLayout
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Ide/Plugin/Hlint.hs:611:57: error:
    • Couldn't match expected type: ([GHC.Parser.Annotation.LEpaComment],
                                     DynFlags, ParsedSource)
                  with actual type: (ApiAnns, [a1], DynFlags, ParsedSource)
    • In the first argument of ‘Right’, namely
        ‘(anns, [], dflags, modu)’
      In the first argument of ‘postParseTransform’, namely
        ‘(Right (anns, [], dflags, modu))’
      In the second argument of ‘($)’, namely
        ‘postParseTransform (Right (anns, [], dflags, modu)) rigidLayout’
    |
611 |                             $ postParseTransform (Right (anns, [], dflags, modu)) rigidLayout
    |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^

src/Ide/Plugin/Hlint.hs:612:56: error:
    • Couldn't match expected type: t1 -> IO String
                  with actual type: IO String
    • The function ‘Refact.applyRefactorings'’
      is applied to four value arguments,
        but its type ‘Maybe (Int, Int)
                      -> [[Refact.Refactoring Refact.SrcSpan]]
                      -> Refact.Compat.Module
                      -> IO String’
        has only three
      In the first argument of ‘withRuntimeLibdir’, namely
        ‘(Refact.applyRefactorings' position commands anns' modu')’
      In the second argument of ‘(<$>)’, namely
        ‘withRuntimeLibdir
           (Refact.applyRefactorings' position commands anns' modu')’
    • Relevant bindings include
        modu' :: t1 (bound at src/Ide/Plugin/Hlint.hs:609:25)
    |
612 |                 liftIO $ (Right <$> withRuntimeLibdir (Refact.applyRefactorings' position commands anns' modu'))
    |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions