[Haskell-cafe] Re: about Haskell code written to be "too smart"
bugfact at gmail.com
Wed Mar 25 11:35:07 EDT 2009
On Wed, Mar 25, 2009 at 4:09 PM, Simon Marlow <marlowsd at gmail.com> wrote:
> 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.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe