1signature TextIO =
2sig
3  type instream
4  type outstream
5  val stdOut : outstream
6  val stdErr : outstream
7  val openIn : string -> instream
8  val closeIn : instream -> unit
9
10  val inputLine : instream -> string option
11  val output : outstream * string -> unit
12end
13
14
15structure TextIO :> TextIO =
16struct
17  open TextIO
18  fun inputLine s =
19      case TextIO.inputLine s of
20        "" => NONE
21      | s => SOME s
22end
23