diff src/expl_print.sml @ 45:3c1ce1b4eb3d

Explifying functors
author Adam Chlipala <adamc@hcoop.net>
date Thu, 19 Jun 2008 17:11:24 -0400
parents d16ef24de78b
children 0a5c312de09a
line wrap: on
line diff
--- a/src/expl_print.sml	Thu Jun 19 17:04:08 2008 -0400
+++ b/src/expl_print.sml	Thu Jun 19 17:11:24 2008 -0400
@@ -293,6 +293,30 @@
                               newline,
                               string "end"]
       | SgnVar n => string (#1 (E.lookupSgnNamed env n))
+      | SgnFun (x, n, sgn, sgn') => box [string "functor",
+                                         space,
+                                         string "(",
+                                         string x,
+                                         space,
+                                         string ":",
+                                         space,
+                                         p_sgn env sgn,
+                                         string ")",
+                                         space,
+                                         string ":",
+                                         space,
+                                         p_sgn (E.pushStrNamed env x n sgn) sgn']
+      | SgnWhere (sgn, x, c) => box [p_sgn env sgn,
+                                     space,
+                                     string "where",
+                                     space,
+                                     string "con",
+                                     space,
+                                     string x,
+                                     space,
+                                     string "=",
+                                     space,
+                                     p_con env c]
 
 fun p_decl env ((d, _) : decl) =
     case d of
@@ -349,6 +373,32 @@
       | StrProj (str, s) => box [p_str env str,
                                  string ".",
                                  string s]
+      | StrFun (x, n, sgn, sgn', str) =>
+        let
+            val env' = E.pushStrNamed env x n sgn
+        in
+            box [string "functor",
+                 space,
+                 string "(",
+                 string x,
+                 space,
+                 string ":",
+                 space,
+                 p_sgn env sgn,
+                 string ")",
+                 space,
+                 string ":",
+                 space,
+                 p_sgn env' sgn',
+                 space,
+                 string "=>",
+                 space,
+                 p_str env' str]
+        end
+      | StrApp (str1, str2) => box [p_str env str1,
+                                    string "(",
+                                    p_str env str2,
+                                    string ")"]
 
 and p_file env file =
     let