-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Arrow classes and transformers
--   
--   Several classes that extend the Arrow class, and some transformers
--   that implement or lift these classes.
@package arrows
@version 0.4.4.2


-- | Subclasses of <a>Arrow</a> providing additional operations.
--   
--   The signatures are designed to be compatible with the proposed
--   notation for arrows, cf. <a>http://www.haskell.org/arrows/</a>.
module Control.Arrow.Operations

-- | An arrow type that provides a modifiable state, based of section 9 of
--   <i>Generalising Monads to Arrows</i>, by John Hughes, <i>Science of
--   Computer Programming</i> 37:67-111, May 2000.
class Arrow a => ArrowState s a | a -> s

-- | Obtain the current value of the state.
fetch :: ArrowState s a => a e s

-- | Assign a new value to the state.
store :: ArrowState s a => a s ()

-- | An arrow type that provides a read-only state (an environment). If you
--   also need to modify the state, use <a>ArrowState</a>.
class Arrow a => ArrowReader r a | a -> r

-- | Obtain the current value of the state.
readState :: ArrowReader r a => a b r

-- | Run a subcomputation in the same arrow, but with a different
--   environment. The environment of the outer computation is unaffected.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; ...
--       (|newReader cmd|) env
--   </pre>
newReader :: ArrowReader r a => a e b -> a (e, r) b

-- | An arrow type that collects additional output (of some <a>Monoid</a>
--   type).
class (Monoid w, Arrow a) => ArrowWriter w a | a -> w

-- | Add a piece of additional output.
write :: ArrowWriter w a => a w ()

-- | Run a subcomputation in the same arrow, making its additional output
--   accessible.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; do
--       ...
--       (value, output) &lt;- (|newWriter cmd|)
--   </pre>
newWriter :: ArrowWriter w a => a e b -> a e (b, w)

-- | An arrow type that includes errors (or exceptions).
--   
--   Minimal definition: <a>raise</a> and <a>tryInUnless</a>.
--   
--   <i>TODO:</i> the operations here are inconsistent with other arrow
--   transformers.
class Arrow a => ArrowError ex a | a -> ex

-- | Raise an error.
raise :: ArrowError ex a => a ex b

-- | Traditional exception construct.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; ...
--       body `handle` \ex -&gt; handler
--   </pre>
handle :: ArrowError ex a => a e b -> a (e, ex) b -> a e b

-- | Exception construct in the style of <i>Exceptional Syntax</i>, by Nick
--   Benton and Andrew Kennedy, <i>JFP</i> 11(4):395-410, July 2001.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; ...
--       (|tryInUnless
--           body
--           (\res -&gt; success)
--           (\ex -&gt; handler)
--       |)
--   </pre>
tryInUnless :: ArrowError ex a => a e b -> a (e, b) c -> a (e, ex) c -> a e c

-- | Handler that returns the error as a value.
newError :: ArrowError ex a => a e b -> a e (Either ex b)

-- | A suitable value for <a>tryInUnless</a> when the arrow type belongs to
--   <a>ArrowChoice</a>. To use it, you must define either <a>handle</a> or
--   <a>newError</a>.
tryInUnlessDefault :: (ArrowError ex a, ArrowChoice a) => a e b -> a (e, b) c -> a (e, ex) c -> a e c

-- | An arrow type that can be used to interpret synchronous circuits.
class ArrowLoop a => ArrowCircuit a

-- | A delay component.
delay :: ArrowCircuit a => b -> a b b


-- | Arrow transformers, for making new arrow types out of old ones.
module Control.Arrow.Transformer

-- | Construct a new arrow from an existing one.
class (Arrow a, Arrow (f a)) => ArrowTransformer f a

-- | A transformation of arrows, preserving <a>arr</a>, <a>&gt;&gt;&gt;</a>
--   and <a>first</a>.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; ...
--       (|lift cmd|)
--   </pre>
lift :: ArrowTransformer f a => a b c -> f a b c


-- | Simple Mealy-style automata.
module Control.Arrow.Transformer.Automaton

-- | An arrow type comprising Mealy-style automata, each step of which is
--   is a computation in the original arrow type.
newtype Automaton a b c
Automaton :: a b (c, Automaton a b c) -> Automaton a b c

-- | Encapsulating an automaton by running it on a stream of inputs,
--   obtaining a stream of outputs.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; do
--       ...
--       ys &lt;- (|runAutomaton (\x -&gt; ...)|) xs
--   </pre>
--   
--   Here <tt>xs</tt> refers to the input stream and <tt>x</tt> to
--   individual elements of that stream. <tt>ys</tt> is bound to the output
--   stream.
runAutomaton :: (ArrowLoop a, ArrowApply a) => Automaton a (e, b) c -> a (e, Stream b) (Stream c)
instance Control.Arrow.Arrow a => Control.Arrow.Transformer.ArrowTransformer Control.Arrow.Transformer.Automaton.Automaton a
instance Control.Arrow.Arrow a => Control.Category.Category (Control.Arrow.Transformer.Automaton.Automaton a)
instance Control.Arrow.Arrow a => Control.Arrow.Arrow (Control.Arrow.Transformer.Automaton.Automaton a)
instance Control.Arrow.ArrowChoice a => Control.Arrow.ArrowChoice (Control.Arrow.Transformer.Automaton.Automaton a)
instance Control.Arrow.ArrowZero a => Control.Arrow.ArrowZero (Control.Arrow.Transformer.Automaton.Automaton a)
instance Control.Arrow.ArrowPlus a => Control.Arrow.ArrowPlus (Control.Arrow.Transformer.Automaton.Automaton a)
instance Control.Arrow.ArrowLoop a => Control.Arrow.ArrowLoop (Control.Arrow.Transformer.Automaton.Automaton a)
instance Control.Arrow.ArrowLoop a => Control.Arrow.Operations.ArrowCircuit (Control.Arrow.Transformer.Automaton.Automaton a)
instance Control.Arrow.Arrow a => GHC.Base.Functor (Control.Arrow.Transformer.Automaton.Automaton a b)
instance Control.Arrow.Arrow a => GHC.Base.Applicative (Control.Arrow.Transformer.Automaton.Automaton a b)
instance Control.Arrow.ArrowPlus a => GHC.Base.Alternative (Control.Arrow.Transformer.Automaton.Automaton a b)
instance Control.Arrow.ArrowPlus a => GHC.Base.Semigroup (Control.Arrow.Transformer.Automaton.Automaton a b c)
instance Control.Arrow.ArrowPlus a => GHC.Base.Monoid (Control.Arrow.Transformer.Automaton.Automaton a b c)
instance (Control.Arrow.ArrowLoop a, Control.Arrow.ArrowApply a) => Control.Arrow.Internals.ArrowAddStream (Control.Arrow.Transformer.Automaton.Automaton a) a
instance Control.Arrow.Operations.ArrowWriter w a => Control.Arrow.Operations.ArrowWriter w (Control.Arrow.Transformer.Automaton.Automaton a)
instance Control.Arrow.Operations.ArrowError r a => Control.Arrow.Operations.ArrowError r (Control.Arrow.Transformer.Automaton.Automaton a)
instance Control.Arrow.Operations.ArrowReader r a => Control.Arrow.Operations.ArrowReader r (Control.Arrow.Transformer.Automaton.Automaton a)
instance Control.Arrow.Operations.ArrowState s a => Control.Arrow.Operations.ArrowState s (Control.Arrow.Transformer.Automaton.Automaton a)
instance Control.Arrow.Internals.ArrowAddWriter w a a' => Control.Arrow.Internals.ArrowAddWriter w (Control.Arrow.Transformer.Automaton.Automaton a) (Control.Arrow.Transformer.Automaton.Automaton a')
instance Control.Arrow.Internals.ArrowAddReader r a a' => Control.Arrow.Internals.ArrowAddReader r (Control.Arrow.Transformer.Automaton.Automaton a) (Control.Arrow.Transformer.Automaton.Automaton a')
instance Control.Arrow.Internals.ArrowAddState r a a' => Control.Arrow.Internals.ArrowAddState r (Control.Arrow.Transformer.Automaton.Automaton a) (Control.Arrow.Transformer.Automaton.Automaton a')


-- | Transformation of state readers.
--   
--   <i>TODO:</i> define operations for this arrow.
module Control.Arrow.Transformer.CoState
newtype CoStateArrow s a b c
CoStateArrow :: a (s -> b) (s -> c) -> CoStateArrow s a b c
instance Control.Category.Category a => Control.Category.Category (Control.Arrow.Transformer.CoState.CoStateArrow s a)
instance Control.Arrow.Arrow a => Control.Arrow.Arrow (Control.Arrow.Transformer.CoState.CoStateArrow s a)
instance Control.Arrow.ArrowLoop a => Control.Arrow.ArrowLoop (Control.Arrow.Transformer.CoState.CoStateArrow s a)
instance Control.Arrow.ArrowZero a => Control.Arrow.ArrowZero (Control.Arrow.Transformer.CoState.CoStateArrow s a)
instance Control.Arrow.ArrowPlus a => Control.Arrow.ArrowPlus (Control.Arrow.Transformer.CoState.CoStateArrow s a)
instance Control.Arrow.Arrow a => GHC.Base.Functor (Control.Arrow.Transformer.CoState.CoStateArrow s a b)
instance Control.Arrow.Arrow a => GHC.Base.Applicative (Control.Arrow.Transformer.CoState.CoStateArrow s a b)
instance Control.Arrow.ArrowPlus a => GHC.Base.Alternative (Control.Arrow.Transformer.CoState.CoStateArrow s a b)
instance Control.Arrow.ArrowPlus a => GHC.Base.Semigroup (Control.Arrow.Transformer.CoState.CoStateArrow s a b c)
instance Control.Arrow.ArrowPlus a => GHC.Base.Monoid (Control.Arrow.Transformer.CoState.CoStateArrow s a b c)


-- | An arrow transformer that adds error handling.
--   
--   <i>TODO:</i> the operations here are inconsistent with other arrow
--   transformers.
module Control.Arrow.Transformer.Error

-- | An arrow that augments an existing arrow with possible errors. The
--   <a>ArrowError</a> class contains methods for raising and handling
--   these errors.
newtype ErrorArrow ex a b c
ErrorArrow :: a b (Either ex c) -> ErrorArrow ex a b c

-- | Encapsulate an error-raising computation, by completely handling any
--   errors.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; ...
--       body `runError` \ex -&gt; handler
--   </pre>
runError :: ArrowChoice a => ErrorArrow ex a e b -> a (e, ex) b -> a e b

-- | Adding a <a>ErrorArrow</a> to an arrow type, but not necessarily as
--   the outer arrow transformer.
--   
--   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 <a>Kleisli</a> arrow. One can add a transformer to the top of this
--   stack using the <a>lift</a> method of the <a>ArrowTransformer</a>
--   class, or remove a state transformer from the top of the stack using
--   the <a>runError</a> encapsulation operator. The methods of this class
--   add and remove state transformers anywhere in the stack. In the
--   instance
--   
--   <pre>
--   instance Arrow a =&gt; ArrowAddError ex (ArrowError ex a) a
--   </pre>
--   
--   they are equivalent to <a>lift</a> and <a>runError</a> respectively.
--   Instances are lifted through other transformers with
--   
--   <pre>
--   instance ArrowAddError ex a a' =&gt;
--       ArrowAddError ex (FooArrow a) (FooArrow a')
--   </pre>
--   
--   This could be combined with <a>handle</a>, 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.
class (ArrowError ex a, Arrow a') => ArrowAddError ex a a' | a -> a'

-- | Lift a computation from an arrow to one with error handling.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; ...
--       (|liftError cmd|)
--   </pre>
liftError :: ArrowAddError ex a a' => a' e b -> a e b

-- | Elimination of errors from a computation, by completely handling any
--   errors.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; ...
--       body `elimError` \ex -&gt; handler
--   </pre>
elimError :: ArrowAddError ex a a' => a e b -> a' (e, ex) b -> a' e b
instance Control.Arrow.ArrowChoice a => Control.Arrow.Transformer.ArrowTransformer (Control.Arrow.Transformer.Error.ErrorArrow ex) a
instance Control.Arrow.ArrowChoice a => Control.Category.Category (Control.Arrow.Transformer.Error.ErrorArrow ex a)
instance Control.Arrow.ArrowChoice a => Control.Arrow.Arrow (Control.Arrow.Transformer.Error.ErrorArrow ex a)
instance Control.Arrow.ArrowChoice a => Control.Arrow.ArrowChoice (Control.Arrow.Transformer.Error.ErrorArrow ex a)
instance (Control.Arrow.ArrowChoice a, Control.Arrow.ArrowApply a) => Control.Arrow.ArrowApply (Control.Arrow.Transformer.Error.ErrorArrow ex a)
instance (Control.Arrow.ArrowChoice a, Control.Arrow.ArrowLoop a) => Control.Arrow.ArrowLoop (Control.Arrow.Transformer.Error.ErrorArrow ex a)
instance Control.Arrow.ArrowChoice a => GHC.Base.Functor (Control.Arrow.Transformer.Error.ErrorArrow ex a b)
instance Control.Arrow.ArrowChoice a => GHC.Base.Applicative (Control.Arrow.Transformer.Error.ErrorArrow ex a b)
instance (GHC.Base.Monoid ex, Control.Arrow.ArrowChoice a) => GHC.Base.Alternative (Control.Arrow.Transformer.Error.ErrorArrow ex a b)
instance (GHC.Base.Monoid ex, Control.Arrow.ArrowChoice a) => GHC.Base.Semigroup (Control.Arrow.Transformer.Error.ErrorArrow ex a b c)
instance (GHC.Base.Monoid ex, Control.Arrow.ArrowChoice a) => GHC.Base.Monoid (Control.Arrow.Transformer.Error.ErrorArrow ex a b c)
instance Control.Arrow.ArrowChoice a => Control.Arrow.Operations.ArrowError ex (Control.Arrow.Transformer.Error.ErrorArrow ex a)
instance Control.Arrow.ArrowChoice a => Control.Arrow.Internals.ArrowAddError ex (Control.Arrow.Transformer.Error.ErrorArrow ex a) a
instance (GHC.Base.Monoid ex, Control.Arrow.ArrowChoice a) => Control.Arrow.ArrowZero (Control.Arrow.Transformer.Error.ErrorArrow ex a)
instance (GHC.Base.Monoid ex, Control.Arrow.ArrowChoice a) => Control.Arrow.ArrowPlus (Control.Arrow.Transformer.Error.ErrorArrow ex a)
instance (Control.Arrow.Operations.ArrowReader r a, Control.Arrow.ArrowChoice a) => Control.Arrow.Operations.ArrowReader r (Control.Arrow.Transformer.Error.ErrorArrow ex a)
instance (Control.Arrow.Operations.ArrowState s a, Control.Arrow.ArrowChoice a) => Control.Arrow.Operations.ArrowState s (Control.Arrow.Transformer.Error.ErrorArrow ex a)
instance (Control.Arrow.Operations.ArrowWriter w a, Control.Arrow.ArrowChoice a) => Control.Arrow.Operations.ArrowWriter w (Control.Arrow.Transformer.Error.ErrorArrow ex a)
instance (Control.Arrow.Internals.ArrowAddReader r a a', Control.Arrow.ArrowChoice a, Control.Arrow.ArrowChoice a') => Control.Arrow.Internals.ArrowAddReader r (Control.Arrow.Transformer.Error.ErrorArrow ex a) (Control.Arrow.Transformer.Error.ErrorArrow ex a')
instance (Control.Arrow.Internals.ArrowAddState s a a', Control.Arrow.ArrowChoice a, Control.Arrow.ArrowChoice a') => Control.Arrow.Internals.ArrowAddState s (Control.Arrow.Transformer.Error.ErrorArrow ex a) (Control.Arrow.Transformer.Error.ErrorArrow ex a')
instance (Control.Arrow.Internals.ArrowAddWriter w a a', Control.Arrow.ArrowChoice a, Control.Arrow.ArrowChoice a') => Control.Arrow.Internals.ArrowAddWriter w (Control.Arrow.Transformer.Error.ErrorArrow ex a) (Control.Arrow.Transformer.Error.ErrorArrow ex a')


-- | Arrow transformer that adds a read-only state (i.e. an environment).
module Control.Arrow.Transformer.Reader

-- | An arrow type that augments an existing arrow with a read-only state
--   (or environment). The <a>ArrowReader</a> class contains the operations
--   on this state.
newtype ReaderArrow r a b c
ReaderArrow :: a (b, r) c -> ReaderArrow r a b c

-- | Encapsulation of a state-reading computation, taking a value for the
--   state.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; ...
--       (|runReader cmd|) env
--   </pre>
runReader :: Arrow a => ReaderArrow r a e b -> a (e, r) b

-- | Adding a <a>ReaderArrow</a> to an arrow type, but not necessarily as
--   the outer arrow transformer.
--   
--   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 <a>Kleisli</a> arrow. One can add a transformer to the top of this
--   stack using the <a>lift</a> method of the <a>ArrowTransformer</a>
--   class, or remove a state transformer from the top of the stack using
--   the <a>runReader</a> encapsulation operator. The methods of this class
--   add and remove state transformers anywhere in the stack. In the
--   instance
--   
--   <pre>
--   instance Arrow a =&gt; ArrowAddReader r (ArrowReader r a) a
--   </pre>
--   
--   they are equivalent to <a>lift</a> and <a>runReader</a> respectively.
--   Instances are lifted through other transformers with
--   
--   <pre>
--   instance ArrowAddReader r a a' =&gt;
--       ArrowAddReader r (FooArrow a) (FooArrow a')
--   </pre>
class (ArrowReader r a, Arrow a') => ArrowAddReader r a a' | a -> a'

-- | Lift a computation from an arrow to one with an added environment.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; ...
--       (|liftReader cmd|)
--   </pre>
liftReader :: ArrowAddReader r a a' => a' e b -> a e b

-- | Elimination of a state reader from a computation, taking a value for
--   the state.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; ...
--       (|elimReader cmd|) env
--   </pre>
elimReader :: ArrowAddReader r a a' => a e b -> a' (e, r) b
instance Control.Arrow.Arrow a => Control.Arrow.Transformer.ArrowTransformer (Control.Arrow.Transformer.Reader.ReaderArrow r) a
instance Control.Arrow.Arrow a => Control.Category.Category (Control.Arrow.Transformer.Reader.ReaderArrow r a)
instance Control.Arrow.Arrow a => Control.Arrow.Arrow (Control.Arrow.Transformer.Reader.ReaderArrow r a)
instance Control.Arrow.ArrowChoice a => Control.Arrow.ArrowChoice (Control.Arrow.Transformer.Reader.ReaderArrow r a)
instance Control.Arrow.ArrowApply a => Control.Arrow.ArrowApply (Control.Arrow.Transformer.Reader.ReaderArrow r a)
instance Control.Arrow.ArrowZero a => Control.Arrow.ArrowZero (Control.Arrow.Transformer.Reader.ReaderArrow r a)
instance Control.Arrow.ArrowPlus a => Control.Arrow.ArrowPlus (Control.Arrow.Transformer.Reader.ReaderArrow r a)
instance Control.Arrow.ArrowLoop a => Control.Arrow.ArrowLoop (Control.Arrow.Transformer.Reader.ReaderArrow r a)
instance Control.Arrow.Arrow a => Control.Arrow.Operations.ArrowReader r (Control.Arrow.Transformer.Reader.ReaderArrow r a)
instance Control.Arrow.Arrow a => Control.Arrow.Internals.ArrowAddReader r (Control.Arrow.Transformer.Reader.ReaderArrow r a) a
instance Control.Arrow.Operations.ArrowCircuit a => Control.Arrow.Operations.ArrowCircuit (Control.Arrow.Transformer.Reader.ReaderArrow r a)
instance Control.Arrow.Operations.ArrowError ex a => Control.Arrow.Operations.ArrowError ex (Control.Arrow.Transformer.Reader.ReaderArrow r a)
instance Control.Arrow.Operations.ArrowState s a => Control.Arrow.Operations.ArrowState s (Control.Arrow.Transformer.Reader.ReaderArrow r a)
instance Control.Arrow.Operations.ArrowWriter s a => Control.Arrow.Operations.ArrowWriter s (Control.Arrow.Transformer.Reader.ReaderArrow r a)
instance Control.Arrow.Internals.ArrowAddError ex a a' => Control.Arrow.Internals.ArrowAddError ex (Control.Arrow.Transformer.Reader.ReaderArrow r a) (Control.Arrow.Transformer.Reader.ReaderArrow r a')
instance Control.Arrow.Internals.ArrowAddState s a a' => Control.Arrow.Internals.ArrowAddState s (Control.Arrow.Transformer.Reader.ReaderArrow r a) (Control.Arrow.Transformer.Reader.ReaderArrow r a')
instance Control.Arrow.Internals.ArrowAddWriter s a a' => Control.Arrow.Internals.ArrowAddWriter s (Control.Arrow.Transformer.Reader.ReaderArrow r a) (Control.Arrow.Transformer.Reader.ReaderArrow r a')
instance Control.Arrow.Arrow a => GHC.Base.Functor (Control.Arrow.Transformer.Reader.ReaderArrow r a b)
instance Control.Arrow.Arrow a => GHC.Base.Applicative (Control.Arrow.Transformer.Reader.ReaderArrow r a b)
instance Control.Arrow.ArrowPlus a => GHC.Base.Alternative (Control.Arrow.Transformer.Reader.ReaderArrow r a b)
instance Control.Arrow.ArrowPlus a => GHC.Base.Semigroup (Control.Arrow.Transformer.Reader.ReaderArrow r a b c)
instance Control.Arrow.ArrowPlus a => GHC.Base.Monoid (Control.Arrow.Transformer.Reader.ReaderArrow r a b c)


-- | An arrow transformer that adds a modifiable state, based of section 9
--   of <i>Generalising Monads to Arrows</i>, by John Hughes, <i>Science of
--   Computer Programming</i> 37:67-111, May 2000.
module Control.Arrow.Transformer.State

-- | An arrow type that augments an existing arrow with a modifiable state.
--   The <a>ArrowState</a> class contains the operations on this state.
newtype StateArrow s a b c
StateArrow :: a (b, s) (c, s) -> StateArrow s a b c

-- | Encapsulation of a state-using computation, exposing the initial and
--   final states.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; do
--       ...
--       (result, final_state) &lt;- (|runState cmd|) init_state
--   </pre>
runState :: Arrow a => StateArrow s a e b -> a (e, s) (b, s)

-- | Adding a <a>StateArrow</a> to an arrow type, but not necessarily as
--   the outer arrow transformer.
--   
--   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 <a>Kleisli</a> arrow. One can add a transformer to the top of this
--   stack using the <a>lift</a> method of the <a>ArrowTransformer</a>
--   class, or remove a state transformer from the top of the stack using
--   the <a>runState</a> encapsulation operator. The methods of this class
--   add and remove state transformers anywhere in the stack. In the
--   instance
--   
--   <pre>
--   instance Arrow a =&gt; ArrowAddState s (ArrowState s a) a
--   </pre>
--   
--   they are equivalent to <a>lift</a> and <a>runState</a> respectively.
--   Instances are lifted through other transformers with
--   
--   <pre>
--   instance ArrowAddState s a a' =&gt;
--       ArrowAddState s (FooArrow a) (FooArrow a')
--   </pre>
class (ArrowState s a, Arrow a') => ArrowAddState s a a' | a -> a'

-- | Lift a computation from an arrow to one with an added state.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; ...
--       (|liftState cmd|)
--   </pre>
liftState :: ArrowAddState s a a' => a' e b -> a e b

-- | Elimination of a state transformer from a computation, exposing the
--   initial and final states.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; do
--       ...
--       (result, final_state) &lt;- (|elimState cmd|) init_state
--   </pre>
elimState :: ArrowAddState s a a' => a e b -> a' (e, s) (b, s)
instance Control.Category.Category a => Control.Category.Category (Control.Arrow.Transformer.State.StateArrow s a)
instance Control.Arrow.Arrow a => Control.Arrow.Arrow (Control.Arrow.Transformer.State.StateArrow s a)
instance Control.Arrow.Arrow a => Control.Arrow.Transformer.ArrowTransformer (Control.Arrow.Transformer.State.StateArrow s) a
instance Control.Arrow.Arrow a => Control.Arrow.Operations.ArrowState s (Control.Arrow.Transformer.State.StateArrow s a)
instance Control.Arrow.Arrow a => Control.Arrow.Internals.ArrowAddState s (Control.Arrow.Transformer.State.StateArrow s a) a
instance Control.Arrow.ArrowZero a => Control.Arrow.ArrowZero (Control.Arrow.Transformer.State.StateArrow s a)
instance Control.Arrow.Operations.ArrowCircuit a => Control.Arrow.Operations.ArrowCircuit (Control.Arrow.Transformer.State.StateArrow s a)
instance Control.Arrow.Operations.ArrowError ex a => Control.Arrow.Operations.ArrowError ex (Control.Arrow.Transformer.State.StateArrow s a)
instance Control.Arrow.Operations.ArrowReader r a => Control.Arrow.Operations.ArrowReader r (Control.Arrow.Transformer.State.StateArrow s a)
instance Control.Arrow.Operations.ArrowWriter w a => Control.Arrow.Operations.ArrowWriter w (Control.Arrow.Transformer.State.StateArrow s a)
instance Control.Arrow.ArrowChoice a => Control.Arrow.ArrowChoice (Control.Arrow.Transformer.State.StateArrow s a)
instance Control.Arrow.ArrowApply a => Control.Arrow.ArrowApply (Control.Arrow.Transformer.State.StateArrow s a)
instance Control.Arrow.ArrowLoop a => Control.Arrow.ArrowLoop (Control.Arrow.Transformer.State.StateArrow s a)
instance Control.Arrow.ArrowPlus a => Control.Arrow.ArrowPlus (Control.Arrow.Transformer.State.StateArrow s a)
instance Control.Arrow.Arrow a => GHC.Base.Functor (Control.Arrow.Transformer.State.StateArrow s a b)
instance Control.Arrow.Arrow a => GHC.Base.Applicative (Control.Arrow.Transformer.State.StateArrow s a b)
instance Control.Arrow.ArrowPlus a => GHC.Base.Alternative (Control.Arrow.Transformer.State.StateArrow s a b)
instance Control.Arrow.ArrowPlus a => GHC.Base.Semigroup (Control.Arrow.Transformer.State.StateArrow s a b c)
instance Control.Arrow.ArrowPlus a => GHC.Base.Monoid (Control.Arrow.Transformer.State.StateArrow s a b c)
instance Control.Arrow.Internals.ArrowAddReader r a a' => Control.Arrow.Internals.ArrowAddReader r (Control.Arrow.Transformer.State.StateArrow s a) (Control.Arrow.Transformer.State.StateArrow s a')
instance Control.Arrow.Internals.ArrowAddWriter w a a' => Control.Arrow.Internals.ArrowAddWriter w (Control.Arrow.Transformer.State.StateArrow s a) (Control.Arrow.Transformer.State.StateArrow s a')
instance Control.Arrow.Internals.ArrowAddError ex a a' => Control.Arrow.Internals.ArrowAddError ex (Control.Arrow.Transformer.State.StateArrow s a) (Control.Arrow.Transformer.State.StateArrow s a')


-- | Arrow transformer adding static information.
module Control.Arrow.Transformer.Static

-- | An arrow type that augments the underlying arrow with static
--   information.
newtype StaticArrow f a b c
StaticArrow :: f (a b c) -> StaticArrow f a b c

-- | A special case is monads applied to the whole arrow, in contrast to
--   <a>Kleisli</a> arrows, in which the monad is applied to the output.
type StaticMonadArrow m = StaticArrow (WrappedMonad m)

-- | A special case.
type StaticArrowArrow a s = StaticArrow (WrappedArrow a s)
wrap :: (Applicative f, Arrow a) => f (a b c) -> StaticArrow f a b c
unwrap :: (Applicative f, Arrow a) => StaticArrow f a b c -> f (a b c)
wrapA :: (Arrow a, Arrow a') => a s (a' b c) -> StaticArrowArrow a s a' b c
unwrapA :: (Arrow a, Arrow a') => StaticArrowArrow a s a' b c -> a s (a' b c)
wrapM :: (Monad m, Arrow a) => m (a b c) -> StaticMonadArrow m a b c
unwrapM :: (Monad m, Arrow a) => StaticMonadArrow m a b c -> m (a b c)
instance (Control.Arrow.Arrow a, GHC.Base.Applicative f) => Control.Arrow.Transformer.ArrowTransformer (Control.Arrow.Transformer.Static.StaticArrow f) a
instance (Control.Category.Category a, GHC.Base.Applicative f) => Control.Category.Category (Control.Arrow.Transformer.Static.StaticArrow f a)
instance (Control.Arrow.Arrow a, GHC.Base.Applicative f) => Control.Arrow.Arrow (Control.Arrow.Transformer.Static.StaticArrow f a)
instance (Control.Arrow.ArrowZero a, GHC.Base.Applicative f) => Control.Arrow.ArrowZero (Control.Arrow.Transformer.Static.StaticArrow f a)
instance (Control.Arrow.Operations.ArrowCircuit a, GHC.Base.Applicative f) => Control.Arrow.Operations.ArrowCircuit (Control.Arrow.Transformer.Static.StaticArrow f a)
instance (Control.Arrow.Operations.ArrowError ex a, GHC.Base.Applicative f) => Control.Arrow.Operations.ArrowError ex (Control.Arrow.Transformer.Static.StaticArrow f a)
instance (Control.Arrow.Operations.ArrowReader r a, GHC.Base.Applicative f) => Control.Arrow.Operations.ArrowReader r (Control.Arrow.Transformer.Static.StaticArrow f a)
instance (Control.Arrow.Operations.ArrowState s a, GHC.Base.Applicative f) => Control.Arrow.Operations.ArrowState s (Control.Arrow.Transformer.Static.StaticArrow f a)
instance (Control.Arrow.Operations.ArrowWriter w a, GHC.Base.Applicative f) => Control.Arrow.Operations.ArrowWriter w (Control.Arrow.Transformer.Static.StaticArrow f a)
instance (Control.Arrow.ArrowChoice a, GHC.Base.Applicative f) => Control.Arrow.ArrowChoice (Control.Arrow.Transformer.Static.StaticArrow f a)
instance (Control.Arrow.ArrowLoop a, GHC.Base.Applicative f) => Control.Arrow.ArrowLoop (Control.Arrow.Transformer.Static.StaticArrow f a)
instance (Control.Arrow.ArrowPlus a, GHC.Base.Applicative f) => Control.Arrow.ArrowPlus (Control.Arrow.Transformer.Static.StaticArrow f a)
instance (Control.Arrow.Arrow a, GHC.Base.Applicative f) => GHC.Base.Functor (Control.Arrow.Transformer.Static.StaticArrow f a b)
instance (Control.Arrow.Arrow a, GHC.Base.Applicative f) => GHC.Base.Applicative (Control.Arrow.Transformer.Static.StaticArrow f a b)
instance (Control.Arrow.ArrowPlus a, GHC.Base.Applicative f) => GHC.Base.Alternative (Control.Arrow.Transformer.Static.StaticArrow f a b)
instance (Control.Arrow.ArrowPlus a, GHC.Base.Applicative f) => GHC.Base.Semigroup (Control.Arrow.Transformer.Static.StaticArrow f a b c)
instance (Control.Arrow.ArrowPlus a, GHC.Base.Applicative f) => GHC.Base.Monoid (Control.Arrow.Transformer.Static.StaticArrow f a b c)
instance (Control.Arrow.Internals.ArrowAddStream a a', GHC.Base.Applicative f) => Control.Arrow.Internals.ArrowAddStream (Control.Arrow.Transformer.Static.StaticArrow f a) (Control.Arrow.Transformer.Static.StaticArrow f a')
instance (Control.Arrow.Internals.ArrowAddState s a a', GHC.Base.Applicative f) => Control.Arrow.Internals.ArrowAddState s (Control.Arrow.Transformer.Static.StaticArrow f a) (Control.Arrow.Transformer.Static.StaticArrow f a')
instance (Control.Arrow.Internals.ArrowAddReader r a a', GHC.Base.Applicative f) => Control.Arrow.Internals.ArrowAddReader r (Control.Arrow.Transformer.Static.StaticArrow f a) (Control.Arrow.Transformer.Static.StaticArrow f a')
instance (Control.Arrow.Internals.ArrowAddWriter w a a', GHC.Base.Applicative f) => Control.Arrow.Internals.ArrowAddWriter w (Control.Arrow.Transformer.Static.StaticArrow f a) (Control.Arrow.Transformer.Static.StaticArrow f a')
instance (Control.Arrow.Internals.ArrowAddError ex a a', GHC.Base.Applicative f) => Control.Arrow.Internals.ArrowAddError ex (Control.Arrow.Transformer.Static.StaticArrow f a) (Control.Arrow.Transformer.Static.StaticArrow f a')


-- | Arrow transformer lifting an arrow to streams.
module Control.Arrow.Transformer.Stream

-- | Arrows between streams.
--   
--   <i>Note</i>: <a>lift</a> is only a functor if <a>***</a> in the
--   underlying arrow is.
newtype StreamArrow a b c
StreamArrow :: a (Stream b) (Stream c) -> StreamArrow a b c

-- | Run a stream processor on a stream of inputs, obtaining a stream of
--   outputs.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; do
--       ...
--       ys &lt;- (|runStream (\x -&gt; ...)|) xs
--   </pre>
--   
--   Here <tt>xs</tt> refers to the input stream and <tt>x</tt> to
--   individual elements of that stream. <tt>ys</tt> is bound to the output
--   stream.
runStream :: ArrowLoop a => StreamArrow a (e, b) c -> a (e, Stream b) (Stream c)

-- | Mappings of streams
type StreamMap = StreamArrow (->)

-- | In-place state updates.
--   
--   <i>Note</i>: this is an arrow type, and <a>lift</a> can be used to
--   promote arrows from <tt><a>Kleisli</a> (<a>ST</a> s)</tt>: the
--   resulting arrow updates the state for each stream element in turn, and
--   as long as the final state in not required all is well. However,
--   <a>lift</a> does not preserve composition, because this monad isn't
--   commutative. In particular, a composition of <a>lift</a>s of state
--   transformers will not work, as the second will require the final state
--   of the first.
type StreamMapST s = StreamArrow (Kleisli (ST s))

-- | Encapsulate a local state.
runStreamST :: (forall s. StreamMapST s e c) -> StreamMap e c

-- | Adding a <a>StreamArrow</a> to an arrow type, but not necessarily as
--   the outer arrow transformer.
--   
--   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 <a>Kleisli</a> arrow. One can add a transformer to the top of this
--   stack using the <a>lift</a> method of the <a>ArrowTransformer</a>
--   class, or remove a state transformer from the top of the stack using
--   the <a>runStream</a> encapsulation operator. The methods of this class
--   add and remove state transformers anywhere in the stack. In the
--   instance
--   
--   <pre>
--   instance Arrow a =&gt; ArrowAddStream (ArrowStream a) a
--   </pre>
--   
--   they are equivalent to <a>lift</a> and <a>runStream</a> respectively.
--   Instances are lifted through other transformers with
--   
--   <pre>
--   instance ArrowAddStream a a' =&gt;
--       ArrowAddStream (FooArrow a) (FooArrow a')
--   </pre>
class (ArrowCircuit a, Arrow a') => ArrowAddStream a a' | a -> a'

-- | Lift a computation from an arrow to a stream processing one.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; ...
--       (|liftStream cmd|)
--   </pre>
liftStream :: ArrowAddStream a a' => a' e b -> a e b

-- | Run a stream processor on a stream of inputs, obtaining a stream of
--   outputs.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; do
--       ...
--       ys &lt;- (|elimStream (\x -&gt; ...)|) xs
--   </pre>
--   
--   Here <tt>xs</tt> refers to the input stream and <tt>x</tt> to
--   individual elements of that stream. <tt>ys</tt> is bound to the output
--   stream.
elimStream :: ArrowAddStream a a' => a (e, b) c -> a' (e, Stream b) (Stream c)
instance Control.Category.Category a => Control.Category.Category (Control.Arrow.Transformer.Stream.StreamArrow a)
instance Control.Arrow.Arrow a => Control.Arrow.Arrow (Control.Arrow.Transformer.Stream.StreamArrow a)
instance Control.Arrow.Arrow a => Control.Arrow.Transformer.ArrowTransformer Control.Arrow.Transformer.Stream.StreamArrow a
instance Control.Arrow.ArrowZero a => Control.Arrow.ArrowZero (Control.Arrow.Transformer.Stream.StreamArrow a)
instance Control.Arrow.Operations.ArrowState s a => Control.Arrow.Operations.ArrowState s (Control.Arrow.Transformer.Stream.StreamArrow a)
instance Control.Arrow.Operations.ArrowWriter w a => Control.Arrow.Operations.ArrowWriter w (Control.Arrow.Transformer.Stream.StreamArrow a)
instance Control.Arrow.Arrow a => Control.Arrow.ArrowChoice (Control.Arrow.Transformer.Stream.StreamArrow a)
instance Control.Arrow.ArrowLoop a => Control.Arrow.ArrowLoop (Control.Arrow.Transformer.Stream.StreamArrow a)
instance Control.Arrow.ArrowPlus a => Control.Arrow.ArrowPlus (Control.Arrow.Transformer.Stream.StreamArrow a)
instance Control.Arrow.ArrowLoop a => Control.Arrow.Operations.ArrowCircuit (Control.Arrow.Transformer.Stream.StreamArrow a)
instance Control.Arrow.Arrow a => GHC.Base.Functor (Control.Arrow.Transformer.Stream.StreamArrow a b)
instance Control.Arrow.Arrow a => GHC.Base.Applicative (Control.Arrow.Transformer.Stream.StreamArrow a b)
instance Control.Arrow.ArrowPlus a => GHC.Base.Alternative (Control.Arrow.Transformer.Stream.StreamArrow a b)
instance Control.Arrow.ArrowPlus a => GHC.Base.Semigroup (Control.Arrow.Transformer.Stream.StreamArrow a b c)
instance Control.Arrow.ArrowPlus a => GHC.Base.Monoid (Control.Arrow.Transformer.Stream.StreamArrow a b c)
instance Control.Arrow.ArrowLoop a => Control.Arrow.Internals.ArrowAddStream (Control.Arrow.Transformer.Stream.StreamArrow a) a


-- | Arrow transformer that adds accumulation of output.
module Control.Arrow.Transformer.Writer

-- | An arrow type that augments an existing arrow with accumulating
--   output. The <a>ArrowWriter</a> class contains the relevant operations.
newtype WriterArrow w a b c
WriterArrow :: a b (c, w) -> WriterArrow w a b c

-- | Encapsulation of a writer computation, providing the accumulated
--   output.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; do
--       ...
--       (result, output) &lt;- (|runWriter cmd|)
--   </pre>
runWriter :: (Arrow a, Monoid w) => WriterArrow w a e b -> a e (b, w)

-- | Adding a <a>WriterArrow</a> to an arrow type, but not necessarily as
--   the outer arrow transformer.
--   
--   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 <a>Kleisli</a> arrow. One can add a transformer to the top of this
--   stack using the <a>lift</a> method of the <a>ArrowTransformer</a>
--   class, or remove a state transformer from the top of the stack using
--   the <a>runWriter</a> encapsulation operator. The methods of this class
--   add and remove state transformers anywhere in the stack. In the
--   instance
--   
--   <pre>
--   instance Arrow a =&gt; ArrowAddWriter w (ArrowWriter w a) a
--   </pre>
--   
--   they are equivalent to <a>lift</a> and <a>runWriter</a> respectively.
--   Instances are lifted through other transformers with
--   
--   <pre>
--   instance ArrowAddWriter w a a' =&gt;
--       ArrowAddWriter w (FooArrow a) (FooArrow a')
--   </pre>
class (ArrowWriter w a, Arrow a') => ArrowAddWriter w a a' | a -> a'

-- | Lift a computation from an arrow to one with added output.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; ...
--       (|liftWriter cmd|)
--   </pre>
liftWriter :: ArrowAddWriter w a a' => a' e b -> a e b

-- | Elimination of an output writer from a computation, providing the
--   accumulated output.
--   
--   Typical usage in arrow notation:
--   
--   <pre>
--   proc p -&gt; do
--       ...
--       (result, output) &lt;- (|elimWriter cmd|)
--   </pre>
elimWriter :: ArrowAddWriter w a a' => a e b -> a' e (b, w)
instance (Control.Arrow.Arrow a, GHC.Base.Monoid w) => Control.Arrow.Transformer.ArrowTransformer (Control.Arrow.Transformer.Writer.WriterArrow w) a
instance (Control.Arrow.Arrow a, GHC.Base.Monoid w) => Control.Category.Category (Control.Arrow.Transformer.Writer.WriterArrow w a)
instance (Control.Arrow.Arrow a, GHC.Base.Monoid w) => Control.Arrow.Arrow (Control.Arrow.Transformer.Writer.WriterArrow w a)
instance (Control.Arrow.ArrowChoice a, GHC.Base.Monoid w) => Control.Arrow.ArrowChoice (Control.Arrow.Transformer.Writer.WriterArrow w a)
instance (Control.Arrow.ArrowApply a, GHC.Base.Monoid w) => Control.Arrow.ArrowApply (Control.Arrow.Transformer.Writer.WriterArrow w a)
instance (Control.Arrow.ArrowZero a, GHC.Base.Monoid w) => Control.Arrow.ArrowZero (Control.Arrow.Transformer.Writer.WriterArrow w a)
instance (Control.Arrow.ArrowPlus a, GHC.Base.Monoid w) => Control.Arrow.ArrowPlus (Control.Arrow.Transformer.Writer.WriterArrow w a)
instance (Control.Arrow.ArrowLoop a, GHC.Base.Monoid w) => Control.Arrow.ArrowLoop (Control.Arrow.Transformer.Writer.WriterArrow w a)
instance (Control.Arrow.Arrow a, GHC.Base.Monoid w) => GHC.Base.Functor (Control.Arrow.Transformer.Writer.WriterArrow w a b)
instance (Control.Arrow.Arrow a, GHC.Base.Monoid w) => GHC.Base.Applicative (Control.Arrow.Transformer.Writer.WriterArrow w a b)
instance (Control.Arrow.ArrowPlus a, GHC.Base.Monoid w) => GHC.Base.Alternative (Control.Arrow.Transformer.Writer.WriterArrow w a b)
instance (Control.Arrow.ArrowPlus a, GHC.Base.Monoid w) => GHC.Base.Semigroup (Control.Arrow.Transformer.Writer.WriterArrow w a b c)
instance (Control.Arrow.ArrowPlus a, GHC.Base.Monoid w) => GHC.Base.Monoid (Control.Arrow.Transformer.Writer.WriterArrow w a b c)
instance (Control.Arrow.Arrow a, GHC.Base.Monoid w) => Control.Arrow.Operations.ArrowWriter w (Control.Arrow.Transformer.Writer.WriterArrow w a)
instance (Control.Arrow.Arrow a, GHC.Base.Monoid w) => Control.Arrow.Internals.ArrowAddWriter w (Control.Arrow.Transformer.Writer.WriterArrow w a) a
instance (Control.Arrow.Operations.ArrowCircuit a, GHC.Base.Monoid w) => Control.Arrow.Operations.ArrowCircuit (Control.Arrow.Transformer.Writer.WriterArrow w a)
instance (Control.Arrow.Operations.ArrowError ex a, GHC.Base.Monoid w) => Control.Arrow.Operations.ArrowError ex (Control.Arrow.Transformer.Writer.WriterArrow w a)
instance (Control.Arrow.Operations.ArrowReader r a, GHC.Base.Monoid w) => Control.Arrow.Operations.ArrowReader r (Control.Arrow.Transformer.Writer.WriterArrow w a)
instance (Control.Arrow.Operations.ArrowState s a, GHC.Base.Monoid w) => Control.Arrow.Operations.ArrowState s (Control.Arrow.Transformer.Writer.WriterArrow w a)
instance (Control.Arrow.Internals.ArrowAddError ex a a', GHC.Base.Monoid w) => Control.Arrow.Internals.ArrowAddError ex (Control.Arrow.Transformer.Writer.WriterArrow w a) (Control.Arrow.Transformer.Writer.WriterArrow w a')
instance (Control.Arrow.Internals.ArrowAddReader r a a', GHC.Base.Monoid w) => Control.Arrow.Internals.ArrowAddReader r (Control.Arrow.Transformer.Writer.WriterArrow w a) (Control.Arrow.Transformer.Writer.WriterArrow w a')
instance (Control.Arrow.Internals.ArrowAddState s a a', GHC.Base.Monoid w) => Control.Arrow.Internals.ArrowAddState s (Control.Arrow.Transformer.Writer.WriterArrow w a) (Control.Arrow.Transformer.Writer.WriterArrow w a')

module Control.Arrow.Transformer.All
