Conversation
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.
| import qualified Prettyprinter.Render.String as Pretty | ||
| import qualified System.Directory as Directory | ||
| import qualified System.FilePath as FilePath | ||
| #ifdef mingw32_HOST_OS |
There was a problem hiding this comment.
This is exactly the condition used by unix-compat prior to 0.7: haskell-pkg-janitors/unix-compat@87ffe05#diff-93ed634b109420481984ea0fecc52a958c1d98c2728f8ec0b4c6ed741a8d4a24L36
| \ \n\ | ||
| \" <> Util.insert unexpectedExpression <> "\n\ | ||
| \ \n\ | ||
| Util._ERROR <> ": Not a valid directory tree expression \n\\ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
This works for me:
{-# LANGUAGE CPP #-}
module Main where
main :: IO ()
main = putStrLn "foo\n\\
\bar\n\\
\baz\n"There was a problem hiding this comment.
Ohhhh, I didn't realize that CPP changed the semantics of string literals. Alright, that clears up my confusion.
|
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. |
|
Sorry for the delay on this. I've put up a PR to disable the httpbin.org-related tests: … and once that merges then it will hopefully unblock your PR |
|
Note that this works for GHC 9.6 as well with In other words, the library's bound on |
|
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 |
Hopefully, this will be merged via #2542. |
|
Looks like this was released via #2545. Thanks @Gabriella439! |
|
You're welcome! 😊 |
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
dhallwith GHC 8.10 and 9.4; I don't have time to update the other packages.Closes #2537.