尝试对两个值求和,其中只有一个是负数,例如-1
和2
:
soma :: Float -> Float -> Float
soma x1 x2 = x1 + x2
结果出现了错误;为什么呢?
<interactive>:10:6:
No instance for (Num (Float -> Float -> Float))
arising from a use of `-'
Possible fix:
add an instance declaration for (Num (Float -> Float -> Float))
In the expression: soma - 1 2
In an equation for `it': it = soma - 1 2