[Haskell-cafe] How to use "bracket" properly ?

Roel van Dijk vandijk.roel at gmail.com
Mon Oct 19 08:10:30 EDT 2009


On Mon, Oct 19, 2009 at 1:44 PM, zaxis <z_axis at 163.com> wrote:
> oh! thanks!  But why ?

A let can introduce multiple declarations.

So this

foo = do
  let x = 3
  let y = 4
  return $ x+ y

can also be written like

foo = do
  let x = 3
      y = 4 -- no let
  return $ x + y

With explicit blocks:

foo = do {
  let {x = 3; y = 4;};
  return $ x + y;
}


More information about the Haskell-Cafe mailing list