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

Alexander Polakov plhk at sdf.org
Wed Feb 27 13:14:40 CET 2013


* 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

WriteAction parameter is missing. GHC tells you about that right here:

> usb1.hs:60:13:
>     Couldn't match expected type `IO t0' with actual type `WriteAction'
>     In the return type of a call of `writeInterrupt'
>     Probable cause: `writeInterrupt' is applied to too few arguments
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

>     In a stmt of a 'do' block: action <- writeInterrupt handle endPoint
>     In the expression:
>       do { putStrLn $ "Inspecting device: \"" ++ (show dev) ++ "\"";
>            let payload = pack "\NUL\NUL\NUL\NUL";
>            let endPoint = EndpointAddress 0 Out;
>            action <- writeInterrupt handle endPoint;
>            .... }
> Failed, modules loaded: none.
> 

-- 
Alexander Polakov | plhk.ru



More information about the Beginners mailing list