Hey there, I am a relatively new Haskell user who registered just for this thread.
I’ve taken the old gi-gtk-declarative library, and working with Claude, updated it for GTK4 + Adwaita: GitHub - enzuru/gi-gtk4-declarative: Declarative GTK4 programming in Haskell · GitHub
The original gi-gtk-declarative library allowed for a declarative Haskell way to build GTK3 applications, as opposed to the imperative way seen in most other languages, documentation available here: gi-gtk-declarative
I’m using it to build a spreadsheet application, where instead of spreadsheet language you can use GNU Guile Scheme.
I’m looking for more applications to use this updated library so that it can improve in quality. If you’d be interested, I could write a PR trying to update your application to use it. You don’t need to accept the PR, but perhaps you might like it better.
Now I can write GTK widgets declaratively like:
cellLabelWidget :: GridHandlers -> CellDraw -> Widget GridEvent
cellLabelWidget handlers drawn = widget Gtk.Label
[ #hexpand := True
, #xalign := if cellNumeric drawn then 1.0 else 0.0
, #ellipsize := Pango.EllipsizeModeEnd
, #singleLineMode := True
, #label := cellLabel drawn
, #name := T.pack (refName (cellRef drawn))
, #hasTooltip := not (T.null (cellTooltip drawn))
, #tooltipText := cellTooltip drawn
, classes (cellStyles drawn)
, onClickPressed (\presses _ _ -> Pressed (cellRef drawn) presses)
, afterCreated (onCellBuilt handlers)
]
This also makes it much easier to write unit tests.