Peter Simons <[EMAIL PROTECTED]> writes:

> > setFoo        :: State -> [Int] -> State
> > setFoo st x    = State { foo = x
> >                        , bar = bar st
> >                        }

There is an easier way to do this, using the record update syntax
rather than record construction syntax.  e.g.

    setFoo st x    = st { foo = x }

All the unmentioned fields retain their previous values from the
'st' structure.

Regards,
    Malcolm
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to