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

io-sim: Export Time from Control.Monad.IOSim #200

Open
1 task done
wenkokke opened this issue Dec 19, 2024 · 0 comments · May be fixed by #201
Open
1 task done

io-sim: Export Time from Control.Monad.IOSim #200

wenkokke opened this issue Dec 19, 2024 · 0 comments · May be fixed by #201
Labels
enhancement New feature or request

Comments

@wenkokke
Copy link

wenkokke commented Dec 19, 2024

Is your feature request related to a problem? Please describe.
Many types exposed from the Control.Monad.IOSim module have fields of type Time. For example, the field seTime of SimEvent. However, the type Time is not exported from Control.Monad.IOSim and is only available from the deprecated si-timers package. The deprecated si-timers package recommends using the nearly equivalent modules from the io-classses package, but, unfortunately, the io-classes package does not export the Time type. Therefore, in order to use the seTime field of a SimEvent, one has to depend on the deprecated si-timers package for—and only for—that newtype.

Describe the solution you'd like
Export the Time newtype with its constructor from the Control.Monad.IOSim module. This isn't formally a breaking change, but can be a breaking change if users are importing both Control.Monad.IOSim from io-sim and Control.Monad.Class.MonadTime.SI from si-timers unqualified. However, it should not be a breaking change in any codebase with import linting.

Describe alternatives you've considered
There are two alternative solutions:

  • Unpack the seTime field and others to expose the underlying DiffTime value instead. This is the right solution, but is certainly a breaking change, which feels too major a change for such a minor improvement.
  • Define a pattern synonym for the SimEvent constructor that unpacks seTime as seDiffTime. This isn't formally a breaking change, but can be a breaking change if the pattern synonym name clashes with any common names, which should be easy enough to avoid. However, this feels a bit heavy handed for such a small change, as it would require numerous pattern synonyms.

Are you willing to implement it?

  • Yes.
@wenkokke wenkokke added the enhancement New feature or request label Dec 19, 2024
@wenkokke wenkokke linked a pull request Dec 19, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant