[m-rev.] for review: start integrating stream typeclasses into stdlib
Ian MacLarty
maclarty at csse.unimelb.edu.au
Fri Oct 27 10:48:19 AEST 2006
On Thu, Oct 26, 2006 at 04:12:13PM +1000, Julien Fischer wrote:
>
> For review by anyone.
>
> Estimated hours taken: 2
> Branches: main
>
> Start integrating the new stream typeclasses into the rest of the
> standard library.
>
...
> Index: library/io.m
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/library/io.m,v
> retrieving revision 1.361
> diff -u -r1.361 io.m
> --- library/io.m 24 Oct 2006 02:59:46 -0000 1.361
> +++ library/io.m 26 Oct 2006 05:28:29 -0000
> @@ -34,6 +34,7 @@
> :- import_module list.
> :- import_module map.
> :- import_module maybe.
> +:- import_module stream.
> :- import_module string.
> :- import_module time.
> :- import_module univ.
> @@ -1356,6 +1357,41 @@
> :- pred io.error_message(io.error::in, string::out) is det.
>
> %-----------------------------------------------------------------------------%
> +%
> +% Instances of the stream typeclass
> +%
> +
> +:- instance stream.error(io.error).
> +
> +:- instance stream.stream(io.output_stream, io.state).
> +:- instance stream.output(io.output_stream, io.state).
> +:- instance stream.writer(io.output_stream, char, io.state).
> +:- instance stream.writer(io.output_stream, float, io.state).
> +:- instance stream.writer(io.output_stream, int, io.state).
> +:- instance stream.writer(io.output_stream, string, io.state).
> +:- instance stream.writer(io.output_stream, univ, io.state).
> +:- instance stream.line_oriented(io.output_stream, io.state).
> +
> +:- instance stream.stream(io.input_stream, io.state).
> +:- instance stream.input(io.input_stream, io.state, io.error).
> +:- instance stream.reader(io.input_stream, char, io.state, io.error).
> +
> +:- instance stream.line_oriented(io.input_stream, io.state).
> +:- instance stream.putback(io.input_stream, char, io.state, io.error).
> +
> +:- instance stream.stream(io.binary_output_stream, io.state).
> +:- instance stream.output(io.binary_output_stream, io.state).
> +:- instance stream.writer(io.binary_output_stream, int, io.state).
> +:- instance stream.writer(io.binary_output_stream, string, io.state).
> +:- instance stream.seekable(io.binary_output_stream, io.state).
> +
> +:- instance stream.stream(io.binary_input_stream, io.state).
> +:- instance stream.input(io.binary_input_stream, io.state, io.error).
> +:- instance stream.reader(io.binary_input_stream, int, io.state, io.error).
> +:- instance stream.putback(io.binary_input_stream, int, io.state,
> io.error).
> +:- instance stream.seekable(io.binary_input_stream, io.state).
> +
Does using the io equivalence type instead of io.state in these instance
declarations cause problems? I'd prefer it if we could use the
equivalence type to be more consistent with the rest of the io module.
Otherwise that looks fine.
Ian.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list