If i'm creating a function, let's take the simplest example:
add x y = x + y
if i want to add a Function Type declaration before, for clarity sake
add :: (Int, Int) -> Int
add x y = x + y
I get a compile error:
"Couldn't match expected type ‘Int’ with actual type ‘(Int, Int) -> (Int, Int)’".
"The equation(s) for ‘add’ have two arguments, but its type ‘(Int, Int) -> Int’ has only one"
but it compiles flawlessly if i correct it to
add :: (Int, Int) -> Int
add (x, y) = x + y
coming from other languages, i actually think it's clearer to use the second form with parenthesis, but in my opinion, both ways should work
1 - what is the reason for not working the first way?
2 - i find the error messages completely confusing so, maybe, the error happens for another reason i don't understand