Urgent.News

What's breaking now, across thousands of outlets.

Tech

Making a GTK application in Haskell, part 1

This article series details the construction of a todo-list application using Haskell, GTK 4, and the Adwaita library. Adwaita supplies a variety of widgets and styles. The intended readership is intermediate Haskell developers. Adwaita is a GTK component library embodying GNOME's design language and accessibility guidelines. It offers features like responsive design and runtime theme color changes.

Haskell bindings for GTK are generated via the haskell-gi toolkit, enabling interaction with GTK using a familiar C API interface.

The post's code examples are incomplete to emphasize key concepts. The complete project is accessible at https://github.com/Floreal-Technologies/adwaita-todo. The first example demonstrates a GTK/Adwaita application structure that manages resources, including Adwaita stylesheets. An empty window with "Todos" as its title and size of 480x640 is created.

The Elm Architecture, or TEA, is introduced as a design pattern for interactive programs, comprising three core concepts. This approach, popularized by Elm, improves the management of imperative GTK toolkit code. The application state and actions are modeled as data structures for clear visibility on triggered actions and their implications. User interactions are represented as Messages, a known set of actions with clear modifications to the model.

Initial domain logic is encoded as a sum type of messages and an update function to modify the state. It's advisable to outline expectations before starting a UI project, as design often doesn't directly stem from data. Several widgets are utilized, such as:

- Button

- Entry

- Label

- ListButton

- ListBox

- Spinner

These widgets connect to form the Model-View-Update trio. Functions dispatch and step are also defined, working together. dispatch manages GTK execution loop priority, calls step, and performs the model update leading to the view update. step reads the model, applies the update function to create a new model, writes it, and passes it to the View, which then returns the updated content as a Gtk widget.

This content is set in the window. The article concludes here, with Part 2 to add more features to the Todo List application.

Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Also reported by 1 other outlet

Read the original at floreal.tech →

More in Tech

Why search-and-replace is the wrong way to fix a trailing comma in JSON

A single comma can make a whole JSON file unusable: { "name" : "ada" , "roles" : [ "admin" , "ops" ,], } # Python json.decoder.JSONDecodeError: Expecting value: line 3 column 28 (char 46) # Node /…

  • Trailing commas in JSON cause parsing errors
  • Simple re.sub fix corrupts string values
  • Proper solution tracks string state and escapes

CVE-2026-41264: How a Regex Let Prompts Run Code in Flowise

import pandas as np , os as pandas pandas . system ( " xcalc " ) Those two lines are the whole bypass in CVE-2026-41264 , a CVSS 9.8 bug in Flowise , the open source drag-and-drop builder for LLM…

  • Critical vulnerability CVE-2026-41264 affects Flowise, an open-source LLM builder.
  • Regex flaw in Flowise's CSV Agent allows arbitrary code execution via malformed prompts.
  • Fixed in Flowise 3.1.3 with stricter regex rules and additional security checks.

Seltzer Is Becoming KiwiEngine's Communication Layer

Road To KiwiEngine #43: An application can't live entirely inside itself. Eventually, something has to come in. A request. A form submission. An API call. A webhook. A client asking for data.

  • KiwiEngine launches Seltzer as communication layer
  • Seltzer manages HTTP infrastructure for apps
  • Reduces developer cognitive load on communication

More from Monday 5 October →