From burton.samograd at gmail.com Thu Oct 2 14:53:59 2014 From: burton.samograd at gmail.com (Burton Samograd) Date: Thu, 2 Oct 2014 12:53:59 -0600 Subject: [Ur] Simple XML Templating Problem Message-ID: Hi, I'm trying what I think should be a trivial thing but I can't get this to compile: fun head_template (title:string) = return {title} and main () = return {head_template "Blog Main"} I'm trying to create XML templates and return them from functions to help break up my pages into managable pieces (common header, footer, etc). When I compile I get the following mass of errors: urweb blog /home/burton/blog/blog.ur:7:26: (to 7:32) Unification failure Expression: title Have con: string Need con: -> Incompatible constructors Have: string Need: -> /home/burton/blog/blog.ur:7:30: (to 7:35) Unification failure Expression: title Have con: string Need con: xml Incompatible constructors Have: string Need: xml /home/burton/blog/blog.ur:10:5: (to 10:30) Unification failure Expression: head_template "Blog Main" Have con: Type> (xml ([Html = ()]) ( ++ ) ( ++ )) Need con: xml Kind unification failure Have: Type -> Type Need: {Type} -> Type Incompatible kinds Kind 1: Type Kind 2: {Type} I'm using the latest download release available from the main website. -- Burton Samograd -------------- next part -------------- An HTML attachment was scrubbed... URL: From maasha at gmail.com Thu Oct 2 15:03:47 2014 From: maasha at gmail.com (maasha at gmail.com) Date: Thu, 02 Oct 2014 15:03:47 -0400 Subject: [Ur] Simple XML Templating Problem In-Reply-To: References: Message-ID: <542DA193.9070706@gmail.com> There was a problem with your brackets {t} : works for : val title : xbody = {[t]} : works for : val title : string = "tofu is good" fun head_template (t:string) = {[t]} and main () = return {head_template "Blog Main"} happy hacking On 10/02/2014 02:53 PM, Burton Samograd wrote: > Hi, > > I'm trying what I think should be a trivial thing but I can't get this > to compile: > > fun head_template (title:string) = > return {title} > > and main () = return > {head_template "Blog Main"} > > > > > I'm trying to create XML templates and return them from functions to > help break up my pages into managable pieces (common header, footer, > etc). > > When I compile I get the following mass of errors: > > urweb blog > /home/burton/blog/blog.ur:7:26: (to 7:32) Unification failure > Expression: title > Have con: string > Need con: -> > Incompatible constructors > Have: string > Need: -> > /home/burton/blog/blog.ur:7:30: (to 7:35) Unification failure > Expression: title > Have con: string > Need con: > xml > Incompatible constructors > Have: string > Need: xml > /home/burton/blog/blog.ur:10:5: (to 10:30) Unification failure > Expression: head_template "Blog Main" > Have con: > Type> > (xml ([Html = ()]) ( ++ ) > ( ++ )) > Need con: > xml > Kind unification failure > Have: Type -> Type > Need: {Type} -> Type > Incompatible kinds > Kind 1: Type > Kind 2: {Type} > > I'm using the latest download release available from the main website. > > -- > Burton Samograd > > > > > _______________________________________________ > Ur mailing list > Ur at impredicative.com > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur -------------- next part -------------- An HTML attachment was scrubbed... URL: From burton.samograd at gmail.com Thu Oct 2 15:33:06 2014 From: burton.samograd at gmail.com (Burton Samograd) Date: Thu, 2 Oct 2014 13:33:06 -0600 Subject: [Ur] Simple XML Templating Problem In-Reply-To: <542DA193.9070706@gmail.com> References: <542DA193.9070706@gmail.com> Message-ID: Still no luck: fun head_template (_title:string) = return {[_title]} fun main () = return {head_template "Blog Main"} Compiling gives: /home/burton/blog/blog.ur:7:5: (to 7:30) Unification failure Expression: head_template "Blog Main" Have con: Type> (xml ([Html = ()]) ([])) Need con: xml Kind unification failure Have: Type -> Type Need: {Type} -> Type Incompatible kinds Kind 1: Type Kind 2: {Type} -- Burton Samograd On Thu, Oct 2, 2014 at 1:03 PM, maasha at gmail.com wrote: > There was a problem with your brackets > {t} : works for : val title : xbody = > {[t]} : works for : val title : string = "tofu is good" > > fun head_template (t:string) = > {[t]} > and main () = return > {head_template "Blog Main"} > > > > > > happy hacking > > > On 10/02/2014 02:53 PM, Burton Samograd wrote: > > Hi, > > I'm trying what I think should be a trivial thing but I can't get this > to compile: > > fun head_template (title:string) = > return {title} > > and main () = return > {head_template "Blog Main"} > > > > > I'm trying to create XML templates and return them from functions to > help break up my pages into managable pieces (common header, footer, > etc). > > When I compile I get the following mass of errors: > > urweb blog > /home/burton/blog/blog.ur:7:26: (to 7:32) Unification failure > Expression: title > Have con: string > Need con: -> > Incompatible constructors > Have: string > Need: -> > /home/burton/blog/blog.ur:7:30: (to 7:35) Unification failure > Expression: title > Have con: string > Need con: > xml > Incompatible constructors > Have: string > Need: xml > /home/burton/blog/blog.ur:10:5: (to 10:30) Unification failure > Expression: head_template "Blog Main" > Have con: > Type> > (xml ([Html = ()]) ( ++ ) > ( ++ )) > Need con: > xml > Kind unification failure > Have: Type -> Type > Need: {Type} -> Type > Incompatible kinds > Kind 1: Type > Kind 2: {Type} > > I'm using the latest download release available from the main website. > > -- > Burton Samograd > > > > > _______________________________________________ > Ur mailing listUr at impredicative.comhttp://www.impredicative.com/cgi-bin/mailman/listinfo/ur > > > > _______________________________________________ > Ur mailing list > Ur at impredicative.com > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From maasha at gmail.com Thu Oct 2 15:43:25 2014 From: maasha at gmail.com (maasha at gmail.com) Date: Thu, 02 Oct 2014 15:43:25 -0400 Subject: [Ur] Simple XML Templating Problem In-Reply-To: References: <542DA193.9070706@gmail.com> Message-ID: <542DAADD.3070003@gmail.com> The was also problem was the return statement I pulled it out in my last message without making a mention of the change ... sorry about that. Also my preamble mentioning of xbody was a bit off as this is in the head. I do a quick compile before I send out code so both code samples should compile for you ... let me know if this is not the case. fun head_template (_title:string) = {[_title]} fun main () = return {head_template "Blog Main"} happy hacking On 10/02/2014 03:33 PM, Burton Samograd wrote: > > fun head_template (_title:string) = > return {[_title]} > > fun main () = return > {head_template "Blog Main"} > > > From burton.samograd at gmail.com Thu Oct 2 15:48:52 2014 From: burton.samograd at gmail.com (Burton Samograd) Date: Thu, 2 Oct 2014 13:48:52 -0600 Subject: [Ur] Simple XML Templating Problem In-Reply-To: <542DAADD.3070003@gmail.com> References: <542DA193.9070706@gmail.com> <542DAADD.3070003@gmail.com> Message-ID: That worked. Thanks! On Thu, Oct 2, 2014 at 1:43 PM, maasha at gmail.com wrote: > The was also problem was the return statement I pulled it out in my last > message without making a mention of the change ... sorry about that. > Also my preamble mentioning of xbody was a bit off as this is in the > head. I do a quick compile before I send out code so both code samples > should compile for you ... let me know if this is not the case. > > fun head_template (_title:string) = > {[_title]} > > fun main () = return > {head_template "Blog Main"} > > > > > > happy hacking > > On 10/02/2014 03:33 PM, Burton Samograd wrote: > > > > fun head_template (_title:string) = > > return {[_title]} > > > > fun main () = return > > {head_template "Blog Main"} > > > > > > > > > _______________________________________________ > Ur mailing list > Ur at impredicative.com > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > -------------- next part -------------- An HTML attachment was scrubbed... URL: From grrwlf at gmail.com Thu Oct 2 15:56:08 2014 From: grrwlf at gmail.com (Sergey Mironov) Date: Thu, 2 Oct 2014 23:56:08 +0400 Subject: [Ur] Simple XML Templating Problem In-Reply-To: References: <542DA193.9070706@gmail.com> Message-ID: 2014-10-02 23:33 GMT+04:00 Burton Samograd : > Still no luck: > > fun head_template (_title:string) = > return {[_title]} > > fun main () = return > {head_template "Blog Main"} > > > The error is caused by the type mismatch. {f x} works only for pure functions f. Pure functions usually don't mention 'transaction' in their type signatures, nor they use 'return' keyword in their bodies. Your code snippet have two problems: 1) unspecified type for [main] and 2) 'return' keyword in [head_template] conflicting with {..} call. Try this code instead: fun head_template (_title:string) = {[_title]} fun main () : transaction page = return {head_template "Blog Main"} Regards, Sergey From burton.samograd at gmail.com Thu Oct 2 16:26:25 2014 From: burton.samograd at gmail.com (Burton Samograd) Date: Thu, 2 Oct 2014 14:26:25 -0600 Subject: [Ur] Simple XML Templating Problem In-Reply-To: References: <542DA193.9070706@gmail.com> Message-ID: More growing pains. I've taken my example a bit further to: style footer style header fun head_tmpl (_title:string) = {[_title]} fun header_tmpl () : xbody =
header
fun footer_tmpl () : xbody = fun body_tmpl (body_xml:xbody) = {header_tmpl ()} {body_xml} {footer_tmpl ()} fun page (title:string, body:xbody) = {head_tmpl title} {body_tmpl body} fun main () : transaction page = return (page "BlogMain" ) There's a problem with the main function even with the type decleration: urweb blog /home/burton/blog/blog.ur:24:17: (to 24:27) Unification failure Expression: "BlogMain" Have con: string Need con: string * (xml ([Dyn = (), MakeForm = (), Body = ()]) ([]) ([])) Incompatible constructors Have: string Need: string * (xml ([Dyn = (), MakeForm = (), Body = ()]) ([]) ([])) /home/burton/blog/blog.ur:24:12: (to 24:27) Unification failure Expression: page "BlogMain" Have con: xml ([Html = ()]) ([]) ([]) Need con: -> Incompatible constructors Have: xml ([Html = ()]) ([]) ([]) Need: -> Still learning the basics but I think once I get over the learning curve things will go a quite a bit smoother. -- Burton Samograd On Thu, Oct 2, 2014 at 1:56 PM, Sergey Mironov wrote: > 2014-10-02 23:33 GMT+04:00 Burton Samograd : > > Still no luck: > > > > fun head_template (_title:string) = > > return {[_title]} > > > > fun main () = return > > {head_template "Blog Main"} > > > > > > > > The error is caused by the type mismatch. {f x} works only > for pure functions f. Pure functions usually don't mention > 'transaction' in their type signatures, nor they use 'return' keyword > in their bodies. Your code snippet have two problems: 1) unspecified > type for [main] and 2) 'return' keyword in [head_template] conflicting > with {..} call. Try this code instead: > > fun head_template (_title:string) = > {[_title]} > > fun main () : transaction page = return > {head_template "Blog Main"} > > > > > Regards, > Sergey > > _______________________________________________ > Ur mailing list > Ur at impredicative.com > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > -------------- next part -------------- An HTML attachment was scrubbed... URL: From maasha at gmail.com Thu Oct 2 16:49:34 2014 From: maasha at gmail.com (maasha at gmail.com) Date: Thu, 02 Oct 2014 16:49:34 -0400 Subject: [Ur] Simple XML Templating Problem In-Reply-To: References: <542DA193.9070706@gmail.com> Message-ID: <542DBA5E.5060507@gmail.com> You where pretty spot on it was just that the convention for pairs is different than what you were using and I have included the modified code below. Let me know if it works for you. Sorry for my bad grammar in my previous message, hopefully my emails help. happy hacking ------------------------------------------------------------------------------------------------------------------------ style footer style header fun head_tmpl (_title:string) = {[_title]} fun header_tmpl () : xbody =
he\ ader
fun footer_tmpl () : xbody = fun body_tmpl (body_xml:xbody) = {header_tmpl ()} {body_xml} {footer_tmpl ()} (* 1. changed the types to the convention that works with pairs. *) fun page ((title,body) : (string * xbody)) = {head_tmpl title} {body_tmpl body} (* 2. changed the calling convention to to work with the new definition *) fun main () : transaction page = return (page ("BlogMain",)) -------------- Another alternative would be ---------------------------------- (* 1. changed the types to the convention that works with two arguments. *) fun page (title : string) (body : xbody) = {head_tmpl title} {body_tmpl body} (* 2. changed the calling convention to to work with the new definition *) fun main () : transaction page = return (page "BlogMain" ) From adamc at csail.mit.edu Thu Oct 2 17:13:04 2014 From: adamc at csail.mit.edu (Adam Chlipala) Date: Thu, 02 Oct 2014 17:13:04 -0400 Subject: [Ur] Simple XML Templating Problem In-Reply-To: References: <542DA193.9070706@gmail.com> Message-ID: <542DBFE0.4030909@csail.mit.edu> On 10/02/2014 04:26 PM, Burton Samograd wrote: > fun page (title:string, body:xbody) = > > {head_tmpl title} > {body_tmpl body} > > > fun main () : transaction page = > return (page "BlogMain" ) I expect Mutaamba's reply clears up the issue, but, to put it concisely: the issue here is a function defined with /tupling/ but called with /currying/. Those are two different approaches to encoding multiple-argument functions on top of single-argument functions, and the distinction is also present (and also confuses newcomers!) in Haskell and ML. -------------- next part -------------- An HTML attachment was scrubbed... URL: From burton.samograd at gmail.com Thu Oct 2 17:27:20 2014 From: burton.samograd at gmail.com (Burton Samograd) Date: Thu, 2 Oct 2014 15:27:20 -0600 Subject: [Ur] Simple XML Templating Problem In-Reply-To: <542DBFE0.4030909@csail.mit.edu> References: <542DA193.9070706@gmail.com> <542DBFE0.4030909@csail.mit.edu> Message-ID: Thanks for the help. Are any types functions evaluated and inlined at compile time to reduce run-time overhead (say like my head_tmpl that is taking a constant string)? On Thu, Oct 2, 2014 at 3:13 PM, Adam Chlipala wrote: > On 10/02/2014 04:26 PM, Burton Samograd wrote: > > fun page (title:string, body:xbody) = > > {head_tmpl title} > {body_tmpl body} > > > fun main () : transaction page = > return (page "BlogMain" ) > > > I expect Mutaamba's reply clears up the issue, but, to put it concisely: > the issue here is a function defined with *tupling* but called with > *currying*. Those are two different approaches to encoding > multiple-argument functions on top of single-argument functions, and the > distinction is also present (and also confuses newcomers!) in Haskell and > ML. > > _______________________________________________ > Ur mailing list > Ur at impredicative.com > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adamc at csail.mit.edu Thu Oct 2 18:14:12 2014 From: adamc at csail.mit.edu (Adam Chlipala) Date: Thu, 02 Oct 2014 18:14:12 -0400 Subject: [Ur] Simple XML Templating Problem In-Reply-To: References: <542DA193.9070706@gmail.com> <542DBFE0.4030909@csail.mit.edu> Message-ID: <542DCE34.5060605@csail.mit.edu> On 10/02/2014 05:27 PM, Burton Samograd wrote: > Are any types functions evaluated and inlined at compile time to > reduce run-time overhead (say like my head_tmpl that is taking a > constant string)? Any function called only once will be inlined. Functions called multiple times will be inlined or not based on configurable size thresholds. From burton.samograd at gmail.com Thu Oct 2 23:54:17 2014 From: burton.samograd at gmail.com (Burton Samograd) Date: Thu, 2 Oct 2014 21:54:17 -0600 Subject: [Ur] SQL Question Message-ID: Hi, Another probably basic question where I'm not getting the type system. I have the following table: table posts : { Id : int, Title : string, Body, :string : Author, string, Created : time } PRIMARY KEY Id and I'm trying to compile the following code: ... and posts' () : xbody = posts' <- queryX (SELECT * FROM posts) (fn row => post' {[row.Posts.Title]} {[row.Posts.Body]} {[row.Posts.Author]} {[row.Posts.Created]});
{posts'}
and post' (title:string) (body:string) (authorUserId:int) (date:string) : xbody = let val numComments = 0 in
{[title]}
{[body]}
end this is giving me the following compile errors: /root/typedweb/blog.ur:39:20: (to 39:25) syntax error: replacing SYMBOL with SQL /root/typedweb/blog.ur:39:28: (to 39:37) This is an expression but not a pattern. /root/typedweb/blog.ur:39:46: (to 39:46) syntax error: inserting EQ /root/typedweb/blog.ur:39:48: (to 39:57) This is an expression but not a pattern. /root/typedweb/blog.ur:39:28: (to 39:37) This is an expression but not a pattern. /root/typedweb/blog.ur:39:65: (to 39:65) syntax error: inserting PLUS /root/typedweb/blog.ur:39:67: (to 39:76) This is an expression but not a pattern. /root/typedweb/blog.ur:39:48: (to 39:57) This is an expression but not a pattern. /root/typedweb/blog.ur:39:86: (to 39:86) syntax error: inserting PLUS I'm trying to use the same syntax as the urblog tutorial but it's calling a post generation function but I'm still not getting it to compile properly. Can SQL only be used in a transaction? -- Burton Samograd -------------- next part -------------- An HTML attachment was scrubbed... URL: From adamc at csail.mit.edu Fri Oct 3 08:34:34 2014 From: adamc at csail.mit.edu (Adam Chlipala) Date: Fri, 03 Oct 2014 08:34:34 -0400 Subject: [Ur] SQL Question In-Reply-To: References: Message-ID: <542E97DA.1040404@csail.mit.edu> On 10/02/2014 11:54 PM, Burton Samograd wrote: > and posts' () : xbody = > posts' <- queryX (SELECT * FROM posts) > (fn row => post' {[row.Posts.Title]} {[row.Posts.Body]} > {[row.Posts.Author]} {[row.Posts.Created]}); The curly-braces-and-brackets notation is only valid inside code snippets of embedded languages, like HTML and SQL. It's not legal in the positions you're using it above. Actually, you can just remove it there! > Can SQL only be used in a transaction? Yes, that's the other problem I see in the code. Database access is only allowed in transactions. From maasha at gmail.com Fri Oct 3 08:56:30 2014 From: maasha at gmail.com (mutaamba maasha) Date: Fri, 03 Oct 2014 08:56:30 -0400 Subject: [Ur] SQL Question In-Reply-To: References: Message-ID: <542E9CFE.5070101@gmail.com> (* Hi Yes, occur within transactions, let me know if you want me to go into more detail into why. I can't place the error as I can't determine the line numbers so I have included the code below which should help you track down your problem. Hope this helps. happy hacking *) style postsList style post style postTitle style postAuthor style postBody style postBottom style postComments style postDate (* there is a typo starting around "Body, :string" *) table posts : { Id : int, Title : string, Body : string, Author : string, Created : time } PRIMARY KEY Id (* Renamed the function more of a personal preference. The query has to be in a transaction which is what I think you were asking. *) fun list_posts () : transaction xbody = (* changed the variable name ... personal prefrence *) content <- queryX (SELECT * FROM posts) (* changed the function name ... personal preference *) (fn row => format_post row.Posts.Title (* removed the {[]} as it is used in queries or xml *) row.Posts.Body row.Posts.Author row.Posts.Created); return
{content}
(* changed the function name ... personal preference *) and format_post (title : string) (body : string) (authorUserId : string) (created : time) (* changed name but also the type is time *) : xbody = let val numComments = 0 in
{[title]}
{[body]}
end (* Using error instead of supplying the implementation of the comment function ... compiles but will throw an runtime error if you try to view the page. I use this often when I am trying to isolate an compilation error ... I comment out the function definition and replace it with error some insightful error message *) and comments () : transaction page = error error : comment function not implemented From burton.samograd at gmail.com Fri Oct 3 14:21:30 2014 From: burton.samograd at gmail.com (Burton Samograd) Date: Fri, 3 Oct 2014 12:21:30 -0600 Subject: [Ur] SQL Question In-Reply-To: <542E9CFE.5070101@gmail.com> References: <542E9CFE.5070101@gmail.com> Message-ID: Are you limited to one query per transaction? This type of code causes compiler errors where a single query doesn't: fun page () : transaction xbody = data <- (SELECT * FROM table ...) (fn row => ...) data2 <- (SELECT * FROM table2 ...) (fn row => ...) (* Generate part of the page with data *) {header data} (* Generate another section with data2 *) {footer data2} -- Burton On Fri, Oct 3, 2014 at 6:56 AM, mutaamba maasha wrote: > (* Hi > Yes, occur within transactions, let me know if you want me to go into > more detail into why. I can't place the error as I can't determine > the line numbers so I have included the code below which should help > you track down your problem. Hope this helps. > > happy hacking > > *) > style postsList > style post > style postTitle > style postAuthor > style postBody > style postBottom > style postComments > style postDate > > (* there is a typo starting around "Body, :string" *) > table posts : { Id : int, Title : string, Body : string, Author : > string, Created : time } > PRIMARY KEY Id > > (* Renamed the function more of a personal preference. > The query has to be in a transaction which is what > I think you were asking. > *) > fun list_posts () : transaction xbody = > (* changed the variable name ... personal prefrence *) > content <- queryX (SELECT * FROM posts) > (* changed the function name ... personal > preference *) > (fn row => format_post row.Posts.Title (* > removed the {[]} as it is used in queries or xml *) > row.Posts.Body > row.Posts.Author > row.Posts.Created); > return
> {content} >
> > > (* changed the function name ... personal preference *) > and format_post > (title : string) > (body : string) > (authorUserId : string) > (created : time) (* changed name but also the type is time *) > : xbody = > let > val numComments = 0 > in > >
>
{[title]}
> >
{[body]}
>
> > >
>
>
> end > (* Using error instead of supplying the implementation of the comment > function ... compiles but will throw an runtime error if you try to > view the page. I use this often when I am trying to isolate an > compilation error ... I comment out the function definition and > replace it with error some insightful error message *) > and comments () : transaction page = error error : comment > function not implemented > > _______________________________________________ > Ur mailing list > Ur at impredicative.com > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adamc at csail.mit.edu Fri Oct 3 14:23:40 2014 From: adamc at csail.mit.edu (Adam Chlipala) Date: Fri, 03 Oct 2014 14:23:40 -0400 Subject: [Ur] SQL Question In-Reply-To: References: <542E9CFE.5070101@gmail.com> Message-ID: <542EE9AC.8060706@csail.mit.edu> On 10/03/2014 02:21 PM, Burton Samograd wrote: > Are you limited to one query per transaction? No. Your code example below seems to be missing semicolons at line ends. > This type of code causes compiler errors where a single query doesn't: > > fun page () : transaction xbody = > > data <- (SELECT * FROM table ...) (fn row => ...) > data2 <- (SELECT * FROM table2 ...) (fn row => ...) > > (* Generate part of the page with data *) > {header data} > > (* Generate another section with data2 *) > {footer data2} From burton.samograd at gmail.com Fri Oct 3 14:34:04 2014 From: burton.samograd at gmail.com (Burton Samograd) Date: Fri, 3 Oct 2014 12:34:04 -0600 Subject: [Ur] SQL Question In-Reply-To: <542EE9AC.8060706@csail.mit.edu> References: <542E9CFE.5070101@gmail.com> <542EE9AC.8060706@csail.mit.edu> Message-ID: Sorry about the missing semicolons. Here's a non-ad hock typed up example: -------------------------------------------------------------------------------------------------------- table posts : { Id : int, Title : string, Body : string, Created : time } PRIMARY KEY Id table userIdToPostIds : { UserId : int, PostId : int } PRIMARY KEY UserId table users : { Id : int, Username : string } PRIMARY KEY Id fun blog () : transaction page = posts <- queryX (SELECT Posts.Title, Posts.Body, Users.Username, Posts.Created FROM posts, users, userIdToPostIds WHERE users.Id = userIdToPostIds.UserId AND posts.Id = userIdToPostIds.PostId) (fn row => post' row.Posts.Title row.Posts.Body row.Users.Username row.Posts.Created); posts2 <- queryX (SELECT Posts.Title, Posts.Body, Users.Username, Posts.Created FROM posts, users, userIdToPostIds WHERE users.Id = userIdToPostIds.UserId AND posts.Id = userIdToPostIds.PostId) (fn row => post' row.Posts.Title row.Posts.Body row.Users.Username row.Posts.Created); return (Page.page' blogName {topbar' ()} {posts' posts} {posts' posts2} ) and topbar' () : xbody =
{[blogName]}
and posts' (posts) : xbody =
{posts}
-------------------------------------------------------------------------------------------------------- and comments () : transaction page = error /comments not implemented. I've simply duplicated the query into a new variable 'posts2' and called the post generation again using it (to avoid a possible unused variable warning/error), hence my question about a single query per transaction. When I compile I get: /home/burton/blog/blog.ur:20:0: (to 64:3) Some constructor unification variables are undetermined in declaration (look for them as "") Decl: ..... [], Users = ([Id = int]) ++ ([Username = string]) ++ [], UserIdToPostIds = ([UserId = int]) ++ ([PostId = int]) ++ []]] [[]] [bool] Basis.sql_prim [bool] Basis.sql_bool Basis.True, SelectFields = Basis.sql_subset [[Posts = (([Created = time]) ++ ([Body = string]) ++ [Title = string], ([Id = int]) ++ []), Users = ([Username = string], ([Id = int]) ++ []), UserIdToPostIds = ([], ([UserId = int]) ++ ([PostId = int]) ++ [])]], SelectExps = {}}, OrderBy = Basis.sql_order_by_Nil [([]) ++ [Posts = ([Id = int]) ++ ([Created = time, Body = string, Title = string]) ++ [], Users = ([Id = int]) ++ ([Username = string]) ++ [], UserIdToPostIds = ([UserId = int]) ++ ([PostId = int]) ++ []]] [[]], Limit = Basis.sql_no_limit, Offset = Basis.sql_no_offset}) (fn row : $(([Posts = $(([Title = string]) ++ ([Body = string]) ++ ([Created = time]) ++ [])]) ++ (([Users = $(([Username = string]) ++ [])]) ++ []) ++ []) => post' row.#Posts.#Title row.#Posts.#Body row.#Users.#Username row.#Posts.#Created)) (fn posts : xml ([Dyn = (), MakeForm = (), Body = ()]) ([]) ([]) => Basis.bind [transaction] [xml ([Dyn = (), MakeForm = (), Body = ()]) ([]) ([])] [xml ([Html = ()]) ([]) ([])] Basis.transaction_monad (queryX [[Posts = (fn fields :: ({Type} * {Type}) => fields.1) (([Created = time]) ++ ([Body = string]) ++ [Title = string], ([Id = int]) ++ ), Users = (fn fields :: ({Type} * {Type}) => fields.1) ([Username = string], ([Id = int]) ++ [])]] [[]] [[Dyn = (), MakeForm = (), Body = ()]] [[]] (Basis.sql_query [[]] [[]] [[Posts = ([Id = int]) ++ ([Created = time, Body = string, Title = string]) ++ , Users = ([Id = int]) ++ ([Username = string]) ++ [], UserIdToPostIds = ([UserId = int]) ++ ([PostId = int]) ++ []]] [[Posts = (fn fields :: ({Type} * {Type}) => fields.1) (([Created = time]) ++ ([Body = string]) ++ [Title = string], ([Id = int]) ++ ), Users = (fn fields :: ({Type} * {Type}) => fields.1) ([Username = string], ([Id = int]) ++ [])]] [[]] {Rows = Basis.sql_query1 [[]] [[]] [[Posts = ([Id = int]) ++ ([Created = time, Body = string, Title = string]) ++ , Users = ([Id = int]) ++ ([Username = string]) ++ [], UserIdToPostIds = ([UserId = int]) ++ ([PostId = int]) ++ []]] [[Posts = ([Id = int]) ++ ([Created = time, Body = string, Title = string]) ++ , Users = ([Id = int]) ++ ([Username = string]) ++ [], UserIdToPostIds = ([UserId = int]) ++ ([PostId = int]) ++ []]] [[Posts = (fn fields :: ({Type} * {Type}) => fields.1) (([Created = time]) ++ ([Body = string]) ++ [Title = string], ([Id = int]) ++ ), Users = (fn fields :: ({Ty Without the duplicated query I can compile without any warnings or errors. Burton On Fri, Oct 3, 2014 at 12:23 PM, Adam Chlipala wrote: > On 10/03/2014 02:21 PM, Burton Samograd wrote: > >> Are you limited to one query per transaction? >> > > No. Your code example below seems to be missing semicolons at line ends. > > This type of code causes compiler errors where a single query doesn't: >> >> fun page () : transaction xbody = >> >> data <- (SELECT * FROM table ...) (fn row => ...) >> data2 <- (SELECT * FROM table2 ...) (fn row => ...) >> >> (* Generate part of the page with data *) >> {header data} >> >> (* Generate another section with data2 *) >> {footer data2} >> > > _______________________________________________ > Ur mailing list > Ur at impredicative.com > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > -------------- next part -------------- An HTML attachment was scrubbed... URL: From maasha at gmail.com Fri Oct 3 15:33:08 2014 From: maasha at gmail.com (mutaamba maasha) Date: Fri, 03 Oct 2014 15:33:08 -0400 Subject: [Ur] SQL Question In-Reply-To: References: <542E9CFE.5070101@gmail.com> <542EE9AC.8060706@csail.mit.edu> Message-ID: <542EF9F4.8080905@gmail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 (* It seems the problem was the naming of the query result, the query result was colliding with the table. Let me know if this was the case and if the code below helps. Happy hacking *) (* adding the needed styles *) style topbar style postsList style post style postTitle style postAuthor style postBody style postBottom style postComments style postDate table posts : { Id : int, Title : string, Body : string, Created : time } PRIMARY KEY Id table userIdToPostIds : { UserId : int, PostId : int } PRIMARY KEY UserId table users : { Id : int, Username : string } PRIMARY KEY Id (* Adding this here so it compiles *) val blogName : string = "The finest culinary selections from the land of tofu." (* Using modules to so everything fits in one file. If you are curious about modules you can find out more about them here : http://www.impredicative.com/ur/tutorial/intro.html You want to remove this because you have the files page.ur* *) signature PAGE = sig val page' : string -> xbody -> page end structure Page : PAGE = struct fun page' (t : string) (b : xbody) : page= {[t]} {[b]} end (* The end of the module code/code you should remove *) fun blog () : transaction page = (* Changed the name of the query result - this is most likely what is was causing your problem. *) post_query_1 <- queryX (SELECT Posts.Title, Posts.Body, Users.Username, Posts.Created FROM posts, users, userIdToPostIds WHERE users.Id = userIdToPostIds.UserId AND posts.Id = userIdToPostIds.PostId) (fn row => post' row.Posts.Title row.Posts.Body row.Users.Username row.Posts.Created); (* changed the name of the query result *) post_query_2 <- queryX (SELECT Posts.Title, Posts.Body, Users.Username,Posts.Created FROM posts, users, userIdToPostIds WHERE users.Id = userIdToPostIds.UserId AND posts.Id = userIdToPostIds.PostId) (fn row => post' row.Posts.Title row.Posts.Body row.Users.Username row.Posts.Created); return (Page.page' blogName {topbar' ()} {posts' post_query_1} {posts' post_query_2} ) and topbar' () : xbody =
{[blogName]}
(* added type information here *) and posts' (posts : xbody) : xbody =
{posts}
(* Used the code from the previous email ... I am going to guess it is what you have. *) and post' (title : string) (body : string) (username : string) (created : time) : xbody = let val numComments = 0 in
{[title]}
{[body]}
end and comments () : transaction page = error error : comment function not implemented fun main () = return -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJULvn0AAoJEHxRxnzR1VWyyx4QALnOK3VgRpYNWK6wgBUxkPyz R+rKe0Vq0KCgzF3MjjyQPLaxwTxdfbg9gaXVZyXkpDnX8RIOhySYFmNOsN6BHGu3 f8I4uvtS+N4Wsa4FjHzmY35XoyGiDlki6kbE+Yw8Myp7Jv2iY+FXXuQvumS83Wvr JXlujVROxY+Iglsqsu3iAh5btw+VaBaNC2SQUQLHrrIeZTvUOsIS5A0+MW7SQn5p 6Aj77EDtbA2k0xpCyAADZ54UrSvzHFrMnLEheHAoLjAufNdrzl5+dyFyZukJRndg y/cc4dUgkqZhX/wsDEbMBkTqbW1R+vZvNxX0+lUSqDc53LxNYwDQQGgIuVrAqKBf yom/3IbvoS4Nkt1MF/2qZU7bptXK59rpBbWTk9zt00FO/nsf2/zR+nDU6Os6rkST 4DUTmBGOcGd9/e1RO6UdK819PoVVPOXdy7JsAyzHacp3aTMH3gEkAHia7wAsb/Iz wnljBwssuNOPY1vT3s4ul8BXDRCclOsg1cb66EedFiGEnZW1PyD1mYvWeRUjR4IK CzRa3xpsliE5XisYuZqEoplQ3gaovPInJ7CZEG3k8w350ts+D85VU2WqKATIG2gr gTi9SzzqlTlIS/H2dmlNwvMsEJG38byXuCZQar0ElX7wVg8nANlv4xqAEjIbJ+YH 039UXNim4rX2XSgGmg4P =6vna -----END PGP SIGNATURE----- From burton.samograd at gmail.com Fri Oct 3 15:39:37 2014 From: burton.samograd at gmail.com (Burton Samograd) Date: Fri, 3 Oct 2014 13:39:37 -0600 Subject: [Ur] SQL Question In-Reply-To: <542EF9F4.8080905@gmail.com> References: <542E9CFE.5070101@gmail.com> <542EE9AC.8060706@csail.mit.edu> <542EF9F4.8080905@gmail.com> Message-ID: Looks like I have to take better care of my variable naming to prevent clashes. Thanks. Burton On Fri, Oct 3, 2014 at 1:33 PM, mutaamba maasha wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > (* It seems the problem was the naming of the > query result, the query result was colliding > with the table. Let me know if this was the > case and if the code below helps. > > Happy hacking > *) > > (* adding the needed styles *) > style topbar > style postsList > style post > style postTitle > style postAuthor > style postBody > style postBottom > style postComments > style postDate > > table posts : { Id : int, Title : string, Body : string, Created : time } > PRIMARY KEY Id > table userIdToPostIds : { UserId : int, PostId : int } > PRIMARY KEY UserId > table users : { Id : int, Username : string } > PRIMARY KEY Id > > (* Adding this here so it compiles *) > val blogName : string = "The finest culinary selections from the land > of tofu." > (* Using modules to so everything fits in one > file. If you are curious about modules you > can find out more about them here : > http://www.impredicative.com/ur/tutorial/intro.html > You want to remove this because you have the > files page.ur* > *) > signature PAGE = sig > val page' : string -> xbody -> page > end > structure Page : PAGE = struct > fun page' (t : string) (b : xbody) : page= > > {[t]} > > {[b]} > > > end > (* The end of the module code/code you should remove *) > > > fun blog () : transaction page = > (* Changed the name of the query result - this is most likely > what is was causing your problem. *) > post_query_1 <- queryX (SELECT Posts.Title, Posts.Body, > Users.Username, Posts.Created > FROM posts, users, userIdToPostIds > WHERE users.Id = userIdToPostIds.UserId > AND posts.Id = userIdToPostIds.PostId) > (fn row => post' row.Posts.Title > row.Posts.Body row.Users.Username row.Posts.Created); > (* changed the name of the query result *) > post_query_2 <- queryX (SELECT Posts.Title, Posts.Body, > Users.Username,Posts.Created > FROM posts, users, userIdToPostIds > WHERE users.Id = userIdToPostIds.UserId > AND posts.Id = userIdToPostIds.PostId) > (fn row => post' row.Posts.Title > row.Posts.Body row.Users.Username row.Posts.Created); > return (Page.page' blogName > > {topbar' ()} > {posts' post_query_1} > {posts' post_query_2} > ) > > and topbar' () : xbody = >
{[blogName]}
> (* added type information here *) > and posts' (posts : xbody) : xbody = >
> {posts} >
> (* Used the code from the previous email > ... I am going to guess it is what you > have. *) > and post' (title : string) > (body : string) > (username : string) > (created : time) : xbody = > let > val numComments = 0 > in > >
>
{[title]}
> >
{[body]}
>
> > >
>
>
> end > and comments () : transaction page = error error : comment > function not implemented > > > fun main () = return > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1 > > iQIcBAEBAgAGBQJULvn0AAoJEHxRxnzR1VWyyx4QALnOK3VgRpYNWK6wgBUxkPyz > R+rKe0Vq0KCgzF3MjjyQPLaxwTxdfbg9gaXVZyXkpDnX8RIOhySYFmNOsN6BHGu3 > f8I4uvtS+N4Wsa4FjHzmY35XoyGiDlki6kbE+Yw8Myp7Jv2iY+FXXuQvumS83Wvr > JXlujVROxY+Iglsqsu3iAh5btw+VaBaNC2SQUQLHrrIeZTvUOsIS5A0+MW7SQn5p > 6Aj77EDtbA2k0xpCyAADZ54UrSvzHFrMnLEheHAoLjAufNdrzl5+dyFyZukJRndg > y/cc4dUgkqZhX/wsDEbMBkTqbW1R+vZvNxX0+lUSqDc53LxNYwDQQGgIuVrAqKBf > yom/3IbvoS4Nkt1MF/2qZU7bptXK59rpBbWTk9zt00FO/nsf2/zR+nDU6Os6rkST > 4DUTmBGOcGd9/e1RO6UdK819PoVVPOXdy7JsAyzHacp3aTMH3gEkAHia7wAsb/Iz > wnljBwssuNOPY1vT3s4ul8BXDRCclOsg1cb66EedFiGEnZW1PyD1mYvWeRUjR4IK > CzRa3xpsliE5XisYuZqEoplQ3gaovPInJ7CZEG3k8w350ts+D85VU2WqKATIG2gr > gTi9SzzqlTlIS/H2dmlNwvMsEJG38byXuCZQar0ElX7wVg8nANlv4xqAEjIbJ+YH > 039UXNim4rX2XSgGmg4P > =6vna > -----END PGP SIGNATURE----- > > _______________________________________________ > Ur mailing list > Ur at impredicative.com > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > -------------- next part -------------- An HTML attachment was scrubbed... URL: From burton.samograd at gmail.com Fri Oct 3 16:04:29 2014 From: burton.samograd at gmail.com (Burton Samograd) Date: Fri, 3 Oct 2014 14:04:29 -0600 Subject: [Ur] SQL Question In-Reply-To: References: <542E9CFE.5070101@gmail.com> <542EE9AC.8060706@csail.mit.edu> <542EF9F4.8080905@gmail.com> Message-ID: Now I really get what was going wrong :) I was defining a variable 'posts' that was then being queried rather than the table named 'posts'. I guess I thought that the SQL table and variable namespace was different than the Ur namespace, or I just didn't notice the variable and table names were the same. I dream of having the ML knowledge and time to work on better error messages for Ur/Web. Maybe someday. I once worked on a small compiler and kept a log of bad error messages, the code and then the solution and possible error message to what the problem was so the messages could get better. Maybe we could start a place on the wiki or issue tracker for such a database. Burton On Fri, Oct 3, 2014 at 1:39 PM, Burton Samograd wrote: > Looks like I have to take better care of my variable naming to prevent > clashes. > > Thanks. > > Burton > > On Fri, Oct 3, 2014 at 1:33 PM, mutaamba maasha wrote: > >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> (* It seems the problem was the naming of the >> query result, the query result was colliding >> with the table. Let me know if this was the >> case and if the code below helps. >> >> Happy hacking >> *) >> >> (* adding the needed styles *) >> style topbar >> style postsList >> style post >> style postTitle >> style postAuthor >> style postBody >> style postBottom >> style postComments >> style postDate >> >> table posts : { Id : int, Title : string, Body : string, Created : time } >> PRIMARY KEY Id >> table userIdToPostIds : { UserId : int, PostId : int } >> PRIMARY KEY UserId >> table users : { Id : int, Username : string } >> PRIMARY KEY Id >> >> (* Adding this here so it compiles *) >> val blogName : string = "The finest culinary selections from the land >> of tofu." >> (* Using modules to so everything fits in one >> file. If you are curious about modules you >> can find out more about them here : >> http://www.impredicative.com/ur/tutorial/intro.html >> You want to remove this because you have the >> files page.ur* >> *) >> signature PAGE = sig >> val page' : string -> xbody -> page >> end >> structure Page : PAGE = struct >> fun page' (t : string) (b : xbody) : page= >> >> {[t]} >> >> {[b]} >> >> >> end >> (* The end of the module code/code you should remove *) >> >> >> fun blog () : transaction page = >> (* Changed the name of the query result - this is most likely >> what is was causing your problem. *) >> post_query_1 <- queryX (SELECT Posts.Title, Posts.Body, >> Users.Username, Posts.Created >> FROM posts, users, userIdToPostIds >> WHERE users.Id = userIdToPostIds.UserId >> AND posts.Id = userIdToPostIds.PostId) >> (fn row => post' row.Posts.Title >> row.Posts.Body row.Users.Username row.Posts.Created); >> (* changed the name of the query result *) >> post_query_2 <- queryX (SELECT Posts.Title, Posts.Body, >> Users.Username,Posts.Created >> FROM posts, users, userIdToPostIds >> WHERE users.Id = userIdToPostIds.UserId >> AND posts.Id = userIdToPostIds.PostId) >> (fn row => post' row.Posts.Title >> row.Posts.Body row.Users.Username row.Posts.Created); >> return (Page.page' blogName >> >> {topbar' ()} >> {posts' post_query_1} >> {posts' post_query_2} >> ) >> >> and topbar' () : xbody = >>
{[blogName]}
>> (* added type information here *) >> and posts' (posts : xbody) : xbody = >>
>> {posts} >>
>> (* Used the code from the previous email >> ... I am going to guess it is what you >> have. *) >> and post' (title : string) >> (body : string) >> (username : string) >> (created : time) : xbody = >> let >> val numComments = 0 >> in >> >>
>>
{[title]}
>> >>
{[body]}
>>
>> >> >>
>>
>>
>> end >> and comments () : transaction page = error error : comment >> function not implemented >> >> >> fun main () = return >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v1 >> >> iQIcBAEBAgAGBQJULvn0AAoJEHxRxnzR1VWyyx4QALnOK3VgRpYNWK6wgBUxkPyz >> R+rKe0Vq0KCgzF3MjjyQPLaxwTxdfbg9gaXVZyXkpDnX8RIOhySYFmNOsN6BHGu3 >> f8I4uvtS+N4Wsa4FjHzmY35XoyGiDlki6kbE+Yw8Myp7Jv2iY+FXXuQvumS83Wvr >> JXlujVROxY+Iglsqsu3iAh5btw+VaBaNC2SQUQLHrrIeZTvUOsIS5A0+MW7SQn5p >> 6Aj77EDtbA2k0xpCyAADZ54UrSvzHFrMnLEheHAoLjAufNdrzl5+dyFyZukJRndg >> y/cc4dUgkqZhX/wsDEbMBkTqbW1R+vZvNxX0+lUSqDc53LxNYwDQQGgIuVrAqKBf >> yom/3IbvoS4Nkt1MF/2qZU7bptXK59rpBbWTk9zt00FO/nsf2/zR+nDU6Os6rkST >> 4DUTmBGOcGd9/e1RO6UdK819PoVVPOXdy7JsAyzHacp3aTMH3gEkAHia7wAsb/Iz >> wnljBwssuNOPY1vT3s4ul8BXDRCclOsg1cb66EedFiGEnZW1PyD1mYvWeRUjR4IK >> CzRa3xpsliE5XisYuZqEoplQ3gaovPInJ7CZEG3k8w350ts+D85VU2WqKATIG2gr >> gTi9SzzqlTlIS/H2dmlNwvMsEJG38byXuCZQar0ElX7wVg8nANlv4xqAEjIbJ+YH >> 039UXNim4rX2XSgGmg4P >> =6vna >> -----END PGP SIGNATURE----- >> >> _______________________________________________ >> Ur mailing list >> Ur at impredicative.com >> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From burton.samograd at gmail.com Fri Oct 3 23:04:09 2014 From: burton.samograd at gmail.com (Burton Samograd) Date: Fri, 3 Oct 2014 23:04:09 -0400 Subject: [Ur] Type signature for a form handler Message-ID: Hi again, I'm can't figure out what the type signature should be for a form handler in a submit button (Auth.login below) so I can put it in my auth.urs file:
Username: Password:
Any help on what I should use for a signature appreciated. Burton -------------- next part -------------- An HTML attachment was scrubbed... URL: From maasha at gmail.com Fri Oct 3 23:54:51 2014 From: maasha at gmail.com (mutaamba maasha) Date: Fri, 03 Oct 2014 23:54:51 -0400 Subject: [Ur] Type signature for a form handler In-Reply-To: References: Message-ID: <542F6F8B.6040909@gmail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 (* The answer to the your question is : val login : { Username : string , Password : string } -> transaction page The module gives a sample implementation and signature. Besides their usage in forms they I records helpful when defining a function with multiple arguments for example: and post' (title : string) (body : string) (username : string) (created : time) : xbody = ... would be: post' ( p : { Title : string , Body : string , Username : string , Create : time }) : xbody = ... So for function calls with many arguments I know what each parameter is being used for. e.g. (fn row => post' { Title = "tofu is so great" , Body = ... , Username = row.Users.Username , Create = row.Posts.Created}) It is a trivial example but you can imagine more elaborate scenarios. I digress, hopeful my meandering is of some help and I have answered your question. Below is sample implementation. Happy hacking *) signature AUTH = sig val login : { Username : string , Password : string } -> transaction page end structure Auth : AUTH = struct fun login (r : { Username : string , Password : string }) : transaction page = return welcome to tofu palace

Username:{[r.Username]}

Password:{[r.Password]}

end fun login_form () : transaction page = return welcome to tofu palace
Username: Password:
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUL2+LAAoJEHxRxnzR1VWy35gP/izXyoPE9nF2UyBezEyVZq3M IlAMNuiqeEBLrvy34EozXj4LgWZnpFzIRKtdDAvhYKYDY4KeCVk3FSDAkR5g/iZl 3FcVwa8e4w8jPv9mq3YgAk3j+lRlE6qFpOFtcfLaf+5lVNYzXmingqUubWh9v/vp 04kMb689B4rXF2PDZ7xEI29XNOKSL7pPj/ZIQtsyhTHYtSjuk/NktQM5bkgRskps W654tDkaD8a8TNDPHyu07RcuczK/5OKHplOpcSJEbolP3X75lNM0UrlU86nTKqnV 1eIMjPjLMoVZ4HiVBt1bUDSc3pib5ithSjk5zzcQSyVP7a6fdAhQBgm2/z9LriZh 5djqe7gegZ7B0KAFYP6skVTH7+hsyNzFCxF5zub3ymKlor0oE8Qyrr+sWNlmIINj 1XN4c//lLVVNarZUY7vwaHwDlo94n43btHBUysPV4G/aOEu0BVeVzSoG4f7i8S6P 8vPG3Pzi09iRdqGa4BEgq4Kjb3EP52f1NWfFcYfcXxM67hAGrP4K0IPaO3FII/ry UPCBWw9L33qpmAVAdZjNxUQT/vs+1vMHqRaJtdLf3glFYN1nAbprVoE8RZZbOsCW HbagTj2vtpJFChWs3KuAbR9/weSNV4XC63vP9SRKcfCHqElv5nIXyejfQfX5BL4c iFUlrExHlo9TRgYyGz+D =uRh+ -----END PGP SIGNATURE----- From grrwlf at gmail.com Sun Oct 12 07:58:28 2014 From: grrwlf at gmail.com (Sergey Mironov) Date: Sun, 12 Oct 2014 15:58:28 +0400 Subject: [Ur] Patch, more html5 attributes Message-ID: Hi! I have ported one more Bootstrap3 [1] example to the Ur/Web. This time, it was much easier job to do, but still I had to patch the compiler to make it work. First thing I need was HTML5 attributes 'required' and 'autofocus' for input fields. Those changes are located in basis.urs and are rather straightforward. The second thing is the . My intuition says me that adding custom input types was not designed to be regular operation, but building recent HTML5 pages may require doing it. Quick search [2] shows that there are 'url' 'tel', 'search', 'number', 'range', 'date', etc. I included the monoize.sml change to support just the [email] for ordinary [formTags]. Is it possible to prepare a procedure of doing the same thing for [cformTags] (references to javaScript confuse me)? For now, the patch makes it possible run the example, the demo is working http://hit.msk.ru/B3_Login/main Regards, Sergey [1] - http://getbootstrap.com/examples/signin/ [2] - http://html5doctor.com/html5-forms-input-types/ PS patch doesn't do anything with 'placeholder' attribute. it turns out it was already added. -------------- next part -------------- A non-text attachment was scrubbed... Name: 1_of_1_HTML5_input_attributes__placeholder__required__autofocus__email_input_type__without_cformTag_equivalent_.patch Type: text/x-patch Size: 3972 bytes Desc: not available URL: From adamc at csail.mit.edu Sun Oct 12 16:40:24 2014 From: adamc at csail.mit.edu (Adam Chlipala) Date: Sun, 12 Oct 2014 16:40:24 -0400 Subject: [Ur] Proofread a paper on Ur/Web? Message-ID: <543AE738.8080208@csail.mit.edu> I've written a paper on Ur/Web that will appear at POPL 2015, a research conference in the general field of programming languages. Would any of you mind reading a draft to see if there are any embarrassing errors, poor explanations, inaccurate claims about other frameworks, etc.? If so, thanks in advance! The paper is here: http://adam.chlipala.net/tmp/urweb.pdf I'll keep updating the file at that URL as I fix issues that folks point out. Some of you may know POPL as a conference that involves a lot of dense theory. This particular paper, though, should be accessible to anyone who meets the prerequisites that I give for Ur/Web itself: expert on typed functional programming languages like ML and Haskell. There aren't any formal semantics or proofs. One part of the paper lists production Ur/Web applications. If you have one that I've missed, or if you have a correction to my current description of your application, I'd especially appreciate hearing from you! FWIW, I need to finalize the paper by October 28. Thanks! From gbuday at gmail.com Mon Oct 13 10:49:20 2014 From: gbuday at gmail.com (Gergely Buday) Date: Mon, 13 Oct 2014 16:49:20 +0200 Subject: [Ur] Proofread a paper on Ur/Web? In-Reply-To: <543AE738.8080208@csail.mit.edu> References: <543AE738.8080208@csail.mit.edu> Message-ID: Dear Adam, some comments. In the first section you emphasize that this and that aspect is how simple. Now, Ur/Web is anything but simple, and this is not because you did something wrong: it is because building web applications is not simple. Next, beginning with a probably simpler, Hello World example could come handy to introduce language constructs. Last, I would not postpone mentioning Javascript compilation to section 2.2 but would tell readers in the introduction that they can build server and client abstractions in the very same language. This is a very strong selling point of Ur/Web. Sorry for not peeking for your typos, I hope these were of some help. - Gergely On 12 October 2014 22:40, Adam Chlipala wrote: > I've written a paper on Ur/Web that will appear at POPL 2015, a research > conference in the general field of programming languages. Would any of you > mind reading a draft to see if there are any embarrassing errors, poor > explanations, inaccurate claims about other frameworks, etc.? If so, thanks > in advance! The paper is here: > http://adam.chlipala.net/tmp/urweb.pdf > I'll keep updating the file at that URL as I fix issues that folks point > out. > > Some of you may know POPL as a conference that involves a lot of dense > theory. This particular paper, though, should be accessible to anyone who > meets the prerequisites that I give for Ur/Web itself: expert on typed > functional programming languages like ML and Haskell. There aren't any > formal semantics or proofs. > > One part of the paper lists production Ur/Web applications. If you have one > that I've missed, or if you have a correction to my current description of > your application, I'd especially appreciate hearing from you! > > FWIW, I need to finalize the paper by October 28. > > Thanks! > > _______________________________________________ > Ur mailing list > Ur at impredicative.com > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur From grrwlf at gmail.com Fri Oct 17 13:57:09 2014 From: grrwlf at gmail.com (Sergey Mironov) Date: Fri, 17 Oct 2014 21:57:09 +0400 Subject: [Ur] Uru, new version available Message-ID: Hi. Recent Ur/Web improvements have made it possible to make Uru even smaller, so I'd like to announce the new version of the library. Uru - a modularization library aimed to simplify the writing of user interface code in Ur/Web. https://github.com/grwlf/uru3 In Web programming world, user interface libraries usually contain very different types of materials to be included into the master project. Most JavaScript controls are distributes as packages containing JavaScript code, CSS files, images, fonts and so on. For example, Bootstrap [1] library package includes the following files: bootstrap[.min].css, bootstrap[.min].js, glyphicons-halflings-regular.eot and few other glyph collections. Typical process of including such a library into a web project may include a) Setting up the static content directories and placing the library's files into it b) For every static CSS file, providing application with correct tag c) For every JavaScript file, providing the application template's with corresponding