Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support GHC 9.4 #2532

Merged
merged 9 commits into from
Oct 6, 2023
Merged

Support GHC 9.4 #2532

merged 9 commits into from
Oct 6, 2023

Conversation

lrworth
Copy link
Contributor

@lrworth lrworth commented Aug 25, 2023

A more conservative approach than #2496. Older versions of libraries should still work, and the behaviour on windows should not have changed at all (except for the error string).

I was able to build dhall with GHC 8.10 and 9.4; I don't have time to update the other packages.

Closes #2537.

Adding a \ to the escaped newlines appears to make CPP generate valid
haskell without getting stuck.
In unix-compat 0.7, `getUserEntryForName` threw an exception when called
on Windows. unix-compat 0.8 removes it entirely. To increase likelihood
of this change being merged, the behaviour of the 0.7 version has been
incorporated into Dhall.DirectoryTree.
dhall does not compile with template-haskell >=2.17 due to signature
change of Language.Haskell.TH.Syntax.PlainTV.
In particular this enables building with GHC 9.4.
@@ -54,8 +55,12 @@ import qualified Prettyprinter as Pretty
import qualified Prettyprinter.Render.String as Pretty
import qualified System.Directory as Directory
import qualified System.FilePath as FilePath
#ifdef mingw32_HOST_OS
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\ \n\
\" <> Util.insert unexpectedExpression <> "\n\
\ \n\
Util._ERROR <> ": Not a valid directory tree expression \n\\
Copy link
Contributor Author

@lrworth lrworth Aug 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GHC documentation recommends appending a space so that cpp doesn't fall over, but that causes a different error. Adding a slash like this seems to work, and does not affect the output of dhall to-directory-tree. Perhaps I should tell the GHC maintainers.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, something seems amiss here. I was looking at this more closely and it does not seem to work in my local testing. The following sample code I tested:

module Main where

main :: IO ()
main = putStrLn "foo\n\\
                \bar\n\\
                \baz\n"

… gives me a lexical error:

Main.hs:4:25: error:
    lexical error in string/character literal at character '\n'
  |
4 | main = putStrLn "foo\n\\
  |                         ^

Yet clearly CI passed for your branch so I'm a bit confused. My intuition, though, is that the double trailing slash should not work, though, since I thought that would get translated to a literal slash in the string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for me:

{-# LANGUAGE CPP #-}

module Main where

main :: IO ()
main = putStrLn "foo\n\\
                \bar\n\\
                \baz\n"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhhh, I didn't realize that CPP changed the semantics of string literals. Alright, that clears up my confusion.

@lrworth
Copy link
Contributor Author

lrworth commented Aug 29, 2023

All the check failures seem to be related to a 504 when fetching https://httpbin.org/user-agent. I don't know how to resolve that.

@Gabriella439
Copy link
Collaborator

Sorry for the delay on this. I've put up a PR to disable the httpbin.org-related tests:

#2533

… and once that merges then it will hopefully unblock your PR

@georgefst
Copy link

georgefst commented Oct 4, 2023

Note that this works for GHC 9.6 as well with --allow-newer='cborg-json:base,dhall:template-haskell'. At least for the core dhall library.

In other words, the library's bound on template-haskell needs bumping (though cabal oudated suggests many other bumps that wouldn't hurt), and then we're just blocked on well-typed/cborg#313.

@Gabriella439 Gabriella439 merged commit 55aff09 into dhall-lang:main Oct 6, 2023
5 checks passed
@georgefst
Copy link

Could we possibly get a Hackage patch release with this and other recent dependency fixes? I'm unfortunately a bit stuck because of a use of dhall in a cabal script, and those don't yet support source-repository-package stanzas (haskell/cabal#8024 (comment)).

@georgefst
Copy link

In other words, the library's bound on template-haskell needs bumping

Hopefully, this will be merged via #2542.

@georgefst
Copy link

Looks like this was released via #2545. Thanks @Gabriella439!

@Gabriella439
Copy link
Collaborator

You're welcome! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants