The TextIO.inputAll function reads the entire input from an input stream, but after doing so endOfStream still returns false.
(* test.sml *)
val s = TextIO.openString "x"
val () = TextIO.print ("endOfStream = " ^ Bool.toString (TextIO.endOfStream s) ^ "\n")
val () = TextIO.print ("inputAll = \"" ^ String.toString (TextIO.inputAll s) ^ "\"\n")
val () = TextIO.print ("endOfStream = " ^ Bool.toString (TextIO.endOfStream s) ^ "\n")
$ mlton test.sml && ./test
endOfStream = false
inputAll = "x"
endOfStream = false
$ poly < test.sml
Poly/ML 5.9.2 Release
endOfStream = false
inputAll = "x"
endOfStream = true
val s = ?: TextIO.instream
$ sml < test.sml
Standard ML of New Jersey [Version 2026.1; 64-bit; March 14, 2026]
- = endOfStream = false
inputAll = "x"
endOfStream = true
val s = - : TextIO.instream
The
TextIO.inputAllfunction reads the entire input from an input stream, but after doing soendOfStreamstill returns false.