[MLton-commit] r6160
Vesa Karvonen
vesak at mlton.org
Mon Nov 12 12:44:29 PST 2007
Added readFile and writeFile for convenience.
----------------------------------------------------------------------
U mltonlib/trunk/com/ssh/extended-basis/unstable/detail/io/text-io.sml
U mltonlib/trunk/com/ssh/extended-basis/unstable/public/io/text-io.sig
----------------------------------------------------------------------
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/io/text-io.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/io/text-io.sml 2007-11-10 21:26:54 UTC (rev 6159)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/io/text-io.sml 2007-11-12 20:44:28 UTC (rev 6160)
@@ -9,4 +9,12 @@
fun println s =
(output (stdOut, s) ; output1 (stdOut, #"\n") ; flushOut stdOut)
+
+ fun readFile file =
+ case openIn file
+ of s => Exn.after (fn () => inputAll s, fn () => closeIn s)
+
+ fun writeFile {file, data} =
+ case openOut file
+ of s => Exn.after (fn () => output (s, data), fn () => closeOut s)
end
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/io/text-io.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/io/text-io.sig 2007-11-10 21:26:54 UTC (rev 6159)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/io/text-io.sig 2007-11-12 20:44:28 UTC (rev 6160)
@@ -18,4 +18,10 @@
*
*> (output (stdOut, s) ; output1 (stdOut, #"\n") ; flushOut stdOut)
*)
+
+ val readFile : String.t -> vector
+ (** Reads all data from the specified file. *)
+
+ val writeFile : {file : String.t, data : vector} Effect.t
+ (** Overwrites the specified file with the specified data. *)
end
More information about the MLton-commit
mailing list