
On Wed, Mar 25, 2009 at 4:09 PM, Simon Marlow
But it only works out nicely because the ordering of the components of the pair returned by splitAt matches the ordering that the state monad expects (and I can never remember which way around they are in Control.Monad.State).
Now you mention this, I often had to write a little function swap :: (a,b) -> (b,a) It seems many other authors have done the same in their own modules. Maybe this should be part of the Prelude?
Try doing it with mapAccumL, which is arguably the right abstraction, but has the components the other way around.
Cheers, Simon
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe