
These two functions have the same type. Is this behaviour intended? (Can functions of the same type have different arities?) ------------------------------------------- data Fun = Increment | Square fun:: Fun -> Int -> Int fun Increment n = n+1 fun Square = (\n -> n*n) ------------------------------------------- Error message in HUGS: ERROR "arity.hs":17 - Equations give different arities for "fun GHC: arity.hs:3: Varying number of arguments for function `fun' /Regards Henning

Em Ter, 2004-11-02 às 18:09, Henning Sato Rosen escreveu:
data Fun = Increment | Square fun:: Fun -> Int -> Int fun Increment n = n+1 fun Square = (\n -> n*n)
I think that this is because you gave two definitions of the same function with different number of variables. fun Increment n = n+1 fun Square n = n*n will do it. You don't have to go that far to see this error, you can do something like: add :: Int -> Int -> Int add 5 = (+10) add x y = x + y Will give you the same error message. -- []'s marcot mailto:marcot@minaslivre.org jabber:marcott@jabber.org ICQ:50599075 MSN:marcot@dcc.ufmg.br Tel:33346720 Cel:91844179 http://www.dcc.ufmg.br/~marcot/ "A crocrância é fundamental para quem quer ser fundamental." Bizarro da Silva e marcot
participants (2)
-
Henning Sato Rosen
-
Marco Túlio Gontijo e Silva