Re: [Haskell-cafe] Equations for `foo' have different numbers of arguments

2009-03-24 Thread Manlio Perillo

Bulat Ziganshin ha scritto:

Hello Manlio,

Tuesday, March 24, 2009, 5:44:14 PM, you wrote:


divide _ 0 = error "division by 0"
divide = (/)



Equations for `divide' have different numbers of arguments


you should write

divide a b = a/b



Right.
But my question was: why can't I write the function as I did?
Why can't I write an equation in the curried form?


Thanks (and thanks for the other responses, I will reply only here)
Manlio
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Equations for `foo' have different numbers of arguments

2009-03-24 Thread Bulat Ziganshin
Hello Manlio,

Tuesday, March 24, 2009, 5:44:14 PM, you wrote:

> divide _ 0 = error "division by 0"
> divide = (/)

> Equations for `divide' have different numbers of arguments

you should write

divide a b = a/b


-- 
Best regards,
 Bulatmailto:bulat.zigans...@gmail.com

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Equations for `foo' have different numbers of arguments

2009-03-24 Thread Manlio Perillo

Hi.

There is a limitation, in Haskell, that I'm not sure to understand.
Here is an example:

module Main where

divide :: Float -> Float -> Float
divide _ 0 = error "division by 0"
divide = (/)

main = do
  print $ divide 1.0 0.0
  print $ divide 4.0 2.0



With GHC I get:
Equations for `divide' have different numbers of arguments

With HUGS:
Equations give different arities for "divide"


However the two equations really have the same number of arguments.

What's the problem?



Thanks  Manlio Perillo
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe