jmacro: http://hackage.haskell.org/package/jmacro
jmacro-rpc: http://hackage.haskell.org/package/jmacro-rpc
jmacro-rpc-snap: http://hackage.haskell.org/package/jmacro-rpc-snap
jmacro-rpc-happstack: http://hackage.haskell.org/package/jmacro-rpc-happstack

I'm happy to announce the release of JMacro 0.6 (0.6.3 actually) which brings a host of improvements. JMacro is a quasiquoted library for the programmatic generation of JavaScript code. It lets you write in a superset of JavaScript with haskell-like syntax and compile-time guarantees of syntactic correctness, and is intended to be used for both embedded javascript and compilers and libraries targeting JavaScript--where hygienic naming, proper scoping, and anti-quotation are especially important. Documentation is on the Haskell Wiki: http://www.haskell.org/haskellwiki/Jmacro

This release brings a host of improvements to efficiency, driven largely by user-submitted patches and requests. Text is used more uniformly, as opposed to String, and JSON integration is provided via aeson rather than the json package. Additionally, nearly all of JavaScript is supported, including more obscure operators, as well as labels, and labeled break and continue.

The big news, however, is JMacro-RPC, which provides multi-server tools for serving JSON-RPC 2.0 [1] remote procedure calls, as well as binding to them from both Haskell and JavaScript. On the Haskell side, rpc server functions and caller stubs are automatically generated by typeclasses. On the JavaScript side, which is less typed, a function is exposed to marshall javascript function arguments directly into RPC calls to a located URL.

[1] http://jsonrpc.org/specification

On top of these RPCs, JMacro-RPC provides the conversation page abstraction, which allows the easy creation of web-applications with server side state. The user simply provides a function from JavaScript -> Page that splices in some JavaScript, and a list of functions they wish to be accessible from the page. All JavaScript within the page then has access to these functions, which run, transparently, server-side, with access to page-invocation-local shared state. Backends exist for JMacro-RPC for Happstack and Snap, and can be easily written for any other server or framework.

JMacro-RPC now also provides the Panels library, which is even higher-level, providing the convenience of continuation-style web development with no scaling hassle. On the server side, Panels are entirely stateless, storing no client-specific state (so requests can be sharded to multiple servers as well without worrying about session replication). Code is written with a set of combinators over Panels, which package up display and behavior simultaneously. Panels, inspired by FRP, can provide Signals, which are sampleable, Events, which are discrete and can trigger updates, and Sinks which can be bound to Signals (behaving similarly to FRP wormholes). Semantics, by virtue of client-server interaction, are necessarily evented rather than continuous. As such, this is properly a system for declarative, event-driven reactivity rather than genuine FRP. Such a system is impoverished compared to the richer continuous-time or fully stream-based discrete-time semantics provided by of real FRP libraries. However, it is more than powerful enough for the sorts of user interfaces Panels are designed to build, and holds the added advantage of being straightforward, tractable, and a tight fit for client-server interactions.

While Signals are applicative and Sinks are contravariant functors, which exposes at least some flavor of FRP, simple Signals and Sinks which don't require server-side processing (and are safely distinguished as such by types) can be bound to one-another purely on the client-side, avoiding unnecessary round-trips.

The Panels code combines concepts from FRP [1][2], Self-Adjusting Computation [3], ASP.NET update panels [4], and research in stable naming schemes for bound variables [5]. The JavaScript "rts" driving evented updates is designed to be reasonably efficient and leak-free.

Between basic RPCs, Conversations, and Panels, JMacro-RPC is intended to provide the full "power scale" for writing robust AJAX web applications with complex server-side logic. Because it is designed to be usable from any Haskell web framework or server, it is suitable for widespread adaptation.

Patches, bug-reports, contributions, feature requests, documentation, etc. all are very welcome.

[1] http://www.haskell.org/haskellwiki/Functional_Reactive_Programming
[2] http://stackoverflow.com/questions/1028250/what-is-functional-reactive-programming
[3] http://www.umut-acar.org/self-adjusting-computation
[4] http://msdn.microsoft.com/en-us/library/bb399001(v=vs.100).aspx
[5] http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.66.6645 ("I am not a number: I am a free variable", McBride and McKinna. See section four, on hierarchical names.)

Cheers,
Gershom

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to