HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulebase-4.20.2.0Haskell2010

GHC.IOPort

The IOPort type. This is a facility used by the Windows IO subsystem.

The API of this module is unstable and not meant to be consumed by the general public. If you absolutely must depend on it, make sure to use a tight upper bound, e.g., base < 4.X rather than base < 5, because the interface can change rapidly without much warning.

We have strict rules with an I/O Port: * writing more than once is an error * reading more than once is an error

It gives us the ability to have one thread to block, wait for a result from another thread and then being woken up. *Nothing* more.

This type is very much GHC internal. It might be changed or removed without notice in future releases.

  • 1 type
  • 5 values
  • Packagebase-4.20.2.0
  • Exports6
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceIOPort.hs

IOPorts

6 declarations
datadata IOPort a
#

An IOPort is a synchronising variable, used for communication between concurrent threads, where one of the threads is controlled by an external state. e.g. by an I/O action that is serviced by the runtime. It can be thought of as a box, which may be empty or full.

It is mostly similar to the behavior of Control.Concurrent.MVar.MVar except writeIOPort doesn't block if the variable is full and the GC won't forcibly release the lock if it thinks there's a deadlock.

The properties of IOPorts are: * Writing to an empty IOPort will not block. * Writing to an full IOPort will not block. It might throw an exception. * Reading from an IOPort for the second time might throw an exception. * Reading from a full IOPort will not block, return the value and empty the port. * Reading from an empty IOPort will block until a write. * Reusing an IOPort (that is, reading or writing twice) is not supported and might throw an exception. Even if reads and writes are interleaved.

This type is very much GHC internal. It might be changed or removed without notice in future releases.

Constructors

Instances1Eq
  • Eq (IOPort a)Defined in ghc-internal-9.1003.0 · GHC.Internal.IOPort