
21 Jan
2011
21 Jan
'11
7:46 a.m.
Am 21.01.2011 00:35, schrieb Sean Charles:
wiiClose :: Ptr Word8 -> IO Bool wiiClose wptr = do response <- c_wiimote_close wptr case response of 0 -> return True _ -> return False
This can be rewritten to: wiiClose = fmap (== 0) . c_wiimote_close
case status of True -> putStrLn "OK" False -> putStrLn "FAIL"
Matching Bool values use "case" is no good style: putStrLn (if status then "OK" else "FAIL") Christian