Skip to content

OsString deprecation applies to all its exports #209

@tbidne

Description

@tbidne

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:

import System.OsPath.Encoding (EncodingException)

foo :: Either EncodingException ()
foo = Right ()

Yet:

 src/Lib.hs:7:15: error: [GHC-68441] [-Wdeprecations, Werror=deprecations]
Error:     In the use of type constructor or class ‘EncodingException’
    (imported from System.OsPath.Encoding, but defined in System.OsPath.Encoding.Internal):
    Deprecated: "Use System.OsString.Encoding.Internal from os-string >= 2.0.0 package instead. This module will be removed in filepath >= 1.5."
  |
7 | foo :: Either EncodingException ()
  |               ^^^^^^^^^^^^^^^^^

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.

{-# OPTIONS_GHC -Wno-deprecations #-}

module LibGood (foo) where

import qualified Deprecated

-- Deprecated.foo is deprecated, but the export is fine because it is a new, undeprecated symbol.
foo :: String
foo = Deprecated.foo ++ " LibGood"

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions