yurt

201 views
Skip to first unread message

Atamert Ölçgen

unread,
Dec 28, 2015, 2:44:57 AM12/28/15
to Functional Relational Programming
Hi,

I have been working on a FRP platform for a couple of months. Still in its infancy but I thought this would be a good time to post a few words about it. I think it is safe to say Out of the Tarpit is the most influential paper on me[1]. Currently I am working towards something that assumes an ideal world, backed by an in-memory storage. From there I'll add persistence, optimization and other bells and whistles.

I try to stay as close to the system described in the paper. But I decided to use a Lisp-like syntax for the program (relation, query, etc. definitions), because I think it suits better to an expression language. Here is an actual comment that describes the entire API:


;; Public interface
;;
;;   (server)
;;
;;   (feed server feeder-id transaction)
;;
;;   (observe server observer-id queries callback)
;;   (forget server observer-id)


This is used for embedding an FRP system into another application, a.k.a library-mode. I am also considering providing pre-packaged feeders and observers, a.k.a application-mode. I chose Clojure as implementation language. This makes some things super easy (compared to Scala or Java) to achieve. And I am not nearly as productive with Haskell yet. Oh, and one last note; `callback` above is a function that receives (some sort of) iterators to (one or more) queries when relevant relations change.

This is a dumb program I am using as an integration test:


(relation Person (Text name) (Text birthday) (Text phone-number))

(query birthdays (project Person [name birthday]))
(query phone-numbers (project Person [name phone-number]))


I am loading the program in stages (relations first, then functions, then constraints, then queries) to ensure a constraint can't refer to a query etc. Loader also tries hard to provide specific and clear error messages. It also does type checking. One thing that was challenging was to fit relations into the type system. Because in the type system a relation is not a `Relation`. Well it is that as well. But it is more accurately and specifically `{:name :Text, :birthday :Text, :phone-number :Text}` (for Person above). I couldn't find a type system that can do this[2] so I had to special case it. Since user defined functions can't operate on relations, I guess that was OK.

I think data migrations and interactive development is also very important for the success of this sort of platform. The code and the relations change and I think it wouldn't be too difficult
to provide automatic migrations for most changes and assistance when user intervention is required. Luckily I don't have to worry about these things for a while longer.

There is not much to show for now. But my project is called yurt and it lives here: http://www.yurt-persistence.com/

Thanks for reading and I would be happy to answer any questions regarding yurt.

-----

[1] - C-Store and a few 3D rendering related papers would contest for the 2nd place, but I have no clear winner.
[2] - Except maybe Racket's type system and by extension core.type, but they are way to complicated for me.


-- 
Kind Regards,
Atamert Ölçgen

◻◼◻
◻◻◼
◼◼◼

www.muhuk.com
Reply all
Reply to author
Forward
0 new messages