koka-lang / koka

Koka language compiler and interpreter
http://koka-lang.org
Other
3.16k stars 151 forks source link

3.1.0 fails to compile: Couldn't match expected type: J.LspT #471

Closed yurivict closed 4 months ago

yurivict commented 4 months ago
src/Main/langserver/LanguageServer/Handler/TextDocument.hs:153:10: error:
    * Couldn't match expected type: J.LspT
                                      ()
                                      (transformers-0.5.6.2:Control.Monad.Trans.Reader.ReaderT
                                         (GHC.MVar.MVar LSState) IO)
                                      (Maybe FilePath)
                  with actual type: ((J.ProgressAmount -> m0 ()) -> m0 a0) -> m0 a0
    * Probable cause: `($)' is applied to too few arguments
      In a stmt of a 'do' block:
        withProgress (T.pack $ "Koka: " ++ fpath') NotCancellable
          $ \ report
              -> do setProgress (Just report)
                    mbRes <- liftBuildDiag mbFlags uri $ \ buildc0 -> ...
                    ....
      In the expression:
        do updateVFS
           fpath' <- fileNameFromPath fpath
           withProgress (T.pack $ "Koka: " ++ fpath') NotCancellable
             $ \ report -> do ...
      In an equation for `rebuildFile':
          rebuildFile mbFlags mbRun uri fpath
            = do updateVFS
                 fpath' <- fileNameFromPath fpath
                 withProgress (T.pack $ "Koka: " ++ fpath') NotCancellable
                   $ \ report -> ...
    |
153 |          withProgress (T.pack $ "Koka: " ++ fpath') J.NotCancellable $ \report -> do
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

src/Main/langserver/LanguageServer/Handler/TextDocument.hs:153:53: error:
    * Couldn't match expected type `Maybe J.ProgressToken'
                  with actual type `ProgressCancellable'
    * In the second argument of `withProgress', namely `NotCancellable'
      In the first argument of `($)', namely
        `withProgress (T.pack $ "Koka: " ++ fpath') NotCancellable'
      In a stmt of a 'do' block:
        withProgress (T.pack $ "Koka: " ++ fpath') NotCancellable
          $ \ report
              -> do setProgress (Just report)
                    mbRes <- liftBuildDiag mbFlags uri $ \ buildc0 -> ...
                    ....
    |
153 |          withProgress (T.pack $ "Koka: " ++ fpath') J.NotCancellable $ \report -> do
    |                                                     ^^^^^^^^^^^^^^^^

src/Main/langserver/LanguageServer/Handler/TextDocument.hs:153:72: error:
    * Couldn't match expected type `ProgressCancellable'
                  with actual type `(J.ProgressAmount -> LSM ())

ghc-9.4.8 FreeBSD 14.0

TimWhiting commented 4 months ago

You are compiling from source? Try stack clean --full && stack build, it looks like it fetched an incompatible version of the language server dependency. It should be pinned in stack.yaml. In the meantime I'll try upgrading the dependency on dev.

TimWhiting commented 4 months ago

I've made the changes on the dev branch to support the new version of lsp.

yurivict commented 4 months ago

@TimWhiting

I am in the very clean environment of the FreeBSD port, so stack clean --full wouldn't help. I believe that this is a general problem in 3.1.0 Could you please cut a new release that includes the fix so that others wouldn't have the same problem?

TimWhiting commented 4 months ago

Daan said he would do a new release soon.

yurivict commented 1 month ago

@TimWhiting 3.1.1 still has the same failure:

src/Main/langserver/LanguageServer/Handler/SignatureHelp.hs:103:98: error: [GHC-39999]
    * No instance for `Num (J.UInt J.|? J.Null)'
        arising from the literal `0'
    * In the first argument of `Just', namely `0'
      In the third argument of `J.SignatureHelp', namely `(Just 0)'
      In the second argument of `($!)', namely
        `J.SignatureHelp
           (map snd sigInfos) (fmap fromIntegral mbIndex) (Just 0)'
    |
103 |           return $! Just $! J.SignatureHelp (map snd sigInfos) (fmap fromIntegral mbIndex) (Just 0)
    |                                                                                                  ^

ghc-9.6.4 FreeBSD 14.0

TimWhiting commented 1 month ago

What about 3.1.2?

yurivict commented 1 month ago

3.1.2 builds fine, thank you.