15 val exhaust: ('a, 'b) source -> 'a list |
15 val exhaust: ('a, 'b) source -> 'a list |
16 val mapfilter: ('a -> 'b option) -> ('a, 'c) source -> ('b, ('a, 'c) source) source |
16 val mapfilter: ('a -> 'b option) -> ('a, 'c) source -> ('b, ('a, 'c) source) source |
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 of_string: string -> (string, string list) source |
19 val of_string: string -> (string, string list) source |
20 val of_file: string -> (string, string list) source |
20 val of_file: Path.T -> (string, string list) source * Position.T |
21 val decorate_prompt_fn: (string -> string) ref |
21 val decorate_prompt_fn: (string -> string) ref |
22 val of_stream: TextIO.instream -> TextIO.outstream -> (string, unit) source |
22 val of_stream: TextIO.instream -> TextIO.outstream -> (string, unit) source |
23 val tty: (string, unit) source |
23 val tty: (string, unit) source |
24 val source': 'a -> 'b * ('b -> bool) -> ('a * 'b list -> 'c list * ('a * 'b list)) -> |
24 val source': 'a -> 'b * ('b -> bool) -> ('a * 'b list -> 'c list * ('a * 'b list)) -> |
25 ('a * 'b list -> 'd * ('a * 'b list)) option -> |
25 ('a * 'b list -> 'd * ('a * 'b list)) option -> |
106 |
106 |
107 fun drain_list _ xs = (take (limit, xs), drop (limit, xs)); |
107 fun drain_list _ xs = (take (limit, xs), drop (limit, xs)); |
108 |
108 |
109 fun of_list xs = make_source [] xs default_prompt drain_list; |
109 fun of_list xs = make_source [] xs default_prompt drain_list; |
110 val of_string = of_list o explode; |
110 val of_string = of_list o explode; |
111 val of_file = of_string o File.read; |
111 |
|
112 fun of_file raw_path = |
|
113 let val path = Path.expand raw_path |
|
114 in (of_string (File.read path), Position.line_name 1 (quote (Path.pack path))) end; |
112 |
115 |
113 |
116 |
114 (* stream source *) |
117 (* stream source *) |
115 |
118 |
116 val decorate_prompt_fn = ref (fn s:string => s); |
119 val decorate_prompt_fn = ref (fn s:string => s); |