diff src/cjr_print.sml @ 290:df00701f2323

'read' type class
author Adam Chlipala <adamc@hcoop.net>
date Sun, 07 Sep 2008 11:53:30 -0400
parents 4260ad920c36
children 6e665c7c96f6
line wrap: on
line diff
--- a/src/cjr_print.sml	Sun Sep 07 11:41:04 2008 -0400
+++ b/src/cjr_print.sml	Sun Sep 07 11:53:30 2008 -0400
@@ -520,6 +520,31 @@
                  newline,
                  string "})"]          
         end
+      | ESome (t, e) =>
+        (case #1 t of
+             TDatatype _ => p_exp' par env e
+           | TFfi ("Basis", "string") => p_exp' par env e
+           | _ => box [string "({",
+                       newline,
+                       p_typ env t,
+                       space,
+                       string "*tmp",
+                       space,
+                       string "=",
+                       space,
+                       string "lw_malloc(ctx, sizeof(",
+                       p_typ env t,
+                       string "));",
+                       newline,
+                       string "*tmp",
+                       space,
+                       string "=",
+                       p_exp' par env e,
+                       string ";",
+                       newline,
+                       string "tmp;",
+                       newline,
+                       string "})"])
 
       | EFfi (m, x) => box [string "lw_", string m, string "_", string x]
       | EError (e, t) =>