关于优先级的中缀函数的奇怪行为

Weird behavior for infix functions regarding precedence

我正在使用 bool :: a -> a -> Bool -> a 函数。 我想使用中缀版本,因为我认为它更具可读性,但我注意到:

(-1) `bool` 1 True

是一个错误

(-1) `bool` 1 $ True

有效。甚至

(-1) `bool` 1 (True)

不起作用,直到现在我认为这是一个平等的选择(即使用 $ 与从这个位置到最后用括号括起来)

这怎么能有所作为呢?在第一个版本中只有一个操作。

中缀运算符绑定松散,应用程序绑定紧密。

(-1) `bool` 1 True
-- means
(-1) `bool` (1 True)


(-1) `bool` 1 $ True
-- means
((-1) `bool` 1) $ True


(-1) `bool` 1 (True)
-- means
(-1) `bool` (1 (True))

您可能想要:

((-1) `bool` 1) True