[Haskell-cafe] ArrowLoop and streamprocessors

Matthew Steele mdsteele at alum.mit.edu
Thu Mar 31 17:01:51 CEST 2011


On Mar 30, 2011, at 5:29 PM, Mathijs Kwik wrote:

> So loop really doesn't seem to help here, but I couldn't find another
> way either to feed outputs back into the system.
> What I need is:
> Either A B ~> Either C B -> A ~> C
>
> Does such a thing exist?

Based on your description, it sounds to me like you want a loop such  
that if a B is generated at the end, you send it back to the start and  
execute your arrow a second time.  Is that in fact what you intended?   
However, the docs for ArrowLoop's loop function make it clear that it  
executes the arrow only once:

   http://www.haskell.org/ghc/docs/latest/html/libraries/base-4.3.1.0/Control-Arrow.html#v 
:loop

If your arrows are instances of ArrowApply, I believe you could use  
app to implement the combinator you want.

Cheers,
-Matt




More information about the Haskell-Cafe mailing list