Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sergei-mironov/urweb-xmlw


https://github.com/sergei-mironov/urweb-xmlw

Last synced: about 15 hours ago
JSON representation

Awesome Lists containing this project

README

        

XMLW
====

XMLW is an [Ur/Web](http://hg.impredicative.com/ur/) library defining a monadic
XML accumulator. It allows programmer to mix XML code and transactional logic in
a single Writer-like monad.

Installing
----------

This project depends on some git submodules, so the typical install sequence
would be:

$
git clone https://github.com/grwlf/urweb-xmlw
cd urweb-xmlw
git submodule update --init --recursive
make

The Makefile builds _./lib.urp_ and certain tests in _test/_ folder.

Example
-------

In the following example, the database query code is located very close to the
place we render it's result. We no longer need to separate transactional actions
from purely-functonal XML producer.

fun dnest st m =
push_back (nest (fn x=>

{x}
) m)

fun tnest m =
push_back (nest (fn x => {x}) m)

fun main {} : transaction page =

b <- run (

push_back_xml (

XMLGen test

);

dnest (STYLE "background:grey") (

push_back_xml (

Nested DIV

);

dnest (STYLE "background:white;margin:15px") (

push_back_xml (

Innermost DIV+table

);

tnest (
push_back_xml
IDS;

lift (debug "Lifting monad transactional works well");

query_ (SELECT A.Id, A.S FROM a AS A)
(fn r =>
push_back_xml
{[r.A.Id]}{[r.A.S]}
)
)
)
)
);
return
{b}