Recommended Haskell GUI library?

Thank you for your July 2022 article on GUI libraries. You mention that gi-gtk could be tricky to install on Windows, but I recently found gi-gtk >= 4.0.1 quite straightforward using Stack and the Stack-supplied MSYS2. So, I thought I would share that experience:

Step 1: Add the MSYS2 packages to the Stack environment:

stack exec -- pacman -S mingw-w64-x86_64-pkgconf 
stack exec -- pacman -S mingw-w64-x86_64-gobject-introspection
stack exec -- pacman -S mingw-w64-x86_64-gtksourceview5
stack exec -- pacman -S mingw-w64-x86_64-gtk4 
stack exec -- pacman -S mingw-w64-x86_64-atk

Step 2: Set set environment variable PKG_CONFIG_PATH to the mingw64\lib\pkgconfig directory of the Stack-supplied MSYS2.

Step 3: Set set environment variable XDG_DATA_DIRS to the mingw64\share directory of the Stack-supplied MSYS2.

As I was using snapshot lts-22.39, my Stack project-level configuration (stack.yaml) looked like:

snapshot: lts-22.39 # GHC 9.6.6

extra-deps:
- gi-gtk-4.0.9
- gi-gdk-4.0.9
- gi-gsk-4.0.8
3 Likes

Yes, this is the method to follow, both with Stack and Cabal. (It’s a little easier with Stack because it makes MinGW more accessible, but Cabal comes with a MinGW environment too.)

The problem is that, if you don’t have much experience with MinGW (or Arch Linux), it’s not necessarily obvious that this is what has to be done. There’s a guide, but it uses a different method yet again (by putting MinGW into the global PATH). Perhaps I should reword the article from ‘difficult to install’ to ‘annoying to install’, or something like that, but I think my point is justified in general.

4 Likes

Returning to this: I once again find myself wanting to write a GUI program. How is development going with wxHaskell? Would you say it’s now usable for a somewhat complex GUI?

Personally I haven’t found time to do anything with it since Zurihac in June (and not even as much as I planned then, as I was ill for much of the weekend), but the PRs and issue discussions imply that at least some people are using it. That’s the strongest endorsement I can honestly give.

Great to hear, thanks!

Do anyone know how to use the current wxHaskell in a cabal project? Every time I get the error by version conflicts

It’s almost impossible to use. I’ve had better luck with gtk and or SDL.

1 Like

What error are you seeing exactly? Here’s a simple demo project, which should work as long as wxc is installed.

1 Like

Thanks for the demo project, I’ll try, but my error was a conflict in version for wxdirect, I don’t know how to deal with conflicts in dependencies in Haskell yet