
20 Jan
2011
20 Jan
'11
7:08 p.m.
On Friday 21 January 2011 00:35:02, Sean Charles wrote:
wiiOpen :: String -> IO (Maybe (Ptr Word8)) wiiOpen wid = do handle <- withCString wid c_wiimote_open case handle of nullPtr -> return Nothing handle -> return (Just handle)
Unless nullPtr is a macro that gets replaced with a literal by the preprocessor, that won't do what you want. "nullPtr" is a generic name and matches everything, so you'll always take the first branch (with -Wall, ghc should warn about overlapping patterns in that case).