Thx.

One trial, that I believe should work, is:
open SVG

(*con intPair = int*int*)

fun fst (x: int*int) = x.1
fun snd (x: int*int) = x.2
fun circleDraw(x: int*int): xsvg =
    <xml>
     <circle cx={show ((fst x)-60)} cy={show ((snd x)-100)} r="10" stroke="red" 
fill="blue"/>
    </xml>


    fun proc (x: int*int): transaction page =
                             x <- source x;
    return
                             <xml>
                               <body onmousemove={fn ev => set x 
(ev.ScreenX,ev.SceenY)}>

                                 <div style="width:800; heigth:800">
                                   <dyn signal={x<-signal x;
                                                                                
          return
                                                                                
              <xml>
                                                                                
                                    <svg width="800" height="800">
                                                                                
                                       {circleDraw x}
                                                                                
                                    </svg>
                                                                                
              </xml>}/>
                                                                                
                                          </div>
                                                                                
                                          </body>
                               </xml>



fun main(): transaction page  =
    let
                             val a = (0,0)
    in
                             xml <- proc a;
    return
                             <xml>
                               <head>
                                 Banzai
                               </head>
                                 {xml}
                             </xml>
    end


But I get:
Can't unify record constructors
Have:
[ScreenX = int, ScreenY = int, ClientX = int, ClientY = int,
  CtrlKey = bool, ShiftKey = bool, AltKey = bool, MetaKey = bool,
  Button = mouseButton]
Need:  <UNIF:U140::{Type}> ++ [ScreenX = int, SceenY = int]

On "                      <body onmousemove={fn ev => set x 
(ev.ScreenX,ev.SceenY)}>"



From: Ur [mailto:ur-boun...@impredicative.com] On Behalf Of Adam Chlipala
Sent: den 16 april 2018 13:29
To: ur@impredicative.com
Subject: Re: [Ur] UR/Web SVG (ffi) question

I have not read all of your code, but I did spot the problem behind the first 
compiler error message, which I think all web developers would agree is 
problematic.  (I.e., it isn't just a question of a fussy Ur/Web type system.)

On 04/16/2018 04:58 AM, Jonas Mellin wrote:
[Jonas Mellin] <<< collapsed answer >>>

Notice that your [proc] code includes a <body> tag, but then you nest it within 
another <body> tag!
_______________________________________________
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur

Reply via email to