[Haskell-cafe] Re: Functions that return functions

Achim Schneider barsoap at web.de
Mon Apr 13 10:05:20 EDT 2009


michael rice <nowgate at yahoo.com> wrote:

> In any case, the function we pass to makeVerifier, whether anonymous
> or in the WHERE of your clarified version, is a function that only
> appears in the definition of a particular verifier, so what
> difference can it possibly make whether or not it can be partially
> applied? That's what I can't get my head around.
>
In your case, none, except wasted keystrokes... after all, if you want
to, you can also partially apply tuples. 

Semantically speaking, adding a tuple introduces another _|_... you can
pass both undefined as well as (undefined,undefined) to an uncurried
function, but I doubt that's going to bother you.

Tuples are commonly used as return type though. The usual style is to
write functions curried and use uncurry if you need to pass it tuples
for some reason, like in

zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
zipWith f = (map (uncurry f) .) . zip

-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.




More information about the Haskell-Cafe mailing list