or via Arrow:

swap = snd &&& fst

On Wed, Mar 25, 2009 at 9:16 AM, David Menendez <[email protected]> wrote:

> On Wed, Mar 25, 2009 at 11:32 AM, Simon Marlow <[email protected]> wrote:
> > Jonathan Cast wrote:
> >>
> >> Define
> >>
> >>    swap (a, b) = (b, a)
> >
> > ew, that's far too crude.  I think you mean
> >
> >  swap = uncurry $ flip (,)
>
> On the theme of using monads where you might not expect,
>
> swap = liftA2 (,) snd fst
>
> --
> Dave Menendez <[email protected]>
> <http://www.eyrie.org/~zednenem/ <http://www.eyrie.org/%7Ezednenem/>>
> _______________________________________________
> Haskell-Cafe mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to