Sneath Lane, a New UI Library using Haste

121 views
Skip to first unread message

Jason Priestley

unread,
Jul 23, 2015, 5:46:44 PM7/23/15
to haste-compiler
I've written a new UI library, using Haste to run in the browser. It is rather unique in that it renders the UI to a canvas element - it's not a layer on top of ordinary DOM programming.
It doesn't support much yet in the way of complex widgets, but it is fast and simple.

sneathlane.com for anyone interested.

Using Haste for this has been working great so far, I actually migrated this project off of js_of_ocaml because I missed features like typeclasses, and the generally nicer Haskell libraries.

Regards,
Jason Priestley

rse...@gmail.com

unread,
Sep 21, 2015, 9:49:38 AM9/21/15
to haste-compiler
This is neat but not that user friendly. I can't select any text and scrolling lags for me (latest version of Firefox). Printing does not work and it doesn't react to viewport resizing. What is your reason to paint to a canvas instead of doing DOM manipulation?

// Emil

Jason Priestley

unread,
Sep 25, 2015, 5:18:02 PM9/25/15
to haste-compiler
Thanks for the feedback. The issues you bring up should all be fixed eventually. Viewport resizing and possibly the scrolling issue will be fixed with the next release (right now the page contains a really tall canvas element, and the browser handles scrolling - the next release I want to put the scrollbar on the canvas as well. This might or might not improve the performance on Firefox, I'll have to see).

As for why I'm bypassing the DOM - if you build on top of the DOM, then you'll probably end up with something that looks a lot like the DOM - stateful, CSS layout algorithms, standard widget rendering, etc. I want to try some other options, most notably a stateless output layer. Of course it's possible to build that as a layer on top of the DOM, which is what efforts like the virtual dom libraries seem to be doing, but then you have an abstraction inversion - two complex layers of software just to get back to the original state of immediate-mode rendering. I think that building to a simple interface is a better long-term strategy. Another advantage is that Sneath Lane is thereby not so strongly tied to the DOM - it would be reasonable to port it to any platform with vector graphics and events, etc.

Jason

Francesco Occhipinti

unread,
Oct 13, 2015, 6:13:35 AM10/13/15
to haste-compiler
The idea of building a combinatorial interface library for Haste is great, but i am not sure that rendering everything in a canvas is the best strategy. This is a bit like Elm does, it is kind of throwing away years of development in web technologies. Would you consider an approach which is more compatible with web standards?

Jason Priestley

unread,
Oct 13, 2015, 10:58:30 AM10/13/15
to haste-compiler
Well Sneath Lane is really at the same level of abstraction as the DOM. It would make no more sense to implement Sneath Lane on top of the DOM, than to implement JSON on top of XML.

XML is actually a good example of a standard which embodies years of work, but most of that complexity serves no purpose. This is a pretty common story in computing, and I would say that the DOM standards are another example. My aim with Sneath Lane is to provide a much simpler alternative for cross-platform UI.
Reply all
Reply to author
Forward
0 new messages