eliminated some obscure higher-order arguments
authorhaftmann
Mon Aug 30 16:17:10 2010 +0200 (2010-08-30)
changeset 38912c79c1e4e1111
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
     1.1 --- a/src/Tools/Code/code_haskell.ML	Mon Aug 30 16:11:09 2010 +0200
     1.2 +++ b/src/Tools/Code/code_haskell.ML	Mon Aug 30 16:17:10 2010 +0200
     1.3 @@ -315,7 +315,7 @@
     1.4  
     1.5  fun serialize_haskell module_prefix module_name string_classes labelled_name
     1.6      raw_reserved includes module_alias
     1.7 -    syntax_class syntax_tyco syntax_const (code_of_pretty, code_writeln) program
     1.8 +    syntax_class syntax_tyco syntax_const program
     1.9      (stmt_names, presentation_stmt_names) width =
    1.10    let
    1.11      val reserved = fold (insert (op =) o fst) includes raw_reserved;
    1.12 @@ -377,7 +377,7 @@
    1.13        if null presentation_stmt_names then serialize_module1 else pair "" o serialize_module2;
    1.14      fun check_destination destination =
    1.15        (File.check destination; destination);
    1.16 -    fun write_module destination (modlname, content) =
    1.17 +    fun write_module width destination (modlname, content) =
    1.18        let
    1.19          val filename = case modlname
    1.20           of "" => Path.explode "Main.hs"
    1.21 @@ -387,13 +387,13 @@
    1.22          val _ = File.mkdir_leaf (Path.dir pathname);
    1.23        in File.write pathname
    1.24          ("{-# OPTIONS_GHC -fglasgow-exts #-}\n\n"
    1.25 -          ^ code_of_pretty content)
    1.26 +          ^ string_of_pretty width content)
    1.27        end
    1.28    in
    1.29      Code_Target.mk_serialization
    1.30 -      (fn width => (fn NONE => K () o map (code_writeln o snd)
    1.31 -        | SOME file => K () o map (write_module (check_destination file))))
    1.32 -      (fn width => (rpair [] o cat_lines o map (code_of_pretty o snd)))
    1.33 +      (fn width => (fn NONE => K () o map (writeln_pretty width o snd)
    1.34 +        | SOME file => K () o map (write_module width (check_destination file))))
    1.35 +      (fn width => (rpair [] o cat_lines o map (string_of_pretty width o snd)))
    1.36        (map (uncurry print_module) includes
    1.37          @ map serialize_module (Symtab.dest hs_program))
    1.38        width
     2.1 --- a/src/Tools/Code/code_ml.ML	Mon Aug 30 16:11:09 2010 +0200
     2.2 +++ b/src/Tools/Code/code_ml.ML	Mon Aug 30 16:17:10 2010 +0200
     2.3 @@ -907,7 +907,7 @@
     2.4    in (deresolver, nodes) end;
     2.5  
     2.6  fun serialize_ml target print_module print_stmt module_name with_signatures labelled_name
     2.7 -  reserved includes module_alias _ syntax_tyco syntax_const (code_of_pretty, code_writeln) program
     2.8 +  reserved includes module_alias _ syntax_tyco syntax_const program
     2.9    (stmt_names, presentation_stmt_names) width =
    2.10    let
    2.11      val is_cons = Code_Thingol.is_cons program;
    2.12 @@ -936,8 +936,8 @@
    2.13      val p = Pretty.chunks2 (map snd includes @ snd (print_nodes [] nodes));
    2.14    in
    2.15      Code_Target.mk_serialization
    2.16 -      (fn width => (fn NONE => code_writeln | SOME file => File.write file o code_of_pretty))
    2.17 -      (fn width => (rpair stmt_names' o code_of_pretty)) p width 
    2.18 +      (fn width => (fn NONE => writeln_pretty width | SOME file => File.write file o string_of_pretty width))
    2.19 +      (fn width => (rpair stmt_names' o string_of_pretty width)) p width 
    2.20    end;
    2.21  
    2.22  end; (*local*)
     3.1 --- a/src/Tools/Code/code_scala.ML	Mon Aug 30 16:11:09 2010 +0200
     3.2 +++ b/src/Tools/Code/code_scala.ML	Mon Aug 30 16:17:10 2010 +0200
     3.3 @@ -414,7 +414,7 @@
     3.4    in (deresolver, sca_program) end;
     3.5  
     3.6  fun serialize_scala labelled_name raw_reserved includes module_alias
     3.7 -    _ syntax_tyco syntax_const (code_of_pretty, code_writeln)
     3.8 +    _ syntax_tyco syntax_const
     3.9      program (stmt_names, presentation_stmt_names) width =
    3.10    let
    3.11  
    3.12 @@ -482,8 +482,8 @@
    3.13      val p = Pretty.chunks2 (p_includes @ the_list (print_nodes [] sca_program));
    3.14    in
    3.15      Code_Target.mk_serialization
    3.16 -      (fn width => (fn NONE => code_writeln | SOME file => File.write file o code_of_pretty))
    3.17 -      (fn width => (rpair [] o code_of_pretty)) p width
    3.18 +      (fn width => (fn NONE => writeln_pretty width | SOME file => File.write file o string_of_pretty width))
    3.19 +      (rpair [] oo string_of_pretty) p width
    3.20    end;
    3.21  
    3.22  end; (*local*)
     4.1 --- a/src/Tools/Code/code_target.ML	Mon Aug 30 16:11:09 2010 +0200
     4.2 +++ b/src/Tools/Code/code_target.ML	Mon Aug 30 16:17:10 2010 +0200
     4.3 @@ -110,7 +110,6 @@
     4.4    -> (string -> string option)          (*class syntax*)
     4.5    -> (string -> Code_Printer.tyco_syntax option)
     4.6    -> (string -> Code_Printer.activated_const_syntax option)
     4.7 -  -> ((Pretty.T -> string) * (Pretty.T -> unit))
     4.8    -> Code_Thingol.program
     4.9    -> (string list * string list)        (*selected statements*)
    4.10    -> int
    4.11 @@ -282,7 +281,6 @@
    4.12      serializer module_name args (Code_Thingol.labelled_name thy program2) reserved includes
    4.13        (if is_some module_name then K module_name else Symtab.lookup module_alias)
    4.14        (Symtab.lookup class') (Symtab.lookup tyco') (Symtab.lookup const')
    4.15 -      (Code_Printer.string_of_pretty width, Code_Printer.writeln_pretty width)
    4.16        program4 (names1, presentation_names) width
    4.17    end;
    4.18