eliminated some obscure higher-order arguments
authorhaftmann
Mon, 30 Aug 2010 16:17:10 +0200
changeset 38912 c79c1e4e1111
parent 38911 caba168a3039
child 38913 d1d4d808be26
eliminated some obscure higher-order arguments
src/Tools/Code/code_haskell.ML
src/Tools/Code/code_ml.ML
src/Tools/Code/code_scala.ML
src/Tools/Code/code_target.ML
--- a/src/Tools/Code/code_haskell.ML	Mon Aug 30 16:11:09 2010 +0200
+++ b/src/Tools/Code/code_haskell.ML	Mon Aug 30 16:17:10 2010 +0200
@@ -315,7 +315,7 @@
 
 fun serialize_haskell module_prefix module_name string_classes labelled_name
     raw_reserved includes module_alias
-    syntax_class syntax_tyco syntax_const (code_of_pretty, code_writeln) program
+    syntax_class syntax_tyco syntax_const program
     (stmt_names, presentation_stmt_names) width =
   let
     val reserved = fold (insert (op =) o fst) includes raw_reserved;
@@ -377,7 +377,7 @@
       if null presentation_stmt_names then serialize_module1 else pair "" o serialize_module2;
     fun check_destination destination =
       (File.check destination; destination);
-    fun write_module destination (modlname, content) =
+    fun write_module width destination (modlname, content) =
       let
         val filename = case modlname
          of "" => Path.explode "Main.hs"
@@ -387,13 +387,13 @@
         val _ = File.mkdir_leaf (Path.dir pathname);
       in File.write pathname
         ("{-# OPTIONS_GHC -fglasgow-exts #-}\n\n"
-          ^ code_of_pretty content)
+          ^ string_of_pretty width content)
       end
   in
     Code_Target.mk_serialization
-      (fn width => (fn NONE => K () o map (code_writeln o snd)
-        | SOME file => K () o map (write_module (check_destination file))))
-      (fn width => (rpair [] o cat_lines o map (code_of_pretty o snd)))
+      (fn width => (fn NONE => K () o map (writeln_pretty width o snd)
+        | SOME file => K () o map (write_module width (check_destination file))))
+      (fn width => (rpair [] o cat_lines o map (string_of_pretty width o snd)))
       (map (uncurry print_module) includes
         @ map serialize_module (Symtab.dest hs_program))
       width
--- a/src/Tools/Code/code_ml.ML	Mon Aug 30 16:11:09 2010 +0200
+++ b/src/Tools/Code/code_ml.ML	Mon Aug 30 16:17:10 2010 +0200
@@ -907,7 +907,7 @@
   in (deresolver, nodes) end;
 
 fun serialize_ml target print_module print_stmt module_name with_signatures labelled_name
-  reserved includes module_alias _ syntax_tyco syntax_const (code_of_pretty, code_writeln) program
+  reserved includes module_alias _ syntax_tyco syntax_const program
   (stmt_names, presentation_stmt_names) width =
   let
     val is_cons = Code_Thingol.is_cons program;
@@ -936,8 +936,8 @@
     val p = Pretty.chunks2 (map snd includes @ snd (print_nodes [] nodes));
   in
     Code_Target.mk_serialization
-      (fn width => (fn NONE => code_writeln | SOME file => File.write file o code_of_pretty))
-      (fn width => (rpair stmt_names' o code_of_pretty)) p width 
+      (fn width => (fn NONE => writeln_pretty width | SOME file => File.write file o string_of_pretty width))
+      (fn width => (rpair stmt_names' o string_of_pretty width)) p width 
   end;
 
 end; (*local*)
--- a/src/Tools/Code/code_scala.ML	Mon Aug 30 16:11:09 2010 +0200
+++ b/src/Tools/Code/code_scala.ML	Mon Aug 30 16:17:10 2010 +0200
@@ -414,7 +414,7 @@
   in (deresolver, sca_program) end;
 
 fun serialize_scala labelled_name raw_reserved includes module_alias
-    _ syntax_tyco syntax_const (code_of_pretty, code_writeln)
+    _ syntax_tyco syntax_const
     program (stmt_names, presentation_stmt_names) width =
   let
 
@@ -482,8 +482,8 @@
     val p = Pretty.chunks2 (p_includes @ the_list (print_nodes [] sca_program));
   in
     Code_Target.mk_serialization
-      (fn width => (fn NONE => code_writeln | SOME file => File.write file o code_of_pretty))
-      (fn width => (rpair [] o code_of_pretty)) p width
+      (fn width => (fn NONE => writeln_pretty width | SOME file => File.write file o string_of_pretty width))
+      (rpair [] oo string_of_pretty) p width
   end;
 
 end; (*local*)
--- a/src/Tools/Code/code_target.ML	Mon Aug 30 16:11:09 2010 +0200
+++ b/src/Tools/Code/code_target.ML	Mon Aug 30 16:17:10 2010 +0200
@@ -110,7 +110,6 @@
   -> (string -> string option)          (*class syntax*)
   -> (string -> Code_Printer.tyco_syntax option)
   -> (string -> Code_Printer.activated_const_syntax option)
-  -> ((Pretty.T -> string) * (Pretty.T -> unit))
   -> Code_Thingol.program
   -> (string list * string list)        (*selected statements*)
   -> int
@@ -282,7 +281,6 @@
     serializer module_name args (Code_Thingol.labelled_name thy program2) reserved includes
       (if is_some module_name then K module_name else Symtab.lookup module_alias)
       (Symtab.lookup class') (Symtab.lookup tyco') (Symtab.lookup const')
-      (Code_Printer.string_of_pretty width, Code_Printer.writeln_pretty width)
       program4 (names1, presentation_names) width
   end;