[Haskell-cafe] ArrowLoop examples?

Ross Paterson ross at soi.city.ac.uk
Wed Oct 27 09:05:30 EDT 2004


On Sat, Oct 23, 2004 at 08:55:16PM +0300, Einar Karttunen wrote:
> Are there any examples of using ArrowLoop outside the signal
> functions? Instances are declared for ordinary functions and 
> Kleisli arrows, but how should they be actually used?

You wouldn't normally use those instances directly.  With ordinary
functions, you can just use recursion; with monads you can use
Control.Monad.Fix.mfix (or monadic do-notation, which reduces to the same
thing).  Using loop for such arrows would be equivalent, but more awkward.

Most of the useful examples seen so far in "proper arrows" have been
in the different kinds of signal processors.  Another example might
be plumbing of attributes in a parsing arrow (though the loop in this
case doesn't satisfy right tightening), where you want to pass values
of later symbols to the parsers for earlier ones.  With a monadic parser
you'd do this using with mfix; with an arrow-based one, you'd use loop.


More information about the Haskell-Cafe mailing list