/usr/share/doc/libghc-arrows-doc/html/Control-Arrow-Operations.html is in libghc-arrows-doc 0.4.4.1-7.
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 35 36 37 38 39 | <!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.Arrow.Operations</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Control-Arrow-Operations.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Control-Arrow-Operations.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">arrows-0.4.4.1: Arrow classes and transformers</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Copyright</th><td>(c) Ross Paterson 2003</td></tr><tr><th>License</th><td>BSD-style (see the LICENSE file in the distribution)</td></tr><tr><th>Maintainer</th><td>ross@soi.city.ac.uk</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Portability</th><td>non-portable (multi-parameter type classes)</td></tr><tr><th>Safe Haskell</th><td>Safe</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Control.Arrow.Operations</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Conventions</a></li><li><a href="#g:2">State transformers</a></li><li><a href="#g:3">State readers</a></li><li><a href="#g:4">Monoid writers</a></li><li><a href="#g:5">Errors</a></li><li><a href="#g:6">Synchronous circuits</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Subclasses of <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:Arrow">Arrow</a></code> providing additional operations.</p><p>The signatures are designed to be compatible with the proposed
notation for arrows, cf. <a href="http://www.haskell.org/arrows/">http://www.haskell.org/arrows/</a>.</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">class</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:Arrow">Arrow</a> a => <a href="#t:ArrowState">ArrowState</a> s a | a -> s <span class="keyword">where</span><ul class="subs"><li><a href="#v:fetch">fetch</a> :: a e s</li><li><a href="#v:store">store</a> :: a s ()</li></ul></li><li class="src short"><span class="keyword">class</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:Arrow">Arrow</a> a => <a href="#t:ArrowReader">ArrowReader</a> r a | a -> r <span class="keyword">where</span><ul class="subs"><li><a href="#v:readState">readState</a> :: a b r</li><li><a href="#v:newReader">newReader</a> :: a e b -> a (e, r) b</li></ul></li><li class="src short"><span class="keyword">class</span> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> w, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:Arrow">Arrow</a> a) => <a href="#t:ArrowWriter">ArrowWriter</a> w a | a -> w <span class="keyword">where</span><ul class="subs"><li><a href="#v:write">write</a> :: a w ()</li><li><a href="#v:newWriter">newWriter</a> :: a e b -> a e (b, w)</li></ul></li><li class="src short"><span class="keyword">class</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:Arrow">Arrow</a> a => <a href="#t:ArrowError">ArrowError</a> ex a | a -> ex <span class="keyword">where</span><ul class="subs"><li><a href="#v:raise">raise</a> :: a ex b</li><li><a href="#v:handle">handle</a> :: a e b -> a (e, ex) b -> a e b</li><li><a href="#v:tryInUnless">tryInUnless</a> :: a e b -> a (e, b) c -> a (e, ex) c -> a e c</li><li><a href="#v:newError">newError</a> :: a e b -> a e (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> ex b)</li></ul></li><li class="src short"><a href="#v:tryInUnlessDefault">tryInUnlessDefault</a> :: (<a href="Control-Arrow-Operations.html#t:ArrowError">ArrowError</a> ex a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a) => a e b -> a (e, b) c -> a (e, ex) c -> a e c</li><li class="src short"><span class="keyword">class</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:ArrowLoop">ArrowLoop</a> a => <a href="#t:ArrowCircuit">ArrowCircuit</a> a <span class="keyword">where</span><ul class="subs"><li><a href="#v:delay">delay</a> :: b -> a b b</li></ul></li></ul></div><div id="interface"><h1 id="g:1">Conventions</h1><div class="doc"><p>The arrow classes defined in this module have names like <code>Arrow</code><em>Foo</em>,
and contain operations specific to such arrows. Some of these include
a method <code>new</code><em>Foo</em>, which maps computations to computations of the
same arrow type, but exposing some of the internals of the arrow.</p><p>Arrow transformers have names like <em>Bar</em><code>Arrow</code>, and are
instances of appropriate arrow classes. For each arrow
transformer, there is typically an encapsulation operator
<code>run</code><em>Bar</em> that removes that transformer from the outside of an
arrow type. The <code><a href="Control-Arrow-Transformer.html#v:lift">lift</a></code> method of the
<code><a href="Control-Arrow-Transformer.html#v:ArrowTransformer">ArrowTransformer</a></code> class adds an arrow
transformer to the outside of an arrow type.</p><p>Typically a composite arrow type is built by applying a series of arrow
transformers to a base arrow (usually either a function arrow or a
<code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:Kleisli">Kleisli</a></code> arrow. The <code><a href="Control-Arrow-Transformer.html#v:lift">lift</a></code> method and the
<code>run</code><em>Bar</em> function operate only on the arrow transformer at the top
of this stack. For more sophisticated manipulation of this stack of
arrow transformers, many arrow transformers provide an <code>ArrowAdd</code><em>Bar</em>
class, with methods methods <code>lift</code><em>Bar</em> and <code>elim</code><em>Bar</em> to add and remove
the transformer anywhere in the stack.</p></div><h1 id="g:2">State transformers</h1><div class="top"><p class="src"><span class="keyword">class</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:Arrow">Arrow</a> a => <a name="t:ArrowState" class="def">ArrowState</a> s a | a -> s <span class="keyword">where</span> <a href="src/Control-Arrow-Operations.html#ArrowState" class="link">Source</a></p><div class="doc"><p>An arrow type that provides a modifiable state,
based of section 9 of <em>Generalising Monads to Arrows</em>, by John Hughes,
<em>Science of Computer Programming</em> 37:67-111, May 2000.</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:fetch" class="def">fetch</a> :: a e s <a href="src/Control-Arrow-Operations.html#fetch" class="link">Source</a></p><div class="doc"><p>Obtain the current value of the state.</p></div><p class="src"><a name="v:store" class="def">store</a> :: a s () <a href="src/Control-Arrow-Operations.html#store" class="link">Source</a></p><div class="doc"><p>Assign a new value to the state.</p></div></div><div class="subs instances"><p id="control.i:ArrowState" class="caption collapser" onclick="toggleSection('i:ArrowState')">Instances</p><div id="section.i:ArrowState" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Arrow-Operations.html#t:ArrowState">ArrowState</a> s a => <a href="Control-Arrow-Operations.html#t:ArrowState">ArrowState</a> s (<a href="Control-Arrow-Transformer-Automaton.html#t:Automaton">Automaton</a> a)</span> <a href="src/Control-Arrow-Operations.html#line-165" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Arrow-Operations.html#t:ArrowState">ArrowState</a> s a => <a href="Control-Arrow-Operations.html#t:ArrowState">ArrowState</a> s (<a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a)</span> <a href="src/Control-Arrow-Operations.html#line-69" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Control-Arrow-Operations.html#t:ArrowState">ArrowState</a> s a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a) => <a href="Control-Arrow-Operations.html#t:ArrowState">ArrowState</a> s (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a)</span> <a href="src/Control-Arrow-Operations.html#line-150" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:Arrow">Arrow</a> a => <a href="Control-Arrow-Operations.html#t:ArrowState">ArrowState</a> s (<a href="Control-Arrow-Transformer-State.html#t:StateArrow">StateArrow</a> s a)</span> <a href="src/Control-Arrow-Operations.html#line-68" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Control-Arrow-Operations.html#t:ArrowState">ArrowState</a> s a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> f) => <a href="Control-Arrow-Operations.html#t:ArrowState">ArrowState</a> s (<a href="Control-Arrow-Transformer-Static.html#t:StaticArrow">StaticArrow</a> f a)</span> <a href="src/Control-Arrow-Operations.html#line-66" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Control-Arrow-Operations.html#t:ArrowState">ArrowState</a> s a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> w) => <a href="Control-Arrow-Operations.html#t:ArrowState">ArrowState</a> s (<a href="Control-Arrow-Transformer-Writer.html#t:WriterArrow">WriterArrow</a> w a)</span> <a href="src/Control-Arrow-Operations.html#line-139" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Arrow-Operations.html#t:ArrowState">ArrowState</a> s a => <a href="Control-Arrow-Operations.html#t:ArrowState">ArrowState</a> s (<a href="Control-Arrow-Transformer-Reader.html#t:ReaderArrow">ReaderArrow</a> r a)</span> <a href="src/Control-Arrow-Operations.html#line-110" class="link">Source</a></td><td class="doc empty"> </td></tr></table></div></div></div><h1 id="g:3">State readers</h1><div class="top"><p class="src"><span class="keyword">class</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:Arrow">Arrow</a> a => <a name="t:ArrowReader" class="def">ArrowReader</a> r a | a -> r <span class="keyword">where</span> <a href="src/Control-Arrow-Operations.html#ArrowReader" class="link">Source</a></p><div class="doc"><p>An arrow type that provides a read-only state (an environment).
If you also need to modify the state, use <code><a href="Control-Arrow-Operations.html#t:ArrowState">ArrowState</a></code>.</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:readState" class="def">readState</a> :: a b r <a href="src/Control-Arrow-Operations.html#readState" class="link">Source</a></p><div class="doc"><p>Obtain the current value of the state.</p></div><p class="src"><a name="v:newReader" class="def">newReader</a> :: a e b -> a (e, r) b <a href="src/Control-Arrow-Operations.html#newReader" class="link">Source</a></p><div class="doc"><p>Run a subcomputation in the same arrow, but with a different
environment. The environment of the outer computation is
unaffected.</p><p>Typical usage in arrow notation:</p><pre> proc p -> ...
(|newReader cmd|) env</pre></div></div><div class="subs instances"><p id="control.i:ArrowReader" class="caption collapser" onclick="toggleSection('i:ArrowReader')">Instances</p><div id="section.i:ArrowReader" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Arrow-Operations.html#t:ArrowReader">ArrowReader</a> r a => <a href="Control-Arrow-Operations.html#t:ArrowReader">ArrowReader</a> r (<a href="Control-Arrow-Transformer-Automaton.html#t:Automaton">Automaton</a> a)</span> <a href="src/Control-Arrow-Operations.html#line-160" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Control-Arrow-Operations.html#t:ArrowReader">ArrowReader</a> r a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a) => <a href="Control-Arrow-Operations.html#t:ArrowReader">ArrowReader</a> r (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a)</span> <a href="src/Control-Arrow-Operations.html#line-145" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Arrow-Operations.html#t:ArrowReader">ArrowReader</a> r a => <a href="Control-Arrow-Operations.html#t:ArrowReader">ArrowReader</a> r (<a href="Control-Arrow-Transformer-State.html#t:StateArrow">StateArrow</a> s a)</span> <a href="src/Control-Arrow-Operations.html#line-97" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Control-Arrow-Operations.html#t:ArrowReader">ArrowReader</a> r a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> f) => <a href="Control-Arrow-Operations.html#t:ArrowReader">ArrowReader</a> r (<a href="Control-Arrow-Transformer-Static.html#t:StaticArrow">StaticArrow</a> f a)</span> <a href="src/Control-Arrow-Operations.html#line-62" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Control-Arrow-Operations.html#t:ArrowReader">ArrowReader</a> r a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> w) => <a href="Control-Arrow-Operations.html#t:ArrowReader">ArrowReader</a> r (<a href="Control-Arrow-Transformer-Writer.html#t:WriterArrow">WriterArrow</a> w a)</span> <a href="src/Control-Arrow-Operations.html#line-135" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:Arrow">Arrow</a> a => <a href="Control-Arrow-Operations.html#t:ArrowReader">ArrowReader</a> r (<a href="Control-Arrow-Transformer-Reader.html#t:ReaderArrow">ReaderArrow</a> r a)</span> <a href="src/Control-Arrow-Operations.html#line-90" class="link">Source</a></td><td class="doc empty"> </td></tr></table></div></div></div><h1 id="g:4">Monoid writers</h1><div class="top"><p class="src"><span class="keyword">class</span> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> w, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:Arrow">Arrow</a> a) => <a name="t:ArrowWriter" class="def">ArrowWriter</a> w a | a -> w <span class="keyword">where</span> <a href="src/Control-Arrow-Operations.html#ArrowWriter" class="link">Source</a></p><div class="doc"><p>An arrow type that collects additional output (of some <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a></code> type).</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:write" class="def">write</a> :: a w () <a href="src/Control-Arrow-Operations.html#write" class="link">Source</a></p><div class="doc"><p>Add a piece of additional output.</p></div><p class="src"><a name="v:newWriter" class="def">newWriter</a> :: a e b -> a e (b, w) <a href="src/Control-Arrow-Operations.html#newWriter" class="link">Source</a></p><div class="doc"><p>Run a subcomputation in the same arrow, making its additional
output accessible.</p><p>Typical usage in arrow notation:</p><pre> proc p -> do
...
(value, output) <- (|newWriter cmd|)</pre></div></div><div class="subs instances"><p id="control.i:ArrowWriter" class="caption collapser" onclick="toggleSection('i:ArrowWriter')">Instances</p><div id="section.i:ArrowWriter" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Arrow-Operations.html#t:ArrowWriter">ArrowWriter</a> w a => <a href="Control-Arrow-Operations.html#t:ArrowWriter">ArrowWriter</a> w (<a href="Control-Arrow-Transformer-Automaton.html#t:Automaton">Automaton</a> a)</span> <a href="src/Control-Arrow-Operations.html#line-143" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Arrow-Operations.html#t:ArrowWriter">ArrowWriter</a> w a => <a href="Control-Arrow-Operations.html#t:ArrowWriter">ArrowWriter</a> w (<a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a)</span> <a href="src/Control-Arrow-Operations.html#line-73" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Control-Arrow-Operations.html#t:ArrowWriter">ArrowWriter</a> w a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a) => <a href="Control-Arrow-Operations.html#t:ArrowWriter">ArrowWriter</a> w (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a)</span> <a href="src/Control-Arrow-Operations.html#line-155" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Arrow-Operations.html#t:ArrowWriter">ArrowWriter</a> w a => <a href="Control-Arrow-Operations.html#t:ArrowWriter">ArrowWriter</a> w (<a href="Control-Arrow-Transformer-State.html#t:StateArrow">StateArrow</a> s a)</span> <a href="src/Control-Arrow-Operations.html#line-101" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Control-Arrow-Operations.html#t:ArrowWriter">ArrowWriter</a> w a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> f) => <a href="Control-Arrow-Operations.html#t:ArrowWriter">ArrowWriter</a> w (<a href="Control-Arrow-Transformer-Static.html#t:StaticArrow">StaticArrow</a> f a)</span> <a href="src/Control-Arrow-Operations.html#line-70" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:Arrow">Arrow</a> a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> w) => <a href="Control-Arrow-Operations.html#t:ArrowWriter">ArrowWriter</a> w (<a href="Control-Arrow-Transformer-Writer.html#t:WriterArrow">WriterArrow</a> w a)</span> <a href="src/Control-Arrow-Operations.html#line-110" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Arrow-Operations.html#t:ArrowWriter">ArrowWriter</a> s a => <a href="Control-Arrow-Operations.html#t:ArrowWriter">ArrowWriter</a> s (<a href="Control-Arrow-Transformer-Reader.html#t:ReaderArrow">ReaderArrow</a> r a)</span> <a href="src/Control-Arrow-Operations.html#line-114" class="link">Source</a></td><td class="doc empty"> </td></tr></table></div></div></div><h1 id="g:5">Errors</h1><div class="top"><p class="src"><span class="keyword">class</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:Arrow">Arrow</a> a => <a name="t:ArrowError" class="def">ArrowError</a> ex a | a -> ex <span class="keyword">where</span> <a href="src/Control-Arrow-Operations.html#ArrowError" class="link">Source</a></p><div class="doc"><p>An arrow type that includes errors (or exceptions).</p><p>Minimal definition: <code><a href="Control-Arrow-Operations.html#v:raise">raise</a></code> and <code><a href="Control-Arrow-Operations.html#v:tryInUnless">tryInUnless</a></code>.</p><p><em>TODO:</em> the operations here are inconsistent with other arrow transformers.</p></div><div class="subs minimal"><p class="caption">Minimal complete definition</p><p class="src"><a href="Control-Arrow-Operations.html#v:raise">raise</a>, <a href="Control-Arrow-Operations.html#v:tryInUnless">tryInUnless</a></p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:raise" class="def">raise</a> :: a ex b <a href="src/Control-Arrow-Operations.html#raise" class="link">Source</a></p><div class="doc"><p>Raise an error.</p></div><p class="src"><a name="v:handle" class="def">handle</a> <a href="src/Control-Arrow-Operations.html#handle" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: a e b</td><td class="doc"><p>computation that may raise errors</p></td></tr><tr><td class="src">-> a (e, ex) b</td><td class="doc"><p>computation to handle errors</p></td></tr><tr><td class="src">-> a e b</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Traditional exception construct.</p><p>Typical usage in arrow notation:</p><pre> proc p -> ...
body `handle` \ex -> handler</pre></div><p class="src"><a name="v:tryInUnless" class="def">tryInUnless</a> <a href="src/Control-Arrow-Operations.html#tryInUnless" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: a e b</td><td class="doc"><p>computation that may raise errors</p></td></tr><tr><td class="src">-> a (e, b) c</td><td class="doc"><p>computation to receive successful results</p></td></tr><tr><td class="src">-> a (e, ex) c</td><td class="doc"><p>computation to handle errors</p></td></tr><tr><td class="src">-> a e c</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Exception construct in the style of <em>Exceptional Syntax</em>,
by Nick Benton and Andrew Kennedy, <em>JFP</em> 11(4):395-410, July 2001.</p><p>Typical usage in arrow notation:</p><pre> proc p -> ...
(|tryInUnless
body
(\res -> success)
(\ex -> handler)
|)</pre></div><p class="src"><a name="v:newError" class="def">newError</a> :: a e b -> a e (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> ex b) <a href="src/Control-Arrow-Operations.html#newError" class="link">Source</a></p><div class="doc"><p>Handler that returns the error as a value.</p></div></div><div class="subs instances"><p id="control.i:ArrowError" class="caption collapser" onclick="toggleSection('i:ArrowError')">Instances</p><div id="section.i:ArrowError" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Arrow-Operations.html#t:ArrowError">ArrowError</a> r a => <a href="Control-Arrow-Operations.html#t:ArrowError">ArrowError</a> r (<a href="Control-Arrow-Transformer-Automaton.html#t:Automaton">Automaton</a> a)</span> <a href="src/Control-Arrow-Operations.html#line-149" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a => <a href="Control-Arrow-Operations.html#t:ArrowError">ArrowError</a> ex (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a)</span> <a href="src/Control-Arrow-Operations.html#line-118" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Arrow-Operations.html#t:ArrowError">ArrowError</a> ex a => <a href="Control-Arrow-Operations.html#t:ArrowError">ArrowError</a> ex (<a href="Control-Arrow-Transformer-State.html#t:StateArrow">StateArrow</a> s a)</span> <a href="src/Control-Arrow-Operations.html#line-84" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Control-Arrow-Operations.html#t:ArrowError">ArrowError</a> ex a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> f) => <a href="Control-Arrow-Operations.html#t:ArrowError">ArrowError</a> ex (<a href="Control-Arrow-Transformer-Static.html#t:StaticArrow">StaticArrow</a> f a)</span> <a href="src/Control-Arrow-Operations.html#line-55" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Control-Arrow-Operations.html#t:ArrowError">ArrowError</a> ex a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> w) => <a href="Control-Arrow-Operations.html#t:ArrowError">ArrowError</a> ex (<a href="Control-Arrow-Transformer-Writer.html#t:WriterArrow">WriterArrow</a> w a)</span> <a href="src/Control-Arrow-Operations.html#line-124" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Arrow-Operations.html#t:ArrowError">ArrowError</a> ex a => <a href="Control-Arrow-Operations.html#t:ArrowError">ArrowError</a> ex (<a href="Control-Arrow-Transformer-Reader.html#t:ReaderArrow">ReaderArrow</a> r a)</span> <a href="src/Control-Arrow-Operations.html#line-103" class="link">Source</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:tryInUnlessDefault" class="def">tryInUnlessDefault</a> <a href="src/Control-Arrow-Operations.html#tryInUnlessDefault" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="Control-Arrow-Operations.html#t:ArrowError">ArrowError</a> ex a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src">=> a e b</td><td class="doc"><p>computation that may raise errors</p></td></tr><tr><td class="src">-> a (e, b) c</td><td class="doc"><p>computation to receive successful results</p></td></tr><tr><td class="src">-> a (e, ex) c</td><td class="doc"><p>computation to handle errors</p></td></tr><tr><td class="src">-> a e c</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>A suitable value for <code><a href="Control-Arrow-Operations.html#v:tryInUnless">tryInUnless</a></code> when the arrow type belongs to
<code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a></code>. To use it, you must define either <code><a href="Control-Arrow-Operations.html#v:handle">handle</a></code> or <code><a href="Control-Arrow-Operations.html#v:newError">newError</a></code>.</p></div></div><h1 id="g:6">Synchronous circuits</h1><div class="top"><p class="src"><span class="keyword">class</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:ArrowLoop">ArrowLoop</a> a => <a name="t:ArrowCircuit" class="def">ArrowCircuit</a> a <span class="keyword">where</span> <a href="src/Control-Arrow-Operations.html#ArrowCircuit" class="link">Source</a></p><div class="doc"><p>An arrow type that can be used to interpret synchronous circuits.</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:delay" class="def">delay</a> <a href="src/Control-Arrow-Operations.html#delay" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: b</td><td class="doc"><p>the value to return initially.</p></td></tr><tr><td class="src">-> a b b</td><td class="doc"><p>an arrow that propagates its input
with a one-tick delay.</p></td></tr></table></div><div class="doc"><p>A delay component.</p></div></div><div class="subs instances"><p id="control.i:ArrowCircuit" class="caption collapser" onclick="toggleSection('i:ArrowCircuit')">Instances</p><div id="section.i:ArrowCircuit" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:ArrowLoop">ArrowLoop</a> a => <a href="Control-Arrow-Operations.html#t:ArrowCircuit">ArrowCircuit</a> (<a href="Control-Arrow-Transformer-Automaton.html#t:Automaton">Automaton</a> a)</span> <a href="src/Control-Arrow-Operations.html#line-91" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:ArrowLoop">ArrowLoop</a> a => <a href="Control-Arrow-Operations.html#t:ArrowCircuit">ArrowCircuit</a> (<a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a)</span> <a href="src/Control-Arrow-Operations.html#line-103" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Arrow-Operations.html#t:ArrowCircuit">ArrowCircuit</a> a => <a href="Control-Arrow-Operations.html#t:ArrowCircuit">ArrowCircuit</a> (<a href="Control-Arrow-Transformer-State.html#t:StateArrow">StateArrow</a> s a)</span> <a href="src/Control-Arrow-Operations.html#line-81" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Control-Arrow-Operations.html#t:ArrowCircuit">ArrowCircuit</a> a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> f) => <a href="Control-Arrow-Operations.html#t:ArrowCircuit">ArrowCircuit</a> (<a href="Control-Arrow-Transformer-Static.html#t:StaticArrow">StaticArrow</a> f a)</span> <a href="src/Control-Arrow-Operations.html#line-52" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Control-Arrow-Operations.html#t:ArrowCircuit">ArrowCircuit</a> a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> w) => <a href="Control-Arrow-Operations.html#t:ArrowCircuit">ArrowCircuit</a> (<a href="Control-Arrow-Transformer-Writer.html#t:WriterArrow">WriterArrow</a> w a)</span> <a href="src/Control-Arrow-Operations.html#line-121" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Arrow-Operations.html#t:ArrowCircuit">ArrowCircuit</a> a => <a href="Control-Arrow-Operations.html#t:ArrowCircuit">ArrowCircuit</a> (<a href="Control-Arrow-Transformer-Reader.html#t:ReaderArrow">ReaderArrow</a> r a)</span> <a href="src/Control-Arrow-Operations.html#line-100" class="link">Source</a></td><td class="doc empty"> </td></tr></table></div></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>
|