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

Ketil Malde ketil at malde.org
Mon Oct 19 04:18:06 EDT 2009


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?

>     let yesBlue = [1..16] \\ noBlue;
>     bracket (openFile "ssqNum.txt" WriteMode) (hClose) (\hd1 -> pickSSQ
> count yesRed yesBlue hd1);
> } 

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell-Cafe mailing list