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

Alexander Polakov plhk at sdf.org
Wed Feb 27 13:43:36 CET 2013


* Alexander Polakov <plhk at sdf.org> [130227 16:29]:
> * emacstheviking <objitsu at gmail.com> [130227 16:00]:
> 
> >   let payload  = pack "\x00\x00\x00\x00"
> >   let endPoint = EndpointAddress 0 Out
> >   action <- writeInterrupt    handle          endPoint           
>               ^^^^^^^^^^^^^^    ^^^^^^          ^^^^^^^^           ^^^^^^^
>               writeInterrupt :: DeviceHandle -> EndpointAddress -> WriteAction

Uhhmm, sorry, I'm being stupid and confusing here (sleep deprived a bit).
I was looking at WriteAction definition while writing this, which is:

 type WriteAction = ByteString -> Timeout -> IO (Size, Status)

So, you have to supply ByteString and Timeout to use it as IO action
(with <-):

> (size, status) <- writeInterrupt handle endPoint payload 1000

or use let like Karol Samborski suggested.

-- 
Alexander Polakov | plhk.ru



More information about the Beginners mailing list