括号更改代码执行

Parentheses change code execution

我正在尝试 attempt 一个 Aff 计算。考虑以下代码:

result <-
    pool # withPool \connection -> do
        execute_ ("insert into user (email, password) values ('"
            <> unwrap userInfo.email <> "', '" <> unwrap userInfo.password <> "')")
            connection
    # attempt

attempt 的结果 Aff 后来 运行 使用 runAff

尽管使用 attemptwithPool 中的错误会传播到 runAff 的错误处理程序。

但是,如果尝试在 Aff 周围添加括号,则错误如预期的那样是 "caught":

result <-
    (pool # withPool \connection -> do
        execute_ ("insert into user (email, password) values ('"
            <> unwrap userInfo.email <> "', '" <> unwrap userInfo.password <> "')")
            connection)
    # attempt

我在这里遗漏了什么,为什么这两个代码片段的行为不同?

第一个片段相当于

result <-
  pool # withPool (\connection -> do
    execute_ ...
    # attempt)

而不是

result <-
  pool # (withPool \connection -> do
            execute_ ...)
       # attempt