
Hi all, I try to binding Haskell to VTE library. Below are Vte.chs file i wrote. I use c2hs with below command LANG=C c2hs -d trace -l $(pkg-config --cflags vte | sed 's/-I/-C-I/g') vte/vte.h Vte.chs generate Vte.hs file. When i compile Vte.hs file, i got below error: Vte.chs:67:89: Couldn't match expected type `Widget' against inferred type `()' Expected type: IO (Ptr Widget) Inferred type: IO (Ptr ()) In the second argument of `($)', namely `vte_terminal_new' In the second argument of `($)', namely `liftM (castPtr :: Ptr Widget -> Ptr Terminal) $ vte_terminal_new' for binding code: terminalNew :: IO Terminal terminalNew = makeNewObject mkTerminal $ liftM (castPtr :: Ptr Widget -> Ptr Terminal) $ {#call unsafe terminal_new#} In C code, fucntion `GtkWidget *vte_terminal_new(void);' return `IO (Ptr Widget), then i use castPtr transform (Ptr Widget) to (Ptr Terminal), right? Why GHC report function `vte_terminal_new` return `IO (Ptr ())', I do something wrong? Any help? Thanks! -- Andy
participants (1)
-
Andy Stewart