4 ms·
I confess that I also do not understand the code in the article. (But I am still only a student of Haskell.) I can only guess, based on my own work with this id
by gcv 12y ago
I confess that I also do not understand the code in the article. (But I am still only a student of Haskell.) I can only guess, based on my own work with this idea of Cells-type programming, that the author means the following:
Suppose you have three data nodes, or cells: A, B, C, and D. A holds the value 5, B holds 3, C is defined as A+B, and D is defined as B*C. In a spreadsheet, changing cell A will automatically update C, because C directly depends on A. It will also update D because it transitively depends on B through C, and C has changed. This library (and the Clojure one I mentioned in my other post) lets you define data structures which behave the same way.
In a pure environment, you can emulate this using only functions. In a non-pure environment, automatically updating values can be quite nice. You use this to implicitly trigger linked behaviors. In a UI, this could mean changing the state of several elements in response to some input without having to explicitly say updateElementA(), updateElementB(), and so on.
- thinkpad20 12y agoThanks, yeah that's really helpful in getting a sense of the problem this is attempting to address. I can definitely see why it's nice to have a simple (to use) and compact API behind this. I wish that Gabriel had taken a similar approach in explaining this library (start with a description of the problem, then a high-level idea for a solution, then some specifics, etc). But regardless, I have the utmost respect for Gonzalez, and give him props for what looks like a(nother) great library.