-
Notifications
You must be signed in to change notification settings - Fork 18
Description
As part of some GHC RTS refactoring and improvements related to the RTS I/O managers, we need to change an RTS flag. The GHC RTS flags are currently exposed via base in GHC.RTS.Flags. The types there reflect 1:1 the GHC RTS CLI flags. Thus these types are obviously tightly coupled to GHC and the GHC version.
The specific changes are:
- A new
IoManagerFlagdata type is exported viaGHC.RTS.Flags - The
MiscFlagsfieldioManagerfield changes type fromIoSubSystemtoIoManagerFlag - The
IoSubSystemtype is still re-exported fromGHC.RTS.Flagsbut with a deprecation warning instructing people to import it from its "proper" place inGHC.IO.Subsystem - The
getIoManagerFlagfunction is no longer exported fromGHC.RTS.Flags
Note that:
- The
IoSubSystemtype is still exported viaGHC.IO.Subsystem, which is where it should be used from anyway.
Implementation
Impact
It is expected that the impact is minimal. It's very unusual for libraries or applications to use GHC.RTS.Flags at all, and those that do typically don't depend on all the details and the ioManager flag is a rather obscure feature.
A survey of https://hackage-search.serokell.io/?q=GHC.RTS.Flags reveals:
- 21 packages import/use GHC.RTS.Flags, all of them either
- use only specific imports, not including
MiscFlags - re-export things without depending on specifics
- do so generically, e.g. generic deriving or TH deriving (
text-show,generics-sop,staged-gg
- use only specific imports, not including
IoSubSystemis imported bystore(in its testsuite),streamlyandstreamly-core. These will be affected by the deprecation warninggetIoManagerFlagis used only inbase.
Migration
Follow the instructions on the deprecation warning for GHC.RTS.Flags.IoSubSystem and import it from GHC.IO.SubSystem instead.
Commentary
Longer term it would seem wise for GHC.RTS.Flags to not be exported from base at all since it is inherently GHC-specific and tightly coupled to internal details of the implementation. Perhaps like ghc-heap it needs its own package (since apparently the policy is that packages should not depend on ghc-internals directly).