From yves.cloutier at gmail.com Sat Dec 24 13:46:27 2016 From: yves.cloutier at gmail.com (Yves Cloutier) Date: Sat, 24 Dec 2016 13:46:27 -0500 Subject: [Ur] Rendering SVG Message-ID: Hello, What would be the syntax for rendering SVG in urweb? I did a test using: fun main () = return Pattern Maker but this doesn't seem to work. -------------- next part -------------- An HTML attachment was scrubbed... URL: From zivscully at gmail.com Sat Dec 24 14:19:48 2016 From: zivscully at gmail.com (Ziv Scully) Date: Sat, 24 Dec 2016 14:19:48 -0500 Subject: [Ur] Rendering SVG In-Reply-To: References: Message-ID: You need to tell Ur/Web about the SVG and other tags through Ur/Web's FFI and a .urs file. (See Section 11.3 of the Ur/Web manual.) I did this once for simple SVG shapes in the past and am attaching the files. It's not complete, but you'll hopefully find it helpful as a baseline. I eventually abandoned the SVG approach for what I was doing because it didn't play nicely with Ur/Web's tags, but I didn't properly investigate the issue. On Sat, Dec 24, 2016 at 1:46 PM, Yves Cloutier wrote: > Hello, > > What would be the syntax for rendering SVG in urweb? I did a test using: > > fun main () = return > > Pattern Maker > > > > > /> > > > > > but this doesn't seem to work. > > > > _______________________________________________ > Ur mailing list > Ur at impredicative.com > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: svg.urp Type: application/octet-stream Size: 8 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: svg.urs Type: application/octet-stream Size: 2554 bytes Desc: not available URL: From adamc at csail.mit.edu Sat Dec 31 14:51:59 2016 From: adamc at csail.mit.edu (Adam Chlipala) Date: Sat, 31 Dec 2016 14:51:59 -0500 Subject: [Ur] Grammar/Parser bug? In-Reply-To: <57FE77DC.6060207@csail.mit.edu> References: <1e49c50e-b287-a426-f2bc-c5e687a0c706@csail.mit.edu> <57FE77DC.6060207@csail.mit.edu> Message-ID: <16fe026d-0c45-8bf0-d5ca-9116afab6b43@csail.mit.edu> OK, after much anticipation... I finally made the Ur/Web grammar change that should make your original code Just Work. On 10/12/2016 01:50 PM, Adam Chlipala wrote: > On 10/08/2016 07:41 PM, Saulo Araujo wrote: >> Thanks for suggesting this workaround. I was able to implement it, >> but I have some doubts. [...] >> >> After some trial and error, the compiler was happy with >> >> con concat nm t r = [[nm] ~ r] => $([nm = t] ++ r) >> >> Which brings me the question: what is [[nm] ~ r] => $([nm = t] ++ r)? >> Besides from the "=>" token, it looks like the type of a function >> that produces a record from a disjointness proof. > > Oh, I was too quick to suggest my version without actually running it > through Ur/Web. Sorry about that. > > [=>] is a guard, saying "you only get a value of this type (to the > right of the arrow) if you can prove this constraint (to the left)." > > It looks like I might actually need to extend the parser to make your > example workable. Stay tuned.... > >> Indeed, the compiler accepts >> >> val fullName : concat #First string [Last = string] = fn [[First] ~ >> [Last = string]] => {First = "Saulo", Last = "Araujo"} >> >> Surprisingly, however, besides fullName being a function, I can >> manipulate it like a record >> >> val first : string = fullName.First >> >> Which reminds me of the Queen song "A Kind of Magic" :) > > The type-inference engine automatically discards guards whose > constraints can be proved, so it isn't so magic after all. ;) > >> Sincerely, >> Saulo >> >> On Sat, Oct 8, 2016 at 2:05 PM, Adam Chlipala > > wrote: >> >> It does seem likely that the parser isn't allowing qualified >> names in record literals. The problem is easy to work around by >> defining a type synonym that you use instead. Here's some code >> (not actually run through Ur/Web yet!): >> type blah x y z = $([x = y] ++ z) >> ... where type t = blah A.n1 A.t1 A.t2 >> It may need extra kind annotations. >> >> >> On 10/07/2016 08:42 AM, Saulo Araujo wrote: >> >> Hi, >> >> I am trying to do something like >> >> signature ARGUMENTS = sig >> con n1 :: Name >> con t1 :: Type >> con t2 :: {Type} >> constraint [n1] ~ t2 >> end >> >> signature RESULT = sig >> type t >> end >> >> functor Functor(A : ARGUMENTS) : RESULT where type t = >> $([A.n1 = A.t1] ++ A.t2) = struct >> open A >> >> type t = $([n1 = t1] ++ t2) >> end >> >> but the Ur/Web compiler complains saying: >> >> test.ur:12:58: (to 12:60) syntax error: deleting CSYMBOL DOT >> Parse failure >> >> Apparently, one cannot construct type-level records by >> projecting name variables from a module. Is this a >> grammar/parser bug? If so, is there a workaround? >> >> Sincrely, >> Saulo >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From saulo2 at gmail.com Sat Dec 31 16:06:30 2016 From: saulo2 at gmail.com (Saulo Araujo) Date: Sat, 31 Dec 2016 18:06:30 -0300 Subject: [Ur] Grammar/Parser bug? In-Reply-To: <16fe026d-0c45-8bf0-d5ca-9116afab6b43@csail.mit.edu> References: <1e49c50e-b287-a426-f2bc-c5e687a0c706@csail.mit.edu> <57FE77DC.6060207@csail.mit.edu> <16fe026d-0c45-8bf0-d5ca-9116afab6b43@csail.mit.edu> Message-ID: Thanks for the new year's gift Adam! :) Happy new year you all, Saulo On Sat, Dec 31, 2016 at 4:51 PM, Adam Chlipala wrote: > OK, after much anticipation... I finally made the Ur/Web grammar change > that should make your original code Just Work. > > > On 10/12/2016 01:50 PM, Adam Chlipala wrote: > > On 10/08/2016 07:41 PM, Saulo Araujo wrote: > > Thanks for suggesting this workaround. I was able to implement it, but I > have some doubts. [...] > > After some trial and error, the compiler was happy with > > con concat nm t r = [[nm] ~ r] => $([nm = t] ++ r) > > Which brings me the question: what is [[nm] ~ r] => $([nm = t] ++ r)? > Besides from the "=>" token, it looks like the type of a function that > produces a record from a disjointness proof. > > > Oh, I was too quick to suggest my version without actually running it > through Ur/Web. Sorry about that. > > [=>] is a guard, saying "you only get a value of this type (to the right > of the arrow) if you can prove this constraint (to the left)." > > It looks like I might actually need to extend the parser to make your > example workable. Stay tuned.... > > Indeed, the compiler accepts > > val fullName : concat #First string [Last = string] = fn [[First] ~ [Last > = string]] => {First = "Saulo", Last = "Araujo"} > > Surprisingly, however, besides fullName being a function, I can manipulate > it like a record > > val first : string = fullName.First > > Which reminds me of the Queen song "A Kind of Magic" :) > > > The type-inference engine automatically discards guards whose constraints > can be proved, so it isn't so magic after all. ;) > > Sincerely, > Saulo > > On Sat, Oct 8, 2016 at 2:05 PM, Adam Chlipala wrote: > >> It does seem likely that the parser isn't allowing qualified names in >> record literals. The problem is easy to work around by defining a type >> synonym that you use instead. Here's some code (not actually run through >> Ur/Web yet!): >> type blah x y z = $([x = y] ++ z) >> ... where type t = blah A.n1 A.t1 A.t2 >> It may need extra kind annotations. >> >> >> On 10/07/2016 08:42 AM, Saulo Araujo wrote: >> >>> Hi, >>> >>> I am trying to do something like >>> >>> signature ARGUMENTS = sig >>> con n1 :: Name >>> con t1 :: Type >>> con t2 :: {Type} >>> constraint [n1] ~ t2 >>> end >>> >>> signature RESULT = sig >>> type t >>> end >>> >>> functor Functor(A : ARGUMENTS) : RESULT where type t = $([A.n1 = A.t1] >>> ++ A.t2) = struct >>> open A >>> >>> type t = $([n1 = t1] ++ t2) >>> end >>> >>> but the Ur/Web compiler complains saying: >>> >>> test.ur:12:58: (to 12:60) syntax error: deleting CSYMBOL DOT >>> Parse failure >>> >>> Apparently, one cannot construct type-level records by projecting name >>> variables from a module. Is this a grammar/parser bug? If so, is there a >>> workaround? >>> >>> Sincrely, >>> Saulo >>> >> > > _______________________________________________ > Ur mailing list > Ur at impredicative.com > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > > -------------- next part -------------- An HTML attachment was scrubbed... URL: