butler-0.0.1.0: At your service.
Safe HaskellSafe-Inferred
LanguageGHC2021

Butler.Core.Pipe

Description

This module provides Pipe and BroadcastChan helpers.

Synopsis

BroadcastChan

data BroadcastChan a #

A BroadcastChan is a single-producer multi-consumer channel.

newBroadcastChan :: STM (BroadcastChan a) #

Creates the producer end.

newReaderChan :: BroadcastChan a -> STM (TChan a) #

Creates a new reader end.

broadcast :: BroadcastChan a -> a -> STM () #

Broadcast a message.

Pipe

data Pipe a #

A Pipe is a bounded channel, analogous to pipe(2).

newPipe :: STM (Pipe a) #

readPipe :: Pipe a -> STM a #

readPipe block until a message is available.

tryWritePipe :: Pipe a -> a -> STM Bool #

tryWritePipe returns False when the message could not be delivered because the pipe is full.