kosmikus / lhs2tex

Preprocessor for typesetting Haskell sources with LaTeX
Other
99 stars 28 forks source link

lhs2tex doesn't compile on ghc 9.6.1 #90

Closed GeorgeCo closed 11 months ago

GeorgeCo commented 1 year ago
$ cabal install lhs2tex 
...
[ 5 of 21] Compiling Parser           ( src/Parser.lhs, dist/build/lhs2TeX/lhs2TeX-tmp/Parser.o )

src/Parser.lhs:33:7: warning: [-Wnoncanonical-monad-instances]
    Noncanonical ‘return’ definition detected
    in the instance declaration for ‘Monad (Parser tok)’.
    ‘return’ will eventually be removed in favour of ‘pure’
    Either remove definition for ‘return’ (recommended) or define as ‘return = pure’
    See also: https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/monad-of-no-return
   |
33 | >     return a                  =  MkParser (\inp -> Just (a, inp))
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
GeorgeCo commented 1 year ago

Is lhs2tex still being maintained?

kosmikus commented 1 year ago

FWIW, the repo compiles with ghc-9.6 since 23 March. I should just make a new release.

GeorgeCo commented 1 year ago

Thanks! That's good news!

On Wed, Jun 28, 2023 at 10:30 AM Andres Löh @.***> wrote:

FWIW, the repo compiles with ghc-9.6 since 23 March. I should just make a new release.

— Reply to this email directly, view it on GitHub https://github.com/kosmikus/lhs2tex/issues/90#issuecomment-1611417425, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQIJ62MQIO5QMG3N47YGVLXNQWYJANCNFSM6AAAAAAV4F6SFU . You are receiving this because you authored the thread.Message ID: @.***>

j-mie6 commented 1 year ago

Might be a good idea to cap the base version bound on the already released version in the meantime

GeorgeCo commented 11 months ago

@kosmikius

FWIW, the repo compiles with ghc-9.6 since 23 March. I should just make a new release.

That would be nice!

andreasabel commented 11 months ago

The error actually is

src/Main.lhs:228:39: error: [GHC-88464]
    Variable not in scope: liftIO :: IO () -> XIO Exc State a1
...
      • Perhaps you want to add ‘liftIO’ to the import list
        in the import of ‘Control.Monad.State’ (src/Main.lhs:22:3-55).
    |
228 | >                                     liftIO (hPutStrLn stderr (text st))
    |                                       ^^^^^^

So this is a mtl-2.3 issue (dropped reexports). The cure is to add mtl < 2.3 to the hackage releases.

andreasabel commented 11 months ago

I made the respective revisions on hackage, e.g. https://hackage.haskell.org/package/lhs2tex-1.24/revisions/

2023-09-27T09:44:28Z AndreasAbel lhs2tex-1.24-r1 2023-09-27T09:44:28Z AndreasAbel lhs2tex-1.23-r1 2023-09-27T09:44:27Z AndreasAbel lhs2tex-1.22-r1 2023-09-27T09:44:27Z AndreasAbel lhs2tex-1.21-r1 2023-09-27T09:44:26Z AndreasAbel lhs2tex-1.20-r1 2023-09-27T09:44:26Z AndreasAbel lhs2tex-1.19-r1 2023-09-27T09:44:25Z AndreasAbel lhs2tex-1.18-r1 2023-09-27T09:44:25Z AndreasAbel lhs2tex-1.18.1-r1 2023-09-27T09:44:24Z AndreasAbel lhs2tex-1.17-r1 2023-09-27T09:44:24Z AndreasAbel lhs2tex-1.16-r1 2023-09-27T09:44:24Z AndreasAbel lhs2tex-1.15-r1 2023-09-27T09:44:23Z AndreasAbel lhs2tex-1.14-r1 2023-09-27T09:44:23Z AndreasAbel lhs2tex-1.13-r1

andreasabel commented 11 months ago

Now you can build the released version with GHC 9.6. This will take a while because it also rebuilds Cabal, but it works:

cabal get lhs2tex-1.24
cd lhs2tex-1.24
cabal build -w ghc-9.6.3

(Issue is fixed and can be closed.)

GeorgeCo commented 11 months ago

Thanks but that didn't work for me:

 ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.6.3
bash-3.2$ cabal --version
cabal-install version 3.10.1.0
compiled using version 3.10.1.0 of the Cabal library 
 cabal build -w ghc-9.6.3
Resolving dependencies...
Build profile: -w ghc-9.6.3 -O1
In order, the following will be built (use -v for more details):
 - lhs2tex-1.24 (exe:lhs2TeX) (first run)
[1 of 2] Compiling Main             ( /Users/gcolpitts/Downloads/lhs2tex-1.24/dist-newstyle/build/x86_64-osx/ghc-9.6.3/lhs2tex-1.24/setup/setup.hs, /Users/gcolpitts/Downloads/lhs2tex-1.24/dist-newstyle/build/x86_64-osx/ghc-9.6.3/lhs2tex-1.24/setup/Main.o )
[2 of 2] Linking /Users/gcolpitts/Downloads/lhs2tex-1.24/dist-newstyle/build/x86_64-osx/ghc-9.6.3/lhs2tex-1.24/setup/setup
Warning: lhs2tex.cabal:88:3: The field "autogen-modules" is available only
since the Cabal specification version 2.0. This field will be ignored.
...
    [21 of 21] Compiling Main             ( src/Main.lhs, dist/build/lhs2TeX/lhs2TeX-tmp/Main.o )

src/Main.lhs:228:39: error: [GHC-88464]
    Variable not in scope: liftIO :: IO () -> XIO Exc State a1
    Suggested fixes:
      • Perhaps use one of these:
          ‘lift’ (imported from Auxiliaries),
          ‘liftM’ (imported from Control.Monad),
          ‘liftA2’ (imported from Prelude)
      • Perhaps you want to add ‘liftIO’ to the import list
        in the import of ‘Control.Monad.State’ (src/Main.lhs:22:3-55).
    |
228 | >                                     liftIO (hPutStrLn stderr (text st))
    |                                       ^^^^^^
ulysses4ever commented 11 months ago

@GeorgeCo maybe a silly question but did you cabal update?

GeorgeCo commented 11 months ago

Thanks for the quick and helpful reply! No I didn't, sorry. I now have and it works! Thanks again!