[Haskell-beginners] Scoping within arrow notation (using HXT)?
Ertugrul Söylemez
es at ertes.de
Fri Jun 8 18:20:13 CEST 2012
Hello there,
the structure of an arrow computation cannot depend on inputs. All
arrow variables (to the left of '<-' or '->') are inputs to following
computations. For instance:
proc x1 -> do
x2 <- c1 -< x1
x3 <- c2 -< x2
returnA -< f x2 x3
The variables x1, x2 and x3 are arrow variables and are out of scope
to the left of '-<', because if they were in scope, the structure of the
computation could depend on arrow variables, and you would in fact have
a monad instead of an arrow.
Note also that 'proc x -> c -< x' is the same as 'c', and 'do' notation
is an extension to 'proc' notation.
You may be interested in my (unfinished) arrow tutorial:
<http://ertes.de/new/tutorials/arrows.html>
Greets,
Ertugrul
Michael Alan Dorman <mdorman at ironicdesign.com> wrote:
> I'm trying to use state threaded through an arrow in some HXT code to
> avoid passing explicit parameters through several layers of functions,
> but I think I'm not understanding quite what the arrow notation is
> doing, because when I try to use a value I'm extracting from the
> state, I'm getting a scope error.
--
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120608/f596dfd6/attachment.pgp>
More information about the Beginners
mailing list