TQ     somewhat portable? experimentaltov@ccs.neu.eduNoneBThe synchronous, non-blocking operations may succeed immediately, 1 or they may give up for a variety of reasons: >Another thread is currently operating on the channel. It may $ be worth trying again very soon. <An attempt was made to synchronize with another thread, but B the other thread bailed out before it could complete. Another < thread may be available, so it may be worth trying again  immediately. :No other thread is currently ready to synchronize for the  requested operation. The operation succeeded. 5The abstract channel type for sending values of type a. Make a new channel. BWrite a value to a channel, possibly blocking until synchronizing  with a reader.  Write to the "read end"' of a channel. If several writers are E waiting, this jumps ahead of them to the front of the line. Blocks ! until matched up with a reader. >Write a value to a channel, returning immediately rather than # waiting for the reader to arrive. Write a value to the "read end"& of a channel, succeeding immediately # rather than waiting for a reader. ?Attempts to write a value to a channel, succeeding immediately = if a reader is already available to synchronize. Will fail G if the reader is interrupted before the operation completes, if there D is no reader available, or if another thread is currently starting  an operation on the channel. BReads a value from a channel, potentially blocking until a writer  is ready to synchronize. @Attempts to read a value from a channel, succeeding immediately 2 if a writer is already available to synchronize. EAttempts to read a value from a channel, but does not allow a writer A to synchronize, and does not remove the observed value from the C channel. Fails if no writer is currently available, if the first B writer has bailed, or if it cannot immediately get a lock on the  channel. CReads a value from a channel, replacing it with a different value. F Blocks until the replacement value is read, and then returns the old  value. CAUTION:5 This operation does not guarantee that the read and B subsequent write are atomic. It is somewhat likely to be better  in that respect than   followed by   , however. DIf a writer is available to synchronize with, synchronizes with the D writer, allowing its operation to complete, writes the replacement A value ahead of any other writers, and then returns immediately.  Unlike 0, guarantees that no other write can intervene. AIs the channel currently empty? Note that the answer may become  false arbitrarily soon. Don't rely on this operation. =Read the contents of the channel as a lazy list. While this D operation returns immediately, forcing evaluation of the list will E block, which is why this is included among the blocking operations. C Writers will block until each link in the list is forced as well. CAny subsequent attempts to read from the channel will fail, unless A a thread is interrupted while blocking on forcing the list. Don't  rely on this behavior. ARead a given number of elements from the channel as a lazy list.  Like -, this operation returns immediately, but it E will block when the list is forced. (Taking the length of the list 7 should block until all the matching writes complete.) ARead the currently available elements from the channel as a lazy C list. The list is lazy because the number of currently available  elements may be infinite (see ). <Read up to the given number of currently available elements > from the channel. The list will be no longer than the given > number, but if there are insufficient writers available then A it may be shorter. The writers will block until their portions  of the list's spine are forced. >Write a list to a channel, blocking until the read completes. ? It is guaranteed that no other writes can intervene among the 9 list elements. (This cannot be implemented in terms of  1.) The list may be infinite, in which case this  operation never completes. FInterrupting this operation before the list is read completely causes D the rest of the list not to be written. (If you want to write the  whole list,  may be suitable.) AWrite a list to a channel, succeeding immediately. The list may : be infinite, in which case the operation still completes F immediately. (Actually, it may take time proportional to the number A of readers that are ready, so if an infinite list is written to  3 on the other side, it may not actually complete.) <Attempt to write as much of a list as possible to a channel F synchronously, but without blocking; returns the unwritten remainder E of the list. This operation will write additional list elements so H long as -- there are readers ready to receive them (and so long as the  list doesn' t run out). )Lift results of the try* operations into .  goes  to  and all kinds of failure go to . 8 !"#$%&'()*+,-./0123 456789:    +! "#$&%'()*+,-./0123 456789:;      !"#$%&'()**+,-./0123456789:;<=synchronous-channels-0.1#Control.Concurrent.Chan.Synchronous TryResult WouldBlockTryAgainNotReadySuccess getSuccessChannewChan writeChan unGetChanasyncWriteChanasyncUnGetChan tryWriteChanreadChan tryReadChan tryPeekChanswapChantryAsyncSwapChan isEmptyChangetChanContentsgetChanNtryGetChanContents tryGetChanNwriteList2ChanasyncWriteList2ChantryWriteList2ChanmaybeTrybase Data.MaybeMaybeJustNothingRepWQRQWriterReaderQViewNoQ:<QreadEndwriteEndempty|><||>>>dequeue getReaders getWriterscleargenericWriteChangetImmediateChanContents getChanMaybeNgenericWriteList2Chan saveBlock modifyMVar tryModifyMVar transactMVar