我尝试使用组合与 lambda 表达式的虚拟示例。下面的代码可以编译,但当我尝试时它不会运行(f.g) 3 2
f x = x^2
g x = 5*x
f.g = \x -> f(g x)
Run Code Online (Sandbox Code Playgroud)
它给出了这样的错误:
Ambiguous occurrence `.'
It could refer to
either `Prelude..',
imported from `Prelude' at list3.hs:1:1
(and originally defined in `GHC.Base')
or `Main..', defined at list3.hs:42:3.
Run Code Online (Sandbox Code Playgroud)
有人可以告诉我问题出在哪里吗?