:- module stream.
:- interface.
:- import_module bool.
:- import_module char.
:- import_module list.
:- include_module (stream.string_writer).
:- type name == string.
:- type whence
	--->	set 
	;	cur 
	;	end .
:- type res(Error)
	--->	ok 
	;	error(Error).
:- type result(Error)
	--->	ok 
	;	eof 
	;	error(Error).
:- type maybe_partial_res(T, Error)
	--->	ok(T)
	;	error(T, Error).
:- type res(T, Error)
	--->	ok(T)
	;	error(Error).
:- type result(T, Error)
	--->	ok(T)
	;	eof 
	;	error(Error).
:- mode (bulk_get_di) == (builtin.in).
:- mode (bulk_get_uo) == (builtin.out).
:- typeclass error(Error).
:- typeclass stream(Stream, State) <= ((Stream -> State)).
:- typeclass duplex(Stream, State) <= (stream.input(Stream, State), stream.output(Stream, State)).
:- typeclass reader(Stream, Unit, State, Error) <= ((Stream, Unit -> Error), stream.input(Stream, State), stream.error(Error)).
:- typeclass bulk_reader(Stream, Index, Store, State, Error) <= ((Stream, Index, Store -> Error), stream.input(Stream, State), stream.error(Error)).
:- typeclass writer(Stream, Unit, State) <= (stream.output(Stream, State)).
:- typeclass unbounded_putback(Stream, Unit, State, Error) <= (stream.putback(Stream, Unit, State, Error)).
:- typeclass putback(Stream, Unit, State, Error) <= (stream.reader(Stream, Unit, State, Error)).
:- typeclass input(Stream, State) <= (stream.stream(Stream, State)).
:- typeclass line_oriented(Stream, State) <= (stream.stream(Stream, State)).
:- typeclass output(Stream, State) <= (stream.stream(Stream, State)).
:- typeclass seekable(Stream, State) <= (stream.stream(Stream, State)).
