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

David Menendez dave at zednenem.com
Wed Mar 25 12:16:52 EDT 2009


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/>


More information about the Haskell-Cafe mailing list