Haskell语法 - 如何写入让括号中的块?

时间:2014-10-21 11:37:47

标签: haskell syntax

以下代码得到"解析错误"在let子句中(在GHC 7.8.3中):

someFunction = do {
    let foo = bar;
    return foo;
}

如何纠正它以获得与此相当的效果?

someFunction = do
    let foo = bar
    return foo

1 个答案:

答案 0 :(得分:6)

someFunction = do {
    let foo = bar
  ; return foo
}

someFunction = do {
    let { foo = bar };
    return foo
}