简体   繁体   中英

Haskell Syntax - How to write let in bracketed do block?

The following code got "parse error" on the let clause (in GHC 7.8.3):

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

How to correct it in order to get the equivalent to this?

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

or

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM