[Haskell-beginners] System.USB.writeInterrupt -- confused by error message from type system

Karol Samborski edv.karol at gmail.com
Wed Feb 27 13:07:29 CET 2013


Hi Sean,

I think that your function for testing board should look like this:

testBoard :: Device -> DeviceHandle -> IO ()
testBoard dev handle = do
  putStrLn $ "Inspecting device: \"" ++ (show dev) ++ "\"\n"
  -- write 0x00 0x00 0x00 0x00, get back same...
  let payload  = pack "\x00\x00\x00\x00"
  let endPoint = EndpointAddress 0 Out
  let action = writeInterrupt handle endPoint
  (size, status) <- action payload 1000
  return ()

You need to use let because writeInterrupt returns (Timeout ->
ByteString -> IO (Size, Bool)) instead of IO (Timeout -> ByteString ->
IO (Size, Bool))

Karol



More information about the Beginners mailing list