Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > media > contrib-release > by-pkgid > 51057bcd013d992f61ce4c2b0a4565e3 > files > 142

haskell-hxt-8.3.2-1mdv2010.1.x86_64.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.Arrow.ArrowState</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-Arrow-ArrowState.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"
>hxt-8.3.2: A collection of tools for processing XML with Haskell.</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.Arrow.ArrowState</FONT
></TD
><TD ALIGN="right"
><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="infohead"
>Portability</TD
><TD CLASS="infoval"
>multy parameter classes and functional depenedencies required</TD
></TR
><TR
><TD CLASS="infohead"
>Stability</TD
><TD CLASS="infoval"
>experimental</TD
></TR
><TR
><TD CLASS="infohead"
>Maintainer</TD
><TD CLASS="infoval"
>Uwe Schmidt (uwe\@fh-wedel.de)</TD
></TR
></TABLE
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Description</TD
></TR
><TR
><TD CLASS="doc"
><P
>Arrows for managing an explicit state
</P
><P
>State arrows work similar to state monads.
   A state value is threaded through the application of arrows.
</P
></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"
>class</SPAN
> <A HREF="/usr/share/doc/ghc/libraries/base/Control-Arrow.html#t%3AArrow"
>Arrow</A
> a =&gt; <A HREF="#t%3AArrowState"
>ArrowState</A
> s a | a -&gt; s <SPAN CLASS="keyword"
>where</SPAN
></TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="decl"
><A HREF="#v%3AchangeState"
>changeState</A
> ::  (s -&gt; b -&gt; s) -&gt; a b b</TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AaccessState"
>accessState</A
> ::  (s -&gt; b -&gt; c) -&gt; a b c</TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AgetState"
>getState</A
> ::  a b s</TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AsetState"
>setState</A
> :: a s s</TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AnextState"
>nextState</A
> ::  (s -&gt; s) -&gt; a b s</TD
></TR
></TABLE
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Documentation</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>class</SPAN
> <A HREF="/usr/share/doc/ghc/libraries/base/Control-Arrow.html#t%3AArrow"
>Arrow</A
> a =&gt; <A NAME="t:ArrowState"
><A NAME="t%3AArrowState"
></A
></A
><B
>ArrowState</B
> s a | a -&gt; s <SPAN CLASS="keyword"
>where</SPAN
></TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="ndoc"
><P
>The interface for accessing and changing the state component.
</P
><P
>Multi parameter classes and functional dependencies are required.
</P
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="section4"
>Methods</TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="decl"
><A NAME="v:changeState"
><A NAME="v%3AchangeState"
></A
></A
><B
>changeState</B
> ::  (s -&gt; b -&gt; s) -&gt; a b b</TD
></TR
><TR
><TD CLASS="doc"
>change the state of a state arrow by applying a function
 for computing a new state from the old and the arrow input.
 Result is the arrow input
</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:accessState"
><A NAME="v%3AaccessState"
></A
></A
><B
>accessState</B
> ::  (s -&gt; b -&gt; c) -&gt; a b c</TD
></TR
><TR
><TD CLASS="doc"
>access the state with a function using the arrow input
 as data for selecting state components.
</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:getState"
><A NAME="v%3AgetState"
></A
></A
><B
>getState</B
> ::  a b s</TD
></TR
><TR
><TD CLASS="doc"
><P
>read the complete state, ignore arrow input
</P
><P
>definition: <TT
> getState = accessState (\ s x -&gt; s) </TT
> 
</P
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:setState"
><A NAME="v%3AsetState"
></A
></A
><B
>setState</B
> :: a s s</TD
></TR
><TR
><TD CLASS="doc"
><P
>overwrite the old state
</P
><P
>definition: <TT
> setState = changeState (\ s x -&gt; x) </TT
>
</P
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:nextState"
><A NAME="v%3AnextState"
></A
></A
><B
>nextState</B
> ::  (s -&gt; s) -&gt; a b s</TD
></TR
><TR
><TD CLASS="doc"
><P
>change state (and ignore input) and return new state
</P
><P
>convenience function,
 usefull for generating e.g. unique identifiers:
</P
><P
>example with SLA state list arrows
</P
><PRE
> newId :: SLA Int b String
 newId = nextState (+1)
         &gt;&gt;&gt;
         arr (('#':) . show)
 
 runSLA 0 (newId &lt;+&gt; newId &lt;+&gt; newId) undefined
   = [&quot;#1&quot;, &quot;#2&quot;, &quot;#3&quot;]
</PRE
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="section4"
><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:ArrowState')" ALT="show/hide"
> Instances</TD
></TR
><TR
><TD CLASS="body"
><DIV ID="i:ArrowState" STYLE="display:block;"
><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"
><TR
><TD CLASS="decl"
><A HREF="Control-Arrow-ArrowState.html#t%3AArrowState"
>ArrowState</A
> s (<A HREF="Control-Arrow-StateListArrow.html#t%3ASLA"
>SLA</A
> s)</TD
></TR
><TR
><TD CLASS="decl"
><A HREF="Control-Arrow-ArrowState.html#t%3AArrowState"
>ArrowState</A
> s (<A HREF="Control-Arrow-IOStateListArrow.html#t%3AIOSLA"
>IOSLA</A
> s)</TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
></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.5.0</TD
></TR
></TABLE
></BODY
></HTML
>