Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 1f2b142b9d2ef4849a6f5316fa1c5b12 > files > 1346

ghc-6.10.4-1mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--Rendered using the Haskell Html Library v0.2-->
<HTML
><HEAD
><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"
><TITLE
>Control.Concurrent.SampleVar</TITLE
><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"
><SCRIPT SRC="haddock-util.js" TYPE="text/javascript"
></SCRIPT
><SCRIPT TYPE="text/javascript"
>window.onload = function () {setSynopsis("mini_Control-Concurrent-SampleVar.html")};</SCRIPT
></HEAD
><BODY
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="topbar"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD
><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "
></TD
><TD CLASS="title"
>base-4.1.0.0: Basic libraries</TD
><TD CLASS="topbut"
><A HREF="index.html"
>Contents</A
></TD
><TD CLASS="topbut"
><A HREF="doc-index.html"
>Index</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="modulebar"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD
><FONT SIZE="6"
>Control.Concurrent.SampleVar</FONT
></TD
><TD ALIGN="right"
><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="infohead"
>Portability</TD
><TD CLASS="infoval"
>non-portable (concurrency)</TD
></TR
><TR
><TD CLASS="infohead"
>Stability</TD
><TD CLASS="infoval"
>experimental</TD
></TR
><TR
><TD CLASS="infohead"
>Maintainer</TD
><TD CLASS="infoval"
>libraries@haskell.org</TD
></TR
></TABLE
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="section4"
><B
>Contents</B
></TD
></TR
><TR
><TD
><DL
><DT
><A HREF="#1"
>Sample Variables
</A
></DT
></DL
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Description</TD
></TR
><TR
><TD CLASS="doc"
>Sample variables
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Synopsis</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>type</SPAN
> <A HREF="#t%3ASampleVar"
>SampleVar</A
> a = <A HREF="Control-Concurrent-MVar.html#t%3AMVar"
>MVar</A
> (<A HREF="../ghc-prim/GHC-Types.html#t%3AInt"
>Int</A
>, <A HREF="Control-Concurrent-MVar.html#t%3AMVar"
>MVar</A
> a)</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AnewEmptySampleVar"
>newEmptySampleVar</A
> ::  <A HREF="System-IO.html#t%3AIO"
>IO</A
> (<A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
> a)</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AnewSampleVar"
>newSampleVar</A
> ::  a -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> (<A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
> a)</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AemptySampleVar"
>emptySampleVar</A
> ::  <A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
> a -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="../ghc-prim/GHC-Unit.html#t%3A%28%29"
>()</A
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AreadSampleVar"
>readSampleVar</A
> ::  <A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
> a -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> a</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AwriteSampleVar"
>writeSampleVar</A
> ::  <A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
> a -&gt; a -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="../ghc-prim/GHC-Unit.html#t%3A%28%29"
>()</A
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AisEmptySampleVar"
>isEmptySampleVar</A
> ::  <A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
> a -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool"
>Bool</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
><A NAME="1"
><A NAME="1"
>Sample Variables
</A
></A
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>type</SPAN
> <A NAME="t:SampleVar"
><A NAME="t%3ASampleVar"
></A
></A
><B
>SampleVar</B
> a = <A HREF="Control-Concurrent-MVar.html#t%3AMVar"
>MVar</A
> (<A HREF="../ghc-prim/GHC-Types.html#t%3AInt"
>Int</A
>, <A HREF="Control-Concurrent-MVar.html#t%3AMVar"
>MVar</A
> a)</TD
></TR
><TR
><TD CLASS="doc"
><P
>Sample variables are slightly different from a normal <TT
><A HREF="Control-Concurrent-MVar.html#t%3AMVar"
>MVar</A
></TT
>:
</P
><UL
><LI
> Reading an empty <TT
><A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
></TT
> causes the reader to block.
    (same as <TT
><A HREF="Control-Concurrent-MVar.html#v%3AtakeMVar"
>takeMVar</A
></TT
> on empty <TT
><A HREF="Control-Concurrent-MVar.html#t%3AMVar"
>MVar</A
></TT
>)
</LI
><LI
> Reading a filled <TT
><A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
></TT
> empties it and returns value.
    (same as <TT
><A HREF="Control-Concurrent-MVar.html#v%3AtakeMVar"
>takeMVar</A
></TT
>)
</LI
><LI
> Writing to an empty <TT
><A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
></TT
> fills it with a value, and
    potentially, wakes up a blocked reader (same as for <TT
><A HREF="Control-Concurrent-MVar.html#v%3AputMVar"
>putMVar</A
></TT
> on
    empty <TT
><A HREF="Control-Concurrent-MVar.html#t%3AMVar"
>MVar</A
></TT
>).
</LI
><LI
> Writing to a filled <TT
><A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
></TT
> overwrites the current value.
    (different from <TT
><A HREF="Control-Concurrent-MVar.html#v%3AputMVar"
>putMVar</A
></TT
> on full <TT
><A HREF="Control-Concurrent-MVar.html#t%3AMVar"
>MVar</A
></TT
>.)
</LI
></UL
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:newEmptySampleVar"
><A NAME="v%3AnewEmptySampleVar"
></A
></A
><B
>newEmptySampleVar</B
> ::  <A HREF="System-IO.html#t%3AIO"
>IO</A
> (<A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
> a)</TD
></TR
><TR
><TD CLASS="doc"
>Build a new, empty, <TT
><A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
></TT
>
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:newSampleVar"
><A NAME="v%3AnewSampleVar"
></A
></A
><B
>newSampleVar</B
> ::  a -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> (<A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
> a)</TD
></TR
><TR
><TD CLASS="doc"
>Build a <TT
><A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
></TT
> with an initial value.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:emptySampleVar"
><A NAME="v%3AemptySampleVar"
></A
></A
><B
>emptySampleVar</B
> ::  <A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
> a -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="../ghc-prim/GHC-Unit.html#t%3A%28%29"
>()</A
></TD
></TR
><TR
><TD CLASS="doc"
>If the SampleVar is full, leave it empty.  Otherwise, do nothing.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:readSampleVar"
><A NAME="v%3AreadSampleVar"
></A
></A
><B
>readSampleVar</B
> ::  <A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
> a -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> a</TD
></TR
><TR
><TD CLASS="doc"
>Wait for a value to become available, then take it and return.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:writeSampleVar"
><A NAME="v%3AwriteSampleVar"
></A
></A
><B
>writeSampleVar</B
> ::  <A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
> a -&gt; a -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="../ghc-prim/GHC-Unit.html#t%3A%28%29"
>()</A
></TD
></TR
><TR
><TD CLASS="doc"
>Write a value into the <TT
><A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
></TT
>, overwriting any previous value that
 was there.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:isEmptySampleVar"
><A NAME="v%3AisEmptySampleVar"
></A
></A
><B
>isEmptySampleVar</B
> ::  <A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
> a -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool"
>Bool</A
></TD
></TR
><TR
><TD CLASS="doc"
><P
>Returns <TT
><A HREF="../ghc-prim/GHC-Bool.html#v%3ATrue"
>True</A
></TT
> if the <TT
><A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
></TT
> is currently empty.
</P
><P
>Note that this function is only useful if you know that no other
 threads can be modifying the state of the <TT
><A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
></TT
>, because
 otherwise the state of the <TT
><A HREF="Control-Concurrent-SampleVar.html#t%3ASampleVar"
>SampleVar</A
></TT
> may have changed by the time
 you see the result of <TT
><A HREF="Control-Concurrent-SampleVar.html#v%3AisEmptySampleVar"
>isEmptySampleVar</A
></TT
>.
</P
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="botbar"
>Produced by <A HREF="http://www.haskell.org/haddock/"
>Haddock</A
> version 2.4.2</TD
></TR
></TABLE
></BODY
></HTML
>