
20 Jan
2011
20 Jan
'11
6:44 p.m.
The code looks basically fine. Good job getting to this point. * It is probably a good idea to give Ptr Word8 a newtype; something like Wiimote, to semantically represent what it is. * Everyone loves bracketing functions! Write the function withWii :: String -> (Ptr Word8 -> IO ()) -> IO () Don't call the inner lambda if getting the Wiimote fails. * You can probably simplify 'test' a little bit by using exceptions and guards. For example, instead of 'case status' you can write 'when (not status) $ error "FAIL"'. But this is a matter of taste and what you have isn't nested too deep. Cheers, Edward