[Haskell-cafe] Help on using System.Win32.Com.Automation

Alexandr N. Zamaraev tonal.promsoft at gmail.com
Mon Mar 23 04:21:02 EDT 2009


Sigbjorn Finne wrote:
> Hi Wilkes,
> 
> you may want to have a look at a simple example of how to
> interop with Windows WMI using the COM package at --
> 
>  http://haskell.forkio.com/com-examples
I try compile WMIDemo.hs but recive error:
[code]
c:\htest>ghc --make WMIDemo.hs
[2 of 2] Compiling WMIDemo          ( WMIDemo.hs, WMIDemo.o )

WMIDemo.hs:24:2:
     Couldn't match expected type `[a]' against inferred type `(a1, b)'
     In the pattern: (_, ls)
     In a stmt of a 'do' expression: (_, ls) <- is # enumVariants
     In the second argument of `($)', namely
         `do obj <- Auto.getObject "winmgmts:\\\\.\\root\\CIMV2"
             is <- obj
                 # instancesOf
                     "Win32_OperatingSystem"
                     (Nothing :: Maybe Int)
                     (Nothing :: Maybe (IDispatch ()))
             (_, ls) <- is # enumVariants
             case ls of {
               []
                 -> fail "Hmm..no OS information available; expected at 
least one."
               (wmi_os : _) -> do ... }'
[/code]
ghc 6.10.1
com-1.2.1
Windows Vista Home Ru + sp1


More information about the Haskell-Cafe mailing list