Skip to content

Add operating-system handle type detection to base #395

@jeltsch

Description

@jeltsch

#392 proposes to deprecate all base modules with stability risk 3. One of these modules is GHC.IO.SubSystem. Several Hackage packages import this module, but the only entity from it that they really use is the <!>-operator for performing case distinctions on the type of operating-system handles that the runtime system is using. See my corresponding analysis for details.

I propose to add means for detecting the type of operating-system handles in use to the base package, so that there is no need to use the <!>-operator anymore. I suggest not to simply add an operation like (<!>) to base but to introduce a type that enumerates the supported handle types (currently file descriptors and Windows handles) and additionally a variable of this type that states the handle type in use. The reason is that this solution is simpler and at the same type more future-proof: if a new handle type should be introduced in the future, it would only be necessary to add another value to said enumeration type, and user code that uses fallback branches for unsupported handle types may continue to function; an operation like (<!>), on the other hand, would have to have its argument count changed (and could not be represented by an infix operator if there were not exactly two handle types). Since Haskell has case expressions, there is no real need to have a case-distinguishing operation like <!>.

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