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

Jake McArthur jake.mcarthur at gmail.com
Wed Mar 25 11:39:05 EDT 2009


Simon Marlow wrote:
> Jonathan Cast wrote:
>> Define
>>
>>     swap (a, b) = (b, a)
> 
> ew, that's far too crude.  I think you mean
> 
>   swap = uncurry $ flip (,)

I think I would prefer something that mirrors flip more closely:

     swap :: ((a,b) -> c) -> (b,a) -> c
     swap = uncurry . flip . curry

- Jake


More information about the Haskell-Cafe mailing list