17 val filter: ('a -> bool) -> ('a, 'b) source -> ('a, ('a, 'b) source) source |
17 val filter: ('a -> bool) -> ('a, 'b) source -> ('a, ('a, 'b) source) source |
18 val of_list: 'a list -> ('a, 'a list) source |
18 val of_list: 'a list -> ('a, 'a list) source |
19 val exhausted: ('a, 'b) source -> ('a, 'a list) source |
19 val exhausted: ('a, 'b) source -> ('a, 'a list) source |
20 val of_string: string -> (string, string list) source |
20 val of_string: string -> (string, string list) source |
21 val of_string_limited: int -> string -> (string, substring) source |
21 val of_string_limited: int -> string -> (string, substring) source |
22 val tty: (string, unit) source |
22 val tty: TextIO.instream -> (string, unit) source |
23 val source': 'a -> 'b Scan.stopper -> ('a * 'b list -> 'c list * ('a * 'b list)) -> |
23 val source': 'a -> 'b Scan.stopper -> ('a * 'b list -> 'c list * ('a * 'b list)) -> |
24 (bool * (string -> 'a * 'b list -> 'c list * ('a * 'b list))) option -> |
24 (bool * (string -> 'a * 'b list -> 'c list * ('a * 'b list))) option -> |
25 ('b, 'e) source -> ('c, 'a * ('b, 'e) source) source |
25 ('b, 'e) source -> ('c, 'a * ('b, 'e) source) source |
26 val source: 'a Scan.stopper -> ('a list -> 'b list * 'a list) -> |
26 val source: 'a Scan.stopper -> ('a list -> 'b list * 'a list) -> |
27 (bool * (string -> 'a list -> 'b list * 'a list)) option -> |
27 (bool * (string -> 'a list -> 'b list * 'a list)) option -> |
127 NONE => [] |
127 NONE => [] |
128 | SOME 0 => [] |
128 | SOME 0 => [] |
129 | SOME _ => TextIO.input instream :: slurp ()); |
129 | SOME _ => TextIO.input instream :: slurp ()); |
130 in maps explode (slurp ()) end; |
130 in maps explode (slurp ()) end; |
131 |
131 |
132 val tty = make_source [] () default_prompt (fn prompt => fn () => |
132 fun tty in_stream = make_source [] () default_prompt (fn prompt => fn () => |
133 let val input = slurp_input TextIO.stdIn in |
133 let val input = slurp_input in_stream in |
134 if exists (fn c => c = "\n") input then (input, ()) |
134 if exists (fn c => c = "\n") input then (input, ()) |
135 else |
135 else |
136 (case (Output.prompt prompt; TextIO.inputLine TextIO.stdIn) of |
136 (case (Output.prompt prompt; TextIO.inputLine in_stream) of |
137 SOME line => (input @ explode line, ()) |
137 SOME line => (input @ explode line, ()) |
138 | NONE => (input, ())) |
138 | NONE => (input, ())) |
139 end); |
139 end); |
140 |
140 |
141 |
141 |