[Haskell-cafe] Re: about Haskell code written to be "too smart"

Conal Elliott conal at conal.net
Wed Mar 25 14:27:50 EDT 2009


or via Arrow:

swap = snd &&& fst

On Wed, Mar 25, 2009 at 9:16 AM, David Menendez <dave at zednenem.com> wrote:

> On Wed, Mar 25, 2009 at 11:32 AM, Simon Marlow <marlowsd at gmail.com> 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 <dave at zednenem.com>
> <http://www.eyrie.org/~zednenem/ <http://www.eyrie.org/%7Ezednenem/>>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090325/074c61fd/attachment.htm


More information about the Haskell-Cafe mailing list