Prelude> -- I have 2 functions: f and g
Prelude> f x y = x + y
Prelude> g x = 2*x
Prelude> f 2 3
5
用 x=2 和 y=3表示$ f(x, g(y))*
这很好用:
Prelude> f 2 (g 3)
8
为什么以下返回错误?
Prelude>
Prelude> f 2 g 3
<interactive>:19:1: error:
• Non type-variable argument in the constraint: Num (a -> a)
(Use FlexibleContexts to permit this)
• When checking the inferred type
it :: forall a. (Num a, Num (a -> a)) => a
Prelude>