-
Notifications
You must be signed in to change notification settings - Fork 32
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
OsString deprecation applies to all its exports #209
Comments
That is unfortunate. So a re-export of a deprecated module propagates. We want to signal that importing @Bodigrim ideas? |
Maybe we can silence deprecation warnings for Can you test that @tbidne ? |
Unfortunately I think I also tried adding I fear there is no way to export an "unwarned" version of a symbol. Edit: Incidentally, there are some GHC links for possible designs on silencing warnings on an individual basis:
I attempted to implement this a bit ago but didn't get too far. |
Also discussed here: https://gitlab.haskell.org/ghc/ghc/-/issues/24017#note_536724 |
I think the only solution is to:
This has two major downsides:
|
To be fully compliant with PVP as currently written, yes, I think you are right. It's a shame as it is a significant amount of work primarily due to module deprecations having surprising behavior. 1.5 becomes the deprecation warning, and 1.6 becomes the new version with For what it's worth, SPJ argues in this PR that deprecations (and warnings, more generally) should not affect "stability", as defined there. If that is the consensus, then PVP's current stance on deprecations should probably be reconsidered. |
There is in fact a workaround for the deprecated module issue, though it's grim and requires GHC 9.8+. Using the new deprecated exports feature, you can instead deprecate every export individually. This has the expected effect. I did this on my filepath fork here, and my branch built successfully. On the other hand, changing the import to use the "deprecated module" produces the error, as desired. diff --git a/src/Lib.hs b/src/Lib.hs
index cf05c87..2fbae8b 100644
--- a/src/Lib.hs
+++ b/src/Lib.hs
@@ -2,7 +2,8 @@
module Lib (foo) where
-import System.OsPath.Encoding (EncodingException)
+--import System.OsPath.Encoding (EncodingException)
+import System.OsPath.Encoding.Internal (EncodingException)
foo :: Either EncodingException ()
foo = Right ()
Of course this doesn't help here since it requires GHC 9.8, and attaching the deprecation to every symbol is pretty unfortunate. But, happily, it does work. |
How about doing tbidne@f921495 under CPP, for GHC 9.8+ only? The new release of |
So we do this in 1.4.200.1 and then set |
See the upcoming PVP 1.1 which no longer recommends major version bumps because of deprecations.
Could we put the actual content of a public module |
Clever! I tried this here and it seems to work. The commit message goes into more detail, but I essentially used your strategy. For a deprecated module
Of these,
Sadly, shuffling the deprecation message means github's diff algorithm isn't smart enough to know the files were mostly renamed, so the diff is pretty intimidating. To be clear, I am not asking for this PR, as I am satisfied with the PVP resolution and module deprecation explanation. But if you feel it's worth it, I can open one. |
Hello.
First, thanks for all your hard work on AFP. I'm a big fan of the new
OsPath
functionality.It appears that the deprecations in #206 caused all downstream symbols to be deprecated, not just the module names. Was that intended? For instance, I would expect the following to succeed, since it is not using a deprecated module or symbol that was itself deprecated:
Yet:
This failure can be seen here: https://github.com/tbidne/osstr-deprecated.
I didn't know module deprecations worked this way, so I wonder if this was unintended. PVP considers deprecations breaking changes (see 7), so it seems like this probably qualifies.
Additional thoughts
I'm not sure of a good fix here. You can work around this sometimes by creating new entities e.g.
But I doubt this can work well when the deprecations are on the types themselves. Moreover, this seems like a lot of work for little gain, when you consider people will have to move to the new types in
os-string
anyway.Perhaps the best solution is to revise
1.4.200.0
to an impossible build plan, so the solver doesn't pick it for everyone with a<1.5
bound.Finally, this feels like a flaw with module deprecations and could be reported on ghc's issue tracker, but I wanted to get other opinions first.
Thanks!
Edit: I should have noted, this is really only a problem for
-Werror
users. PVP does explicitly point to this use-case, but on the other hand, it has been debated elsewhere that-Werror
should be excluded. Perhaps PVP should be updated.The text was updated successfully, but these errors were encountered: