netwire-3.1.0: Fast generic automaton arrow transformer for AFRP

MaintainerErtugrul Soeylemez <>




Wire concurrency.

Warning: This module is highly experimental and currently causes space leaks. Please use wire concurrency only for short-lived threads.


Embedding concurrent wires

class Arrow >~ => WFork (>~) whereSource

Forking wire transformer. Creates a concurrent wire thread and opens a communication channel to it.


feedWire :: Wire e >~ (WireChan a b, a) ()Source

Feed a wire thread with additional input.

  • Depends: Current instant.

forkWire :: Wire e >~ (Wire e >~ a b, WireMgr) (WireChan a b, WireThread)Source

Fork the input wire using the input wire manager.

Note: This wire forks at every instant. In many cases you will want to use the swallow wire transformer with this.

  • Depends: Current instant.

queryWire :: Monoid e => Wire e >~ (WireChan a b) bSource

Asks the given wire for its next output.

  • Depends: Current instant.
  • Inhibits: When there is no data.


Wire thread manager

data WireMgr Source

A wire thread manager keeps track of created wire threads.

startWireMgr :: IO WireMgrSource

Start a wire manager.

stopWireMgr :: WireMgr -> IO ()Source

Stop a wire manager terminating all threads it keeps track of.

withWireMgr :: (MonadBaseControl IO m, MonadIO m) => (WireMgr -> m a) -> m aSource

Convenient wrapper around startWireMgr and stopWireMgr.

Wire threads


data WireChan a b Source

A wire channel allows you to send input to and receive output from a concurrently running wire.

feedWireChan :: WireChan a b -> a -> IO ()Source

Feed the given wire thread with input.

readWireChan :: WireChan a b -> IO bSource

Read the given wire's next output.


data WireThread Source

A wire thread is a concurrently running wire.

killWireThread :: WireMgr -> WireThread -> IO ()Source

Kill the given wire thread.