<!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.Transformer.Error</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-Transformer-Error.html");}; //]]> </script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Control-Arrow-Transformer-Error.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>Portability</th><td>non-portable (multi-parameter type classes)</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Maintainer</th><td>ross@soi.city.ac.uk</td></tr><tr><th>Safe Haskell</th><td>Safe-Infered</td></tr></table><p class="caption">Control.Arrow.Transformer.Error</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>An arrow transformer that adds error handling. </p><p><em>TODO:</em> the operations here are inconsistent with other arrow transformers. </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">newtype</span> <a href="#t:ErrorArrow">ErrorArrow</a> ex a b c = <a href="#v:ErrorArrow">ErrorArrow</a> (a b (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> ex c))</li><li class="src short"><a href="#v:runError">runError</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a => <a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a e b -> a (e, ex) b -> a e b</li><li class="src short"><span class="keyword">class</span> (<a href="Control-Arrow-Operations.html#t:ArrowError">ArrowError</a> ex a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:Arrow">Arrow</a> a') => <a href="#t:ArrowAddError">ArrowAddError</a> ex a a' | a -> a' <span class="keyword">where</span><ul class="subs"><li><a href="#v:liftError">liftError</a> :: a' e b -> a e b</li><li><a href="#v:elimError">elimError</a> :: a e b -> a' (e, ex) b -> a' e b</li></ul></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">newtype</span> <a name="t:ErrorArrow" class="def">ErrorArrow</a> ex a b c <a href="src/Control-Arrow-Transformer-Error.html#ErrorArrow" class="link">Source</a></p><div class="doc"><p>An arrow that augments an existing arrow with possible errors. The <code><a href="Control-Arrow-Operations.html#t:ArrowError">ArrowError</a></code> class contains methods for raising and handling these errors. </p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:ErrorArrow" class="def">ErrorArrow</a> (a b (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> ex c))</td><td class="doc empty"> </td></tr></table></div><div class="subs instances"><p id="control.i:ErrorArrow" class="caption collapser" onclick="toggleSection('i:ErrorArrow')">Instances</p><div id="section.i:ErrorArrow" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.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)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="Control-Arrow-Operations.html#t:ArrowWriter">ArrowWriter</a> w a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.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)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="Control-Arrow-Operations.html#t:ArrowState">ArrowState</a> s a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.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)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="Control-Arrow-Operations.html#t:ArrowReader">ArrowReader</a> r a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.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)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a => <a href="Control-Arrow-Transformer-Error.html#t:ArrowAddError">ArrowAddError</a> ex (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a) a</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="Control-Arrow-Transformer-Writer.html#t:ArrowAddWriter">ArrowAddWriter</a> w a a', <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a') => <a href="Control-Arrow-Transformer-Writer.html#t:ArrowAddWriter">ArrowAddWriter</a> w (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a) (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a')</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="Control-Arrow-Transformer-Reader.html#t:ArrowAddReader">ArrowAddReader</a> r a a', <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a') => <a href="Control-Arrow-Transformer-Reader.html#t:ArrowAddReader">ArrowAddReader</a> r (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a) (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a')</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="Control-Arrow-Transformer-State.html#t:ArrowAddState">ArrowAddState</a> s a a', <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a') => <a href="Control-Arrow-Transformer-State.html#t:ArrowAddState">ArrowAddState</a> s (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a) (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a')</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a => <a href="Control-Arrow-Transformer.html#t:ArrowTransformer">ArrowTransformer</a> (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex) a</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:Arrow">Arrow</a> (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Monoid.html#t:Monoid">Monoid</a> ex, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a) => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowZero">ArrowZero</a> (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Monoid.html#t:Monoid">Monoid</a> ex, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a) => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowPlus">ArrowPlus</a> (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowApply">ArrowApply</a> a) => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowApply">ArrowApply</a> (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowLoop">ArrowLoop</a> a) => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowLoop">ArrowLoop</a> (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Category.html#t:Category">Category</a> (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a b)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Applicative">Applicative</a> (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a b)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Monoid.html#t:Monoid">Monoid</a> ex, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a) => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Alternative">Alternative</a> (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a b)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Monoid.html#t:Monoid">Monoid</a> ex, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a) => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Monoid.html#t:Monoid">Monoid</a> (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a b c)</td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:runError" class="def">runError</a><a href="src/Control-Arrow-Transformer-Error.html#runError" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex 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>Encapsulate an error-raising computation, by completely handling any errors. </p><p>Typical usage in arrow notation: </p><pre> proc p -> ... body `runError` \ex -> handler </pre></div></div><div class="top"><p class="src"><span class="keyword">class</span> (<a href="Control-Arrow-Operations.html#t:ArrowError">ArrowError</a> ex a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:Arrow">Arrow</a> a') => <a name="t:ArrowAddError" class="def">ArrowAddError</a> ex a a' | a -> a' <span class="keyword">where</span><a href="src/Control-Arrow-Internals.html#ArrowAddError" class="link">Source</a></p><div class="doc"><p>Adding a <code><a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a></code> to an arrow type, but not necessarily as the outer arrow transformer. </p><p>Typically a composite arrow type is built by applying a series of arrow transformer to a base arrow (usually either a function arrow or a <code><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:Kleisli">Kleisli</a></code> arrow. One can add a transformer to the top of this stack using the <code><a href="Control-Arrow-Transformer.html#v:lift">lift</a></code> method of the <code><a href="Control-Arrow-Transformer.html#t:ArrowTransformer">ArrowTransformer</a></code> class, or remove a state transformer from the top of the stack using the <code><a href="Control-Arrow-Transformer-Error.html#v:runError">runError</a></code> encapsulation operator. The methods of this class add and remove state transformers anywhere in the stack. In the instance </p><pre> instance Arrow a => ArrowAddError ex (ArrowError ex a) a </pre><p>they are equivalent to <code><a href="Control-Arrow-Transformer.html#v:lift">lift</a></code> and <code><a href="Control-Arrow-Transformer-Error.html#v:runError">runError</a></code> respectively. Instances are lifted through other transformers with </p><pre> instance ArrowAddError ex a a' => ArrowAddError ex (FooArrow a) (FooArrow a') </pre><p>This could be combined with <code><a href="Control-Arrow-Transformer-Error.html#v:handle">handle</a></code>, since the resulting arrow is always the arrow of the handler. Separating them has the advantage of consistency with the other arrows, and might give more helpful type error messages. </p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:liftError" class="def">liftError</a> :: a' e b -> a e b<a href="src/Control-Arrow-Internals.html#liftError" class="link">Source</a></p><div class="doc"><p>Lift a computation from an arrow to one with error handling. </p><p>Typical usage in arrow notation: </p><pre> proc p -> ... (|liftError cmd|) </pre></div><p class="src"><a name="v:elimError" class="def">elimError</a> :: a e b -> a' (e, ex) b -> a' e b<a href="src/Control-Arrow-Internals.html#elimError" class="link">Source</a></p><div class="doc"><p>Elimination of errors from a computation, by completely handling any errors. </p><p>Typical usage in arrow notation: </p><pre> proc p -> ... body `elimError` \ex -> handler </pre></div></div><div class="subs instances"><p id="control.i:ArrowAddError" class="caption collapser" onclick="toggleSection('i:ArrowAddError')">Instances</p><div id="section.i:ArrowAddError" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> a => <a href="Control-Arrow-Transformer-Error.html#t:ArrowAddError">ArrowAddError</a> ex (<a href="Control-Arrow-Transformer-Error.html#t:ErrorArrow">ErrorArrow</a> ex a) a</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Arrow-Transformer-Error.html#t:ArrowAddError">ArrowAddError</a> ex a a' => <a href="Control-Arrow-Transformer-Error.html#t:ArrowAddError">ArrowAddError</a> ex (<a href="Control-Arrow-Transformer-State.html#t:StateArrow">StateArrow</a> s a) (<a href="Control-Arrow-Transformer-State.html#t:StateArrow">StateArrow</a> s a')</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="Control-Arrow-Transformer-Error.html#t:ArrowAddError">ArrowAddError</a> ex a a', <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Applicative">Applicative</a> f) => <a href="Control-Arrow-Transformer-Error.html#t:ArrowAddError">ArrowAddError</a> ex (<a href="Control-Arrow-Transformer-Static.html#t:StaticArrow">StaticArrow</a> f a) (<a href="Control-Arrow-Transformer-Static.html#t:StaticArrow">StaticArrow</a> f a')</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="Control-Arrow-Transformer-Error.html#t:ArrowAddError">ArrowAddError</a> ex a a', <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Monoid.html#t:Monoid">Monoid</a> w) => <a href="Control-Arrow-Transformer-Error.html#t:ArrowAddError">ArrowAddError</a> ex (<a href="Control-Arrow-Transformer-Writer.html#t:WriterArrow">WriterArrow</a> w a) (<a href="Control-Arrow-Transformer-Writer.html#t:WriterArrow">WriterArrow</a> w a')</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Arrow-Transformer-Error.html#t:ArrowAddError">ArrowAddError</a> ex a a' => <a href="Control-Arrow-Transformer-Error.html#t:ArrowAddError">ArrowAddError</a> ex (<a href="Control-Arrow-Transformer-Reader.html#t:ReaderArrow">ReaderArrow</a> r a) (<a href="Control-Arrow-Transformer-Reader.html#t:ReaderArrow">ReaderArrow</a> r 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.10.0</p></div></body></html>