Mercurial > urweb
changeset 582:66463006f893
Source containing an int
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 01 Jan 2009 10:08:22 -0500 |
parents | e955d50c389d |
children | 1fd4c041634e |
files | jslib/urweb.js src/jscomp.sml src/prim.sml tests/stypes.ur tests/stypes.urp |
diffstat | 5 files changed, 18 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/jslib/urweb.js Tue Dec 30 16:11:29 2008 -0500 +++ b/jslib/urweb.js Thu Jan 01 10:08:22 2009 -0500 @@ -40,3 +40,5 @@ document.body.appendChild(x); s.h = cons(function() { x.innerHTML = s.v }, s.h); } + +function ts(x) { return x.toString() }
--- a/src/jscomp.sml Tue Dec 30 16:11:29 2008 -0500 +++ b/src/jscomp.sml Thu Jan 01 10:08:22 2009 -0500 @@ -34,6 +34,7 @@ structure U = MonoUtil val funcs = [(("Basis", "alert"), "alert"), + (("Basis", "htmlifyInt"), "ts"), (("Basis", "htmlifyString"), "escape"), (("Basis", "new_client_source"), "sc"), (("Basis", "set_client_source"), "sv")]
--- a/src/prim.sml Tue Dec 30 16:11:29 2008 -0500 +++ b/src/prim.sml Thu Jan 01 10:08:22 2009 -0500 @@ -47,6 +47,12 @@ else Int64.toString n ^ "LL" +fun int2s' n = + if Int64.compare (n, Int64.fromInt 0) = LESS then + "-" ^ Int64.toString (Int64.~ n) + else + Int64.toString n + fun float2s n = if Real64.compare (n, Real64.fromInt 0) = LESS then "-" ^ Real64.toString (Real64.~ n) @@ -55,7 +61,7 @@ fun toString t = case t of - Int n => int2s n + Int n => int2s' n | Float n => float2s n | String s => s
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/stypes.ur Thu Jan 01 10:08:22 2009 -0500 @@ -0,0 +1,5 @@ +fun main () : transaction page = + sInt <- source 0; + return <xml><body> + <dyn signal={n <- signal sInt; return <xml>{[n]}</xml>}/> <a onclick={set sInt 1}>Change</a><br/> + </body></xml>