Import Upstream version 20180207
[hcoop/debian/mlton.git] / lib / mlton / basic / instream.sig
CommitLineData
7f918cf1
CE
1(* Copyright (C) 2009 Matthew Fluet.
2 * Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
3 * Jagannathan, and Stephen Weeks.
4 *
5 * MLton is released under a BSD-style license.
6 * See the file MLton-LICENSE for details.
7 *)
8
9signature INSTREAM =
10 sig
11 type t
12
13 val close: t -> unit
14 val endOf: t -> bool
15 val foldChars: t * 'a * (char * 'a -> 'a) -> 'a
16 (* Each line includes the newline. *)
17 val foldLines: t * 'a * (string * 'a -> 'a) -> 'a
18 val foreachLine: t * (string -> unit) -> unit
19 val ignoreSpaces: t -> unit
20 val input: t -> string
21 val inputAll: t -> string
22 val inputChar: t -> char option
23 val inputLine: t -> string option
24 val inputN: t * int -> string
25 val inputNothing: t -> unit
26 (* inputTo(i, p) inputs up to but not including the first char
27 * that satisfies p.
28 *)
29 val inputTo: t * (char -> bool) -> string
30 val inputToChar: t * char -> string
31 val inputToSpace: t -> string
32 val layout: t -> Layout.t
33 (* Each line includes the newline. *)
34 val lines: t -> string list
35 val openIn: string -> t
36 val openString: string -> t
37 val outputAll: t * Out.t -> unit
38 val peekChar: t -> char option
39 val sameContents: t * t -> bool
40(* val set: t * t -> unit *)
41 val standard: t
42 val withClose: t * (t -> 'a) -> 'a
43 val withNull: (t -> 'a) -> 'a
44 end