Skip to content

Conversation

@jeltsch
Copy link

@jeltsch jeltsch commented Sep 17, 2025

There is an effort to move some GHC-specific modules out of base. Candidates for such moving are GHC.IO.Handle.Types and GHC.IO.Handle.Internals. These modules are often used for obtaining POSIX file descriptors from Haskell handles. Such a use is also present in the terminal-size package as part of the implementation of the hSize operation for POSIX.

There is a proposal to add dedicated operations for operating-system handle acquisition to base. A corresponding draft implementation can be found in GHC merge request !14732. The present pull request changes the implementation of hSize to use one of those new operations.

Note that this pull request slightly changes the behavior of the POSIX version of hSize, which previously returned Nothing when the given handle was not backed by a file descriptor but with the changes in this pull request throws an exception in such a situation. This actually makes the POSIX version of hSize behave analogous to the Windows version of hSize, which may be considered a good thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant