winSSQ count noRed noBlue = do {
    yesRed <-  [1..33] \\ noRed;
    yesBlue <- [1..16] \\ noBlue;
    bracket (openFile "ssqNum.txt" WriteMode) (hClose) (\hd1 -> pickSSQ
count yesRed yesBlue hd1);
    return ()
}
will report:
Couldn't match expected type `IO ()' against inferred type `[()]'
    In a stmt of a 'do' expression:
        bracket
          (openFile "ssqNum.txt" WriteMode)
          (hClose)
          (\ hd1 -> pickSSQ count yesRed yesBlue hd1)

However, the following works fine:

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)

Why ?
-- 
View this message in context: 
http://www.nabble.com/How-to-use-%22bracket%22-properly---tp25953522p25953522.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to