[Ur] SVG Test based on ListEdit.ur

Jonas Mellin jonas.mellin at his.se
Tue May 1 20:35:24 EDT 2018


Hmm, so https://github.com/karsar/urweb-examples/blob/master/SVGTest/SVGTest.ur works because the SVG is encapsulated in HTML inside the dyn. That restricts the options for employing SVG.

/Jonas




From: Ur [mailto:ur-bounces at impredicative.com] On Behalf Of Adam Chlipala
Sent: den 2 maj 2018 00:59
To: ur at impredicative.com
Subject: Re: [Ur] SVG Test based on ListEdit.ur

Yes, I'm sorry, but the <dyn> tag is only for HTML and the DOM.  It would take extra implementation effort to make it compatible with SVG, and that effort has not yet been made... so it's good that the compiler is raising a static error!

On 05/01/2018 06:04 PM, Jonas Mellin wrote:
Dear all, I have tried to adapt ListEdit.ur in the tutorial to a small SVG application that adds circles to the screen as you double click (the code is at the end). The SVG.urs is found at https://github.com/karsar/urweb-examples/blob/master/SVGTest/SVG.urs

I get a problem at row 57 "<dyn signal={circleDraw p}/>" and also at line 22 "show' (pl : plist) : signal xsvg   =" where the compiler gets stuck on "Error in final record unification
Can't unify record constructors". My hypothesis is that there is some problem between html and SVG.

An excerpt of the error messages sis:
/home/a/SVGTest5/SVGTest.ur:57:3: (to 58:8) Error in final record unification
Can't unify record constructors
Have:  <UNIF:U571::{Unit}> ++ [Dyn = ()]
Need:  [Svg = ()]

===== CODE =====
[...]
                                 <circle cx={show ((fst x')-60)} cy={show ((snd x')-100)} r="10" stroke="red" fill="blue"/>
[...]

and show' (pl : plist) : signal xsvg   =
    case pl of
                             Nil => return <xml/>
                             | Cons {Point = p, Tail = t } => return <xml>
                                 <dyn signal={circleDraw p}/>
                             </xml>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20180502/92e123da/attachment.html>


More information about the Ur mailing list