[Ur] Now using queryL1 instead of queryX1 - No longer getting monadic IO "unification failure" errors, now just getting mismatched tag errors
Stefan Scott Alexander
stefanscottalexx at gmail.com
Sun Jul 19 03:28:18 EDT 2015
Hello -
As reported in my previous posts...
http://www.impredicative.com/pipermail/ur/2015-July/002064.html
http://www.impredicative.com/pipermail/ur/2015-July/002067.html
...I was previously getting errors involving "unification failure" and
"incompatible types".
Adam correctly surmised that these were probably due to my incorrect use of
syntax for monadic IO:
http://www.impredicative.com/pipermail/ur/2015-July/002065.html
I have now revised the code used in my previous post, and uploaded the
revised code (still not quite working yet - no longer generating errors
regarding monadic IO, but still generating some mismatched tag errors,
etc.) to a new, separate github repo, here:
https://github.com/StefanScott/urweb-crud2foreign-queryL1
The error messages are shown in Issue 1 on that github repo, here:
https://github.com/StefanScott/urweb-crud2foreign-queryL1/issues/1
In this revised version, I have changed the portions which formerly used
'Top.queryX1' (or 'Top.oneRowE1') and 'return' and ';':
Widget = (fn [nm :: Name] =>
statusOptions <-
queryX1 (SELECT Id, Nam FROM status ORDER BY Nam)
(fn r => <xml><coption value={r.Id}>{r.Nam}</coption></xml>);
return;
<xml>
<select{nm}>
{statusOptions}
</select>
</xml>)
Now use 'let val ... in' and 'Top.queryL1' and 'List.MapX':
Widget = (fn [nm :: Name] =>
let
val statusOptionsTxn =
queryL1 (SELECT Id, Nam FROM status ORDER BY Nam)
val statusOptions =
List.MapX
(fn r => <xml><option>{r.Nam}</option></xml>)
statusOptionsTxn
in
<xml>
<select{nm}>
{statusOptions}
</select>
</xml>)
Questions:
(1) Am I heading in the right direction?
(2) I am no longer getting error messages about "unification failure" or
"incompatible types" due to incorrect monadic IO. But I am still getting
some other (less "serious"?) error messages now involving mismatched tags,
eg:
crud2foreign.ur:76:27: (to 76:32) Begin tag <xml> and end tag </option>
don't match.
crud2foreign.ur:76:56: (to 77:30) syntax error: deleting XML_END RPAREN
SYMBOL
crud2foreign.ur:78:8: (to 78:10) syntax error: replacing IN with LBRACE
crud2foreign.ur:83:16: (to 83:18) syntax error: deleting RPAREN COMMA
crud2foreign.ur:85:24: (to 99:13) This is an expression but not a pattern.
crud2foreign.ur:99:12: (to 99:13) syntax error: replacing RPAREN with
UNDER
crud2foreign.ur:105:16: (to 105:58) This is an expression but not a pattern.
crud2foreign.ur:105:27: (to 105:46) This is an expression but not a pattern.
crud2foreign.ur:105:17: (to 105:57) This is an expression but not a pattern.
crud2foreign.ur:105:36: (to 105:45) This is an expression but not a pattern.
crud2foreign.ur:109:16: (to 109:16) syntax error: inserting DARROW
crud2foreign.ur:115:0: (to 115:0) syntax error found at EOF
Note: I recall from an old Ur/Web FAQ that such error messages about
mismatched tags may be misleading (ie, they are actually due to *other*
errors, further down in the code):
http://www.impredicative.com/wiki/index.php/Ur_FAQ
Apparently there are still some errors in my code - perhaps involving
parens, braces, or other delimiters such as 'let ... in ... end' or closing
tags?
Thanks if anyone can provide any insight on these errors involving "mismatched
tag" etc.
###
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20150719/5e73ec3c/attachment.html>
More information about the Ur
mailing list