在GHCi中:
- 序曲>(+3)2
5- 序曲>(*3)2
6- 前奏>(/ 3)2
0.6666666666666666- 前奏>( - 3)2
没有实例(Num(t - > t1))
来自文字':it =( - 3)23' at <interactive>:1:2
Possible fix: add an instance declaration for (Num (t -> t1))
In the expression: 3
In the expression: (- 3) 2
In the definition of
如何更正最后一个使其返回-1?
let fun1 = (+3)
let fun2 = (-3)
let range = [1,2,3,3]
let a = map fun1 range
let b = map fun2 a
Run Code Online (Sandbox Code Playgroud)
这给了我一个错误:
约束中的非类型变量参数:Num(a - > b)
Haskell的静态性质让我很头疼......