[Haskell-cafe] Trouble with currying and uncurrying...

Stephen Tetley stephen.tetley at gmail.com
Mon Apr 25 15:21:46 CEST 2011


On 25 April 2011 14:11, Angel de Vicente <angelv at iac.es> wrote:

> curry :: ((a,b) -> c) -> (a -> b -> c)
> curry g x y = g (x,y)

Is expressing curry this way more illuminating?

curry :: ((a,b) -> c) -> (a -> b -> c)
curry g = \x y -> g (x,y)

That is, curry is a function taking one argument that produces a
result function taking two arguments.

In Haskell - the type signature:

> curry :: ((a,b) -> c) -> (a -> b -> c)

... can mean either form.

Though this is a "quirk" of Haskell, in the language Clean, for
example, the parens in the type signature "mean what they" say so only
only my second definition is allowed, the first version won't compile.

Best wishes

Stephen



More information about the Haskell-Cafe mailing list