[Haskell-cafe] different arities

Marco Túlio Gontijo e Silva mtgontijo at yahoo.com.br
Tue Nov 2 17:43:52 EST 2004


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 at minaslivre.org
jabber:marcott at jabber.org
ICQ:50599075
MSN:marcot at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Esta =?ISO-8859-1?Q?=E9?= uma parte de mensagem
	assinada digitalmente
Url : http://www.haskell.org//pipermail/haskell-cafe/attachments/20041102/03786282/attachment.bin


More information about the Haskell-Cafe mailing list