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

2011-04-25 Thread Angel de Vicente
Hi, I'm reading The Craft of Functional Programming and I found something I don't understand in page 185. It says: Suppose first that we want to write a curried version of a function g, which is itself uncurried and of type (a,b) - c. curry g This funtion expects its arguments as a pair,

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

2011-04-25 Thread Ozgur Akgun
On 25 April 2011 14:11, Angel de Vicente ang...@iac.es wrote: curry :: ((a,b) - c) - (a - b - c) is the same as: curry :: ((a,b) - c) - a - b - c HTH, Ozgur ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

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

2011-04-25 Thread Stephen Tetley
On 25 April 2011 14:11, Angel de Vicente ang...@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

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

2011-04-25 Thread Benedict Eastaugh
On 25 April 2011 14:11, Angel de Vicente ang...@iac.es wrote: OK, I have tried it and it works, but I don't understand the syntax for curry. Until now I have encountered only functions that take the same number of arguments as the function definition or less (partial application), but this

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

2011-04-25 Thread Angel de Vicente
Hi, On 25/04/11 14:20, Ozgur Akgun wrote: On 25 April 2011 14:11, Angel de Vicente ang...@iac.es mailto:ang...@iac.es wrote: curry :: ((a,b) - c) - (a - b - c) is the same as: curry :: ((a,b) - c) - a - b - c thanks, it makes sense now. Somehow I thought that adding the parenthesis

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

2011-04-25 Thread Angel de Vicente
Hi, On 25/04/11 14:21, Stephen Tetley wrote: On 25 April 2011 14:11, Angel de Vicenteang...@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,