[Haskell-cafe] How to use "bracket" properly ?
zaxis
z_axis at 163.com
Mon Oct 19 07:44:30 EDT 2009
oh! thanks! But why ?
Heinrich Apfelmus wrote:
>
> zaxis wrote:
>> 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;
>> let yesBlue = [1..16] \\ noBlue;
>> bracket (openFile "ssqNum.txt" WriteMode) (hClose) (\hd1 -> pickSSQ
>> count yesRed yesBlue hd1);
>> }
>
> You need to put brackets around the declarations in a let as well:
>
> 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);
> }
>
>
> Regards,
> apfelmus
>
> --
> http://apfelmus.nfshost.com
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
--
View this message in context: http://www.nabble.com/How-to-use-%22bracket%22-properly---tp25953522p25956932.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
More information about the Haskell-Cafe
mailing list