From 5e95ccda9544c96b519d2cf6b32967f4b1ef990a Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Thu, 6 Nov 2008 12:46:45 -0500 Subject: Cookie prose; fix bugs that broke demo compilation --- demo/cookie.ur | 29 ++++++++++++----------------- demo/prose | 6 ++++++ src/mono_reduce.sml | 5 +++-- src/monoize.sml | 6 +----- 4 files changed, 22 insertions(+), 24 deletions(-) diff --git a/demo/cookie.ur b/demo/cookie.ur index 02f4cab5..ad4e19ec 100644 --- a/demo/cookie.ur +++ b/demo/cookie.ur @@ -6,21 +6,16 @@ fun set r = fun main () = ro <- getCookie c; - let - val xml = case ro of - None => No cookie set. - | Some v => Cookie: A = {[v.A]}, B = {[v.B]}, C = {[v.C]} - in - return - {xml}

- -
- A:
- B:
- C:
- - -
- end - + return + {case ro of + None => No cookie set. + | Some v => Cookie: A = {[v.A]}, B = {[v.B]}, C = {[v.C]}} +

+
+ A:
+ B:
+ C:
+ + +
diff --git a/demo/prose b/demo/prose index 06c47722..fad98e26 100644 --- a/demo/prose +++ b/demo/prose @@ -58,6 +58,12 @@ nested.urp

Here is an implementation of the tiny challenge problem from this web framework comparison. Using nested function definitions, it is easy to persist state across clicks.

+cookie.urp + +

Often, it is useful to associate persistent data with particular web clients. Ur/Web includes an easy facility for using type-safe cookies. This example shows how to use a form to set a named cookie.

+ +

After setting the cookie, try browsing back to this demo from the main index. The data you entered should still be there.

+ listShop.urp

This example shows off algebraic datatypes, parametric polymorphism, and functors.

diff --git a/src/mono_reduce.sml b/src/mono_reduce.sml index 3c4ac0df..bf68f175 100644 --- a/src/mono_reduce.sml +++ b/src/mono_reduce.sml @@ -352,9 +352,10 @@ fun exp env e = (EApp (b, liftExpInExp 0 e'), loc)), loc)) | ELet (x, t, e', (EAbs (x', t' as (TRecord [], _), ran, e''), loc)) => - if impure e' then + (*if impure e' then e - else + else*) + (* Seems unsound in general without the check... should revisit later *) EAbs (x', t', ran, (ELet (x, t, liftExpInExp 0 e', swapExpVars 0 e''), loc)) | ELet (x, t, e', b) => diff --git a/src/monoize.sml b/src/monoize.sml index b8c3a6a9..20677816 100644 --- a/src/monoize.sml +++ b/src/monoize.sml @@ -1565,13 +1565,9 @@ fun monoExp (env, st, fm) (all as (e, loc)) = | L.EFfiApp ("Basis", "nextval", [e]) => let - val un = (L'.TRecord [], loc) - val int = (L'.TFfi ("Basis", "int"), loc) val (e, fm) = monoExp (env, st, fm) e in - ((L'.EAbs ("_", un, int, - (L'.ENextval (liftExpInExp 0 e), loc)), loc), - fm) + ((L'.ENextval e, loc), fm) end | L.EApp ( -- cgit v1.2.3