Haskell gtk Installation Type Conflicts

Main problem:

I am trying to install the Haskell gtk package using standard Mac instructions on OSX 10.10.4. In particular, I want to run threadscope , so I need gtk . Early stages with homebrew and gtk buildtools work fine, but when I

 cabal install gtk 

or use

 cabal install --with-gcc=gcc-4.8 gtk 

I get the following compilation error:

 Graphics/UI/Gtk/Embedding/Plug.chs:120:6: Couldn't match expected type 'Ptr ()' with actual type 'Maybe DrawWindow' In the first argument of 'gtk_plug_new', namely '(fromNativeWindowId (fromMaybe nativeWindowIdNone socketId))' In the second argument of '($)', namely 'gtk_plug_new (fromNativeWindowId (fromMaybe nativeWindowIdNone socketId))' Graphics/UI/Gtk/Embedding/Plug.chs:137:6: Couldn't match expected type 'Ptr ()' with actual type 'Maybe DrawWindow' In the second argument of '\ (Display arg1) arg2 -> withForeignPtr arg1 $ \ argPtr1 -> gtk_plug_new_for_display argPtr1 arg2', namely '(fromNativeWindowId (fromMaybe nativeWindowIdNone socketId))' In the second argument of '($)', namely '(\ (Display arg1) arg2 -> withForeignPtr arg1 $ \ argPtr1 -> gtk_plug_new_for_display argPtr1 arg2) display (fromNativeWindowId (fromMaybe nativeWindowIdNone socketId))' Graphics/UI/Gtk/Embedding/Plug.chs:151:3: Couldn't match type 'Ptr ()' with 'Maybe DrawWindow' Expected type: IO (Maybe DrawWindow) Actual type: IO (Ptr ()) In the second argument of '($)', namely '(\ (Plug arg1) -> withForeignPtr arg1 $ \ argPtr1 -> gtk_plug_get_id argPtr1) (toPlug self)' In the expression: liftM toNativeWindowId $ (\ (Plug arg1) -> withForeignPtr arg1 $ \ argPtr1 -> gtk_plug_get_id argPtr1) (toPlug self) cabal: Error: some packages failed to install: 

I previously had the Haskell gtk library and threadscope before threadscope my Haskell platform from ghc 7.8.4 to ghc 7.10.2 . At first I accepted the installation conflict, but I repeatedly uninstalled the Haskell platform from my system using detailed removal instructions and re-started threadscope without any success. I even uninstalled and reinstalled the base gtk+ and its related packages using homebrew , again unsuccessfully.

I'm not sure where the Ptr () and Maybe DrawWindow types come from, and therefore where the conflict might come from. Any ideas on what might go wrong are welcome!

+5
source share
2 answers

maybe you can try installing gtk with this line

cabal install gtk -fhave-quartz-gtk

+3
source

The edsko blog has a recipe for installing GTK and Threadcope:

http://www.edsko.net/2015/03/09/sandboxes-revisited/

Find the GTK Sandbox page.

Update

I managed to build threadcope using the above instructions with ghc-7.10.2.

The specific commands I used are:

 export PATH=/opt/X11/lib/pkgconfig brew install gtk+ # installed gtk+-2.24.25 brew install poppler # installed poppler-0.35.0 cabal sandbox init cabal install gtk2hs-buildtools cabal install gtk cabal install poppler --with-gcc=gcc-4.9 --extra-include-dirs=/usr/local/include cabal install threadscope 

Specific versions of packages installed in the sandbox:

 cairo-0.13.1.0 ghc-events-0.4.4.0 gio-0.13.1.0 glib-0.13.2.1 gtk-0.13.9 hashtables-1.2.0.2 pango-0.13.1.0 poppler-0.13.1 utf8-string-1.0.1.1 
+1
source

Source: https://habr.com/ru/post/1233624/


All Articles