diff src/monoize.sml @ 185:19ee24bffbc0

FFI datatypes
author Adam Chlipala <adamc@hcoop.net>
date Sun, 03 Aug 2008 17:57:47 -0400
parents c0ea24dcb86f
children 88d46972de53
line wrap: on
line diff
--- a/src/monoize.sml	Sun Aug 03 16:53:13 2008 -0400
+++ b/src/monoize.sml	Sun Aug 03 17:57:47 2008 -0400
@@ -156,7 +156,13 @@
     end
 
 end
-                
+
+
+fun capitalize s =
+    if s = "" then
+        s
+    else
+        str (Char.toUpper (String.sub (s, 0))) ^ String.extract (s, 1, NONE)
 
 fun fooifyExp fk env =
     let
@@ -193,9 +199,7 @@
                 end
               | _ =>
                 case t of
-                    L'.TFfi ("Basis", "string") => ((L'.EFfiApp ("Basis", fk2s fk ^ "ifyString", [e]), loc), fm)
-                  | L'.TFfi ("Basis", "int") => ((L'.EFfiApp ("Basis", fk2s fk ^ "ifyInt", [e]), loc), fm)
-                  | L'.TFfi ("Basis", "float") => ((L'.EFfiApp ("Basis", fk2s fk ^ "ifyFloat", [e]), loc), fm)
+                    L'.TFfi (m, x) => ((L'.EFfiApp (m, fk2s fk ^ "ify" ^ capitalize x, [e]), loc), fm)
                   | L'.TRecord [] => ((L'.EPrim (Prim.String ""), loc), fm)
 
                   | L'.TDatatype (i, _) =>
@@ -306,7 +310,7 @@
             L.EPrim p => ((L'.EPrim p, loc), fm)
           | L.ERel n => ((L'.ERel n, loc), fm)
           | L.ENamed n => ((L'.ENamed n, loc), fm)
-          | L.ECon (n, eo) =>
+          | L.ECon (pc, eo) =>
             let
                 val (eo, fm) =
                     case eo of
@@ -318,7 +322,7 @@
                             (SOME e, fm)
                         end
             in
-                ((L'.ECon (n, eo), loc), fm)
+                ((L'.ECon (monoPatCon pc, eo), loc), fm)
             end
           | L.EFfi mx => ((L'.EFfi mx, loc), fm)
           | L.EFfiApp (m, x, es) =>
@@ -416,7 +420,8 @@
 
                                           val fooify =
                                               case x of
-                                                  "Link" => urlifyExp
+                                                  "Href" => urlifyExp
+                                                | "Link" => urlifyExp
                                                 | "Action" => urlifyExp
                                                 | _ => attrifyExp