Hacker News new | ask | show | jobs
by noelwelsh 13 days ago
Coincidentally I'm working on my own TUI framework for my book [1], so it's always interesting to see how other people approach it. I wouldn't, for example, use windows and drop-downs in the terminal; I think there are better approaches. Some of the most interesting text-focused UI experiments are taking place in Emacs and Vim, so that's where I'm taking inspiration from.

My framework is demonstrating the capability-passing approach to effects, which is the underlying architecture in most modern JS frameworks, Jetpack Compose, and "immediate mode" toolkits (though the authors are not necessarily aware of capability-passing as a concept). If you've read recent posts on "algebraic effects" or "effect handlers" it's in the same space. It makes for a quite pleasant user experience. I'm enjoying the work uniting theory and practice; one of the benefits of writing the book is I can justify these excursions.

[1]: https://functionalprogrammingstrategies.com/

1 comments

I’ve actually implemented a TUI in Prolog (because there wasn’t anything in the space and I wanted to make sure it respected the relational/logical nature of Prolog). I’m happy with performance and developer ergonomics. But before I publish it, I want to firm up some opinions on how TUIs should behave for end users. Do you have any suggestions other than “use Vim/Emacs and think about it”?
TUIs in Prolog sounds fun.

The great thing about TUIs is that a simple text component is a universal widget. If the user can display text and capture events they can implement any interface components they want in terms of that.

That said, whatever the framework provides pushes users in a particular direction. The core of the things I'm thinking of (some links below) is providing easily accessible context for the user right at the point where they are working. This can be completions at the cursor, or a quick key to pop up a command palette. Fuzzy search is standard.

Here are some examples:

* Corfu: https://github.com/minad/corfu

* Vertico: https://github.com/minad/vertico

* which-key: https://github.com/justbur/emacs-which-key

* LazyVim: https://www.lazyvim.org/

I've included links that have screenshots showing how they work. The list is biased to Emacs, because I'm an Emacs user (Doom Emacs in particular) and so more familiar with that ecosystem.

Hope that helps!