tuned signature;
authorwenzelm
Sun, 11 Apr 2021 21:32:09 +0200
changeset 73558 a5d1d1e2f109
parent 73557 225486d9c960
child 73559 22b5ecb53dd9
tuned signature;
src/Pure/PIDE/byte_message.ML
src/Pure/ROOT.ML
src/Pure/System/message_channel.ML
--- a/src/Pure/PIDE/byte_message.ML	Sun Apr 11 21:23:51 2021 +0200
+++ b/src/Pure/PIDE/byte_message.ML	Sun Apr 11 21:32:09 2021 +0200
@@ -7,6 +7,7 @@
 signature BYTE_MESSAGE =
 sig
   val write: BinIO.outstream -> string list -> unit
+  val write_yxml: BinIO.outstream -> XML.tree -> unit
   val flush: BinIO.outstream -> unit
   val write_line: BinIO.outstream -> string -> unit
   val read: BinIO.instream -> int -> string
@@ -25,6 +26,8 @@
 
 fun write stream = List.app (File.output stream);
 
+fun write_yxml stream tree = YXML.traverse (fn s => fn () => File.output stream s) tree ();
+
 fun flush stream = ignore (try BinIO.flushOut stream);
 
 fun write_line stream s = (write stream [s, "\n"]; flush stream);
--- a/src/Pure/ROOT.ML	Sun Apr 11 21:23:51 2021 +0200
+++ b/src/Pure/ROOT.ML	Sun Apr 11 21:32:09 2021 +0200
@@ -88,8 +88,8 @@
 ML_file "General/timing.ML";
 ML_file "General/sha1.ML";
 
+ML_file "PIDE/yxml.ML";
 ML_file "PIDE/byte_message.ML";
-ML_file "PIDE/yxml.ML";
 ML_file "PIDE/protocol_message.ML";
 ML_file "PIDE/document_id.ML";
 
--- a/src/Pure/System/message_channel.ML	Sun Apr 11 21:23:51 2021 +0200
+++ b/src/Pure/System/message_channel.ML	Sun Apr 11 21:32:09 2021 +0200
@@ -48,7 +48,7 @@
     and received _ (NONE :: _) = Byte_Message.flush stream
       | received _ (SOME (Message {body, flush}) :: rest) =
           let
-            val _ = fold (YXML.traverse (fn s => fn () => File.output stream s)) body ();
+            val _ = List.app (Byte_Message.write_yxml stream) body;
             val timeout = if flush then (Byte_Message.flush stream; NONE) else flush_timeout;
           in received timeout rest end
       | received timeout [] = continue timeout;