[Haskell-cafe] Question about "Arrows and Computation" by Paterson

Reilly Hayes rfh at reillyhayes.com
Fri Mar 24 14:24:00 EST 2006


On Thu, 2006-03-23 at 17:37 +0000, Ross Paterson wrote:

> Try this picture:
> 
>       (s,(b,d))
>           |
>           | unassoc
>           v
>     ((s,b),  d)
>        |     |
>      f |  x  | id
>        v     v
>     ((s',c), d)
>           |
>           | assoc
>           v
>       (s',(c,d))
> 
> The state type is not changed, but its value can be.  It is the second
> part of the input (d) that is passed through.

Thank you.  Your diagram was very helpful.  I was tracing the values
correctly through unassoc and assoc but missing the point of the
exercise.  The problem was that I entirely misunderstood the statement,
" ... while 'first' routes the state through f."  I took it to mean
that, in the State Arrow, you were using 'first' as a mechanism to
provide access to State.  Now I understand state *must* be threaded
through whichever half of the input tuple is going to be acted on.  In
retrospect, it's obvious.  

-reilly hayes


> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list