/usr/share/doc/libghc-stm-chans-doc/html/Control-Concurrent-STM-TBChan.html is in libghc-stm-chans-doc 3.0.0.4-5build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Control.Concurrent.STM.TBChan</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="file:///usr/share/javascript/mathjax/MathJax.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Control-Concurrent-STM-TBChan.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Control-Concurrent-STM-TBChan.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">stm-chans-3.0.0.4: Additional types of channels for STM.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th valign="top">Copyright</th><td>Copyright (c) 2011--2015 wren gayle romano</td></tr><tr><th>License</th><td>BSD</td></tr><tr><th>Maintainer</th><td>wren@community.haskell.org</td></tr><tr><th>Stability</th><td>provisional</td></tr><tr><th>Portability</th><td>non-portable (GHC STM, DeriveDataTypeable)</td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Control.Concurrent.STM.TBChan</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">The TBChan type</a><ul><li><a href="#g:2">Creating TBChans</a></li><li><a href="#g:3">Reading from TBChans</a></li><li><a href="#g:4">Writing to TBChans</a></li><li><a href="#g:5">Predicates</a></li><li><a href="#g:6">Other functionality</a></li></ul></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>A version of <a href="file:///usr/share/doc/libghc-stm-doc/html/Control-Concurrent-STM-TChan.html">Control.Concurrent.STM.TChan</a> where the queue is
bounded in length. This variant incorporates ideas from Thomas
M. DuBuisson's <code>bounded-tchan</code> package in order to reduce
contention between readers and writers.</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:TBChan">TBChan</a> a</li><li class="src short"><a href="#v:newTBChan">newTBChan</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> (<a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a)</li><li class="src short"><a href="#v:newTBChanIO">newTBChanIO</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO.html#t:IO">IO</a> (<a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a)</li><li class="src short"><a href="#v:readTBChan">readTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> a</li><li class="src short"><a href="#v:tryReadTBChan">tryReadTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</li><li class="src short"><a href="#v:peekTBChan">peekTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> a</li><li class="src short"><a href="#v:tryPeekTBChan">tryPeekTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</li><li class="src short"><a href="#v:writeTBChan">writeTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> ()</li><li class="src short"><a href="#v:tryWriteTBChan">tryWriteTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:unGetTBChan">unGetTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> ()</li><li class="src short"><a href="#v:isEmptyTBChan">isEmptyTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isFullTBChan">isFullTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:estimateFreeSlotsTBChan">estimateFreeSlotsTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:freeSlotsTBChan">freeSlotsTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a></li></ul></div><div id="interface"><h1 id="g:1">The TBChan type</h1><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:TBChan" class="def">TBChan</a> a <a href="src/Control-Concurrent-STM-TBChan.html#TBChan" class="link">Source</a> <a href="#t:TBChan" class="selflink">#</a></p><div class="doc"><p><code>TBChan</code> is an abstract type representing a bounded FIFO
channel.</p></div></div><h2 id="g:2">Creating TBChans</h2><div class="top"><p class="src"><a id="v:newTBChan" class="def">newTBChan</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> (<a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a) <a href="src/Control-Concurrent-STM-TBChan.html#newTBChan" class="link">Source</a> <a href="#v:newTBChan" class="selflink">#</a></p><div class="doc"><p>Build and returns a new instance of <code>TBChan</code> with the given
capacity. <em>N.B.</em>, we do not verify the capacity is positive, but
if it is non-positive then <code><a href="Control-Concurrent-STM-TBChan.html#v:writeTBChan">writeTBChan</a></code> will always retry and
<code><a href="Control-Concurrent-STM-TBChan.html#v:isFullTBChan">isFullTBChan</a></code> will always be true.</p></div></div><div class="top"><p class="src"><a id="v:newTBChanIO" class="def">newTBChanIO</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO.html#t:IO">IO</a> (<a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a) <a href="src/Control-Concurrent-STM-TBChan.html#newTBChanIO" class="link">Source</a> <a href="#v:newTBChanIO" class="selflink">#</a></p><div class="doc"><p><code>IO</code> version of <code><a href="Control-Concurrent-STM-TBChan.html#v:newTBChan">newTBChan</a></code>. This is useful for creating
top-level <code>TBChan</code>s using <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO-Unsafe.html#v:unsafePerformIO">unsafePerformIO</a></code>, because using
<code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#v:atomically">atomically</a></code> inside <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO-Unsafe.html#v:unsafePerformIO">unsafePerformIO</a></code> isn't possible.</p></div></div><h2 id="g:3">Reading from TBChans</h2><div class="top"><p class="src"><a id="v:readTBChan" class="def">readTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> a <a href="src/Control-Concurrent-STM-TBChan.html#readTBChan" class="link">Source</a> <a href="#v:readTBChan" class="selflink">#</a></p><div class="doc"><p>Read the next value from the <code>TBChan</code>, retrying if the channel
is empty.</p></div></div><div class="top"><p class="src"><a id="v:tryReadTBChan" class="def">tryReadTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a) <a href="src/Control-Concurrent-STM-TBChan.html#tryReadTBChan" class="link">Source</a> <a href="#v:tryReadTBChan" class="selflink">#</a></p><div class="doc"><p>A version of <code><a href="Control-Concurrent-STM-TBChan.html#v:readTBChan">readTBChan</a></code> which does not retry. Instead it
returns <code>Nothing</code> if no value is available.</p></div></div><div class="top"><p class="src"><a id="v:peekTBChan" class="def">peekTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> a <a href="src/Control-Concurrent-STM-TBChan.html#peekTBChan" class="link">Source</a> <a href="#v:peekTBChan" class="selflink">#</a></p><div class="doc"><p>Get the next value from the <code>TBChan</code> without removing it,
retrying if the channel is empty.</p></div></div><div class="top"><p class="src"><a id="v:tryPeekTBChan" class="def">tryPeekTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a) <a href="src/Control-Concurrent-STM-TBChan.html#tryPeekTBChan" class="link">Source</a> <a href="#v:tryPeekTBChan" class="selflink">#</a></p><div class="doc"><p>A version of <code><a href="Control-Concurrent-STM-TBChan.html#v:peekTBChan">peekTBChan</a></code> which does not retry. Instead it
returns <code>Nothing</code> if no value is available.</p></div></div><h2 id="g:4">Writing to TBChans</h2><div class="top"><p class="src"><a id="v:writeTBChan" class="def">writeTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> () <a href="src/Control-Concurrent-STM-TBChan.html#writeTBChan" class="link">Source</a> <a href="#v:writeTBChan" class="selflink">#</a></p><div class="doc"><p>Write a value to a <code>TBChan</code>, retrying if the channel is full.</p></div></div><div class="top"><p class="src"><a id="v:tryWriteTBChan" class="def">tryWriteTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Control-Concurrent-STM-TBChan.html#tryWriteTBChan" class="link">Source</a> <a href="#v:tryWriteTBChan" class="selflink">#</a></p><div class="doc"><p>A version of <code><a href="Control-Concurrent-STM-TBChan.html#v:writeTBChan">writeTBChan</a></code> which does not retry. Returns <code>True</code>
if the value was successfully written, and <code>False</code> otherwise.</p></div></div><div class="top"><p class="src"><a id="v:unGetTBChan" class="def">unGetTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> () <a href="src/Control-Concurrent-STM-TBChan.html#unGetTBChan" class="link">Source</a> <a href="#v:unGetTBChan" class="selflink">#</a></p><div class="doc"><p>Put a data item back onto a channel, where it will be the next
item read. <em>N.B.</em>, this could allow the channel to temporarily
become longer than the specified limit, which is necessary to
ensure that the item is indeed the next one read.</p></div></div><h2 id="g:5">Predicates</h2><div class="top"><p class="src"><a id="v:isEmptyTBChan" class="def">isEmptyTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Control-Concurrent-STM-TBChan.html#isEmptyTBChan" class="link">Source</a> <a href="#v:isEmptyTBChan" class="selflink">#</a></p><div class="doc"><p>Returns <code>True</code> if the supplied <code>TBChan</code> is empty (i.e., has
no elements). <em>N.B.</em>, a <code>TBChan</code> can be both `<code>empty'</code> and
`<code>full'</code> at the same time, if the initial limit was non-positive.</p></div></div><div class="top"><p class="src"><a id="v:isFullTBChan" class="def">isFullTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Control-Concurrent-STM-TBChan.html#isFullTBChan" class="link">Source</a> <a href="#v:isFullTBChan" class="selflink">#</a></p><div class="doc"><p>Returns <code>True</code> if the supplied <code>TBChan</code> is full (i.e., is over
its limit). <em>N.B.</em>, a <code>TBChan</code> can be both `<code>empty'</code> and `<code>full'</code>
at the same time, if the initial limit was non-positive. <em>N.B.</em>,
a <code>TBChan</code> may still be full after reading, if <code><a href="Control-Concurrent-STM-TBChan.html#v:unGetTBChan">unGetTBChan</a></code> was
used to go over the initial limit.</p><p>This is equivalent to: <code>liftM (<= 0) estimateFreeSlotsTBMChan</code></p></div></div><h2 id="g:6">Other functionality</h2><div class="top"><p class="src"><a id="v:estimateFreeSlotsTBChan" class="def">estimateFreeSlotsTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> <a href="src/Control-Concurrent-STM-TBChan.html#estimateFreeSlotsTBChan" class="link">Source</a> <a href="#v:estimateFreeSlotsTBChan" class="selflink">#</a></p><div class="doc"><p>Estimate the number of free slots. If the result is positive,
then it's a minimum bound; if it's non-positive then it's exact.
It will only be negative if the initial limit was negative or
if <code><a href="Control-Concurrent-STM-TBChan.html#v:unGetTBChan">unGetTBChan</a></code> was used to go over the initial limit.</p><p>This function always contends with writers, but only contends
with readers when it has to; compare against <code><a href="Control-Concurrent-STM-TBChan.html#v:freeSlotsTBChan">freeSlotsTBChan</a></code>.</p></div></div><div class="top"><p class="src"><a id="v:freeSlotsTBChan" class="def">freeSlotsTBChan</a> :: <a href="Control-Concurrent-STM-TBChan.html#t:TBChan">TBChan</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Conc.html#t:STM">STM</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> <a href="src/Control-Concurrent-STM-TBChan.html#freeSlotsTBChan" class="link">Source</a> <a href="#v:freeSlotsTBChan" class="selflink">#</a></p><div class="doc"><p>Return the exact number of free slots. The result can be
negative if the initial limit was negative or if <code><a href="Control-Concurrent-STM-TBChan.html#v:unGetTBChan">unGetTBChan</a></code>
was used to go over the initial limit.</p><p>This function always contends with both readers and writers;
compare against <code><a href="Control-Concurrent-STM-TBChan.html#v:estimateFreeSlotsTBChan">estimateFreeSlotsTBChan</a></code>.</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.3</p></div></body></html>
|