Cursed Knowledge
Cursed knowledge is what we learnt while building our software, and wish we never had to.
-
GHCi runs code off the main thread and macOS hates it
[Haskell Gitlab]GHCi runs each statement sandboxed in a new thread. On macOS, Cocoa refuses to make a window outside the main thread, so a GTK application started from GHCi (for example with ghcid) crashes with 'NSWindow should only be instantiated on the main thread!'. The undocumented -fno-ghci-sandbox flag makes GHCi run the statement on the main thread, but this turns off the GHCi debugger (but who does use the GHCi debugger, we do wonder…).
-
GTK always shows Shift before Ctrl in keyboard shortcuts
[GNOME Gitlab]GTK reads a keyboard shortcut into a set of modifiers, then prints them in a fixed order: Shift, Ctrl, Alt, Super. A shortcut written as <Control><Shift>p thus shows as Shift+Ctrl+P, in `gtk_accelerator_get_label`, GtkShortcutLabel, AdwShortcutLabel and GtkShortcutsWindow alike. To show Ctrl+Shift+P, we must build the label ourselves from the name of each modifier.
-
GHC heap corruption on Windows when using Template Haskell
[Haskell Gitlab]On Windows, using Template Haskell alongside C FFI (like GTK…) can provoke heap corruption, leading to a crash. This is fixed by splitting off the Template Haskell from the C FFI in a different sub-library.
-
Recursive let-bindings can bite you at any time
[GHC Proposals]Haskell in unable to let you explicitly annotate a let-binding as recursive, which can easily trigger an infinite loop. A proposal for a RecursiveLet extension has been dormant since 2025.
-
librsvg does not honour the prefers-color-scheme media query
[GNOME Gitlab]librsvg does not support media queries (including prefers-color-scheme), which means we have to use GTK-specific strategies to make an SVG render differently depending on the desktop's preferred colour scheme.