该代码在Haskell中有效:
x a = (a + 1, a + 2)
x 2 -- returns (3, 4)
Run Code Online (Sandbox Code Playgroud)
而这不是:
x = ((+1), (+2))
<interactive>:935:1: error:
* Couldn't match expected type `Integer -> t'
with actual type `(Integer -> Integer, Integer -> Integer)'
* The function `x' is applied to one argument,
but its type `(Integer -> Integer, Integer -> Integer)' has none
In the expression: x 2
In an equation for `it': it = x 2
* Relevant bindings include it :: …Run Code Online (Sandbox Code Playgroud)