haskell / lsp

Haskell library for the Microsoft Language Server Protocol
364 stars 90 forks source link

Build failures in `lsp` with `mtl-2.3` #430

Closed sjakobi closed 2 years ago

sjakobi commented 2 years ago
src/Language/LSP/Server/Processing.hs:47:3: error:
    Variable not in scope:
      join :: m3 (LspT config1 IO ()) -> LspT config IO ()
   |
47 |   join $ liftIO $ atomically $ fmap handleErrors $ runExceptT $ do
   |   ^^^^

src/Language/LSP/Server/Processing.hs:84:100: error:
    • Variable not in scope:
        (<=<)
          :: IO (Maybe a1)
             -> (ExceptT e0 m2 a2 -> m2 (Either e0 a2))
             -> ExceptT ResponseError IO (LanguageContextEnv config)
             -> IO (Maybe (LanguageContextEnv config))
    • Perhaps you meant one of these:
        ‘=<<’ (imported from Prelude), ‘<=’ (imported from Prelude)
   |
84 |   flip E.catch (initializeErrorHandler $ sendResp . makeResponseError (req ^. LSP.id)) $ handleErr <=< runExceptT $ mdo
   |                                                                                                    ^^^

src/Language/LSP/Server/Processing.hs:389:3: error:
    Variable not in scope: join :: m0 (m1 ()) -> LspM config ()
    |
389 |   join $ stateState resVFS $ \(VFSData vfs rm) ->
    |   ^^^^

I've used lens's mtl-2.3 branch for this build:

source-repository-package
    type: git
    location: https://github.com/ekmett/lens.git
    tag: 371a9410cb2876af14b9ac5864b1da420101136c

Since the affected code is already present in v1.0.0.0, I've used my Hackage trustee powers to add bounds mtl < 2.3 to all versions of lsp on Hackage. See e.g. https://hackage.haskell.org/package/lsp-1.4.0.0/revisions/.

sjakobi commented 2 years ago

FYI: lsp-test is blocked on https://github.com/k0ral/conduit-parse/issues/4.

michaelpj commented 2 years ago

Thank you!

sjakobi commented 2 years ago

Now that https://github.com/k0ral/conduit-parse/issues/4 is fixed, lsp-test is showing build failures:

src/Language/LSP/Test/Session.hs:154:19: error:
    • Variable not in scope:
        lift
          :: t0
             -> ConduitParser
                  FromServerMessage
                  (StateT SessionState (ReaderT SessionContext IO))
                  SessionContext
    • Perhaps you meant one of these:
        ‘liftM’ (imported from Control.Monad),
        ‘liftA’ (imported from Control.Applicative)
    |
154 |   ask  = Session (lift $ lift Reader.ask)
    |                   ^^^^

src/Language/LSP/Test/Session.hs:154:26: error:
    • Variable not in scope: lift :: ReaderT r0 m6 r0 -> t0
    • Perhaps you meant one of these:
        ‘liftM’ (imported from Control.Monad),
        ‘liftA’ (imported from Control.Applicative)
    |
154 |   ask  = Session (lift $ lift Reader.ask)
    |                          ^^^^

src/Language/LSP/Test/Session.hs:157:9: error:
    • Variable not in scope:
        lift :: t1 -> ConduitM a b (StateT s (ReaderT r m)) r
    • Perhaps you meant one of these:
        ‘liftM’ (imported from Control.Monad),
        ‘liftA’ (imported from Control.Applicative)
    |
157 |   ask = lift $ lift Reader.ask
    |         ^^^^

src/Language/LSP/Test/Session.hs:157:16: error:
    • Variable not in scope: lift :: ReaderT r1 m7 r1 -> t1
    • Perhaps you meant one of these:
        ‘liftM’ (imported from Control.Monad),
        ‘liftA’ (imported from Control.Applicative)
    |
157 |   ask = lift $ lift Reader.ask
    |                ^^^^

src/Language/LSP/Test/Session.hs:197:18: error:
    • Variable not in scope:
        lift
          :: StateT s2 m4 s2
             -> ConduitParser
                  FromServerMessage
                  (StateT SessionState (ReaderT SessionContext IO))
                  SessionState
    • Perhaps you meant one of these:
        ‘liftM’ (imported from Control.Monad),
        ‘liftA’ (imported from Control.Applicative)
    |
197 |   get = Session (lift State.get)
    |                  ^^^^

src/Language/LSP/Test/Session.hs:198:19: error:
    • Variable not in scope:
        lift
          :: StateT SessionState m5 ()
             -> ConduitParser
                  FromServerMessage
                  (StateT SessionState (ReaderT SessionContext IO))
                  ()
    • Perhaps you meant one of these:
        ‘liftM’ (imported from Control.Monad),
        ‘liftA’ (imported from Control.Applicative)
    |
198 |   put = Session . lift . State.put
    |                   ^^^^

src/Language/LSP/Test/Session.hs:206:9: error:
    • Variable not in scope: lift :: m2 s1 -> ConduitM a b m s
    • Perhaps you meant one of these:
        ‘liftM’ (imported from Control.Monad),
        ‘liftA’ (imported from Control.Applicative)
    |
206 |   get = lift get
    |         ^^^^

src/Language/LSP/Test/Session.hs:207:9: error:
    • Variable not in scope: lift :: m3 () -> ConduitM a b m ()
    • Perhaps you meant one of these:
        ‘liftM’ (imported from Control.Monad),
        ‘liftA’ (imported from Control.Applicative)
    |
207 |   put = lift . put
    |         ^^^^

src/Language/LSP/Test/Session.hs:211:9: error:
    • Variable not in scope: lift :: m0 s0 -> ConduitParser a m s
    • Perhaps you meant one of these:
        ‘liftM’ (imported from Control.Monad),
        ‘liftA’ (imported from Control.Applicative)
    |
211 |   get = lift get
    |         ^^^^

src/Language/LSP/Test/Session.hs:212:9: error:
    • Variable not in scope: lift :: m1 () -> ConduitParser a m ()
    • Perhaps you meant one of these:
        ‘liftM’ (imported from Control.Monad),
        ‘liftA’ (imported from Control.Applicative)
    |
212 |   put = lift . put
    |         ^^^^

Since this code is already present in the earliest releases of lsp-test, I've revised them all. See e.g. https://hackage.haskell.org/package/lsp-test-0.14.0.2/revisions/.

michaelpj commented 2 years ago

I've merged a fix that builds with both versions of mtl, so we should be good. I'll try and do a release shortly.

sjakobi commented 2 years ago

If possible, it would be nice if the new releases were compatible with transformers-0.6 too.

michaelpj commented 2 years ago

Thanks, for some reason I thought mtl >= 2.3 would force the new transformers too. I'll look into that.

sjakobi commented 2 years ago

Thanks, for some reason I thought mtl >= 2.3 would force the new transformers too.

It's the other way round: transformers >= 0.6 will force mtl >= 2.3.

michaelpj commented 2 years ago

No build failures with transformers >= 0.6, although I needed allow-newer: safe-exceptions:transformers if you're chasing these things.

sjakobi commented 2 years ago

FYI: I just tried building dhall-lsp-server with lsp master, and encountered a build error for which I found no explanation in the changelogs:

src/Dhall/LSP/Handlers.hs:94:60: error:
    • Couldn't match expected type ‘Rope.Rope’
                  with actual type ‘text-rope-0.1:Data.Text.Utf16.Rope.Rope’
      NB: ‘text-rope-0.1:Data.Text.Utf16.Rope.Rope’
            is defined in ‘Data.Text.Utf16.Rope’ in package ‘text-rope-0.1’
          ‘Rope.Rope’
            is defined in ‘Data.Rope.UTF16.Internal’
                in package ‘rope-utf16-splay-0.3.2.0’
    • In the first argument of ‘Rope.toText’, namely ‘rope’
      In the first argument of ‘return’, namely ‘(Rope.toText rope)’
      In the expression: return (Rope.toText rope)
   |
94 |     Just (LSP.VirtualFile _ _ rope) -> return (Rope.toText rope)
   |                                                            ^^^^
michaelpj commented 2 years ago

Yes, there are breaking changes on master. I will create a changelog when I do the release.

sjakobi commented 2 years ago

Ping! A release would be nice! :)

michaelpj commented 2 years ago

Released! Sorry for the delay.