Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sergei-mironov/urweb-xmlw
https://github.com/sergei-mironov/urweb-xmlw
Last synced: about 15 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/sergei-mironov/urweb-xmlw
- Owner: sergei-mironov
- Created: 2015-01-30T16:50:56.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-11-15T20:11:15.000Z (almost 8 years ago)
- Last Synced: 2024-08-22T22:31:29.310Z (3 months ago)
- Language: UrWeb
- Size: 10.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-urweb - urweb-xmlw - Library defining a monadic XML accumulator. It allows programmer to mix XML code and transactional logic in a single Writer-like monad. (HTML/XML Parsing)
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
makeThe 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}