I've gotten into a habit of preceding most dos in my code with a
$, and indenting the next line. I kind of like this, since it makes
the indentation more uniform. But it seems to have bitten me now. I'd
like to write something like this
s = sum $ do
x - [1,2,3]
let b = sum $ do
y - [0..x +
On 17/05/07, Chad Scherrer [EMAIL PROTECTED] wrote:
But GHC complains of Empty 'do' construct.
Because it takes the indented following lines as being new bindings in
the let-block. The trick is to intent them past the 'sum':
let b = sum $ do
y - [0..x + 1]
return y
Or to
Thanks, I had forgotten about multiple let bindings as something it
might be looking for. I guess in this case the curly braces aren't too
bad, given that this situation doesn't come up so much, and it would
let me keep the indentation consistent.
And yes, this is just a boiled-down version of