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

Dougal Stanton ithika at gmail.com
Mon Oct 19 04:22:44 EDT 2009


On Mon, Oct 19, 2009 at 9:18 AM, Ketil Malde <ketil at malde.org> wrote:
> zaxis <z_axis at 163.com> writes:
>
>> winSSQ count noRed noBlue = do
>>     let yesRed =  [1..33] \\ noRed
>>     let yesBlue = [1..16] \\ noBlue
>>     bracket (openFile "ssqNum.txt" WriteMode) (hClose) (\hd1 -> pickSSQ
>> count yesRed yesBlue hd1)
>
>> It works very well. However, as i am used to C style so i want convert it
>> into
>
>> winSSQ count noRed noBlue = do {
>>     let yesRed =  [1..33] \\ noRed;
>
>                            ^^^     ^
> Didn't you just comment out your semicolons?

Hi Ketil,

That's the first thing I thought when I read this code, then I
realised.... those aren't comment delimiters in Haskell! :-)

D



-- 
Dougal Stanton
dougal at dougalstanton.net // http://www.dougalstanton.net


More information about the Haskell-Cafe mailing list