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

Ross Paterson ross at soi.city.ac.uk
Thu Mar 23 12:37:30 EST 2006


On Thu, Mar 23, 2006 at 09:20:10AM -0800, Reilly Hayes wrote:
> My question originates with the statement at the bottom of page 205 (the
> 5th page of the paper) regarding the behavior of the function 'first':
> " ... while 'first' routes the state through f:".  My problem is that
> this statement appears to be erroneous.  My reading of the code would
> indicate that 'first' does not do this at all.  The state portion of the
> Arrow remains unaltered.

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.



More information about the Haskell-Cafe mailing list