[m-dev.] std.io.state

Michael Day mcda at students.cs.mu.oz.au
Tue Aug 22 23:27:48 AEST 2000


Would it be possible to define io.state in the future standard library as
follows:

:- type io.state(T) ---> state(c_pointer).

To allow it to be split, using the type system to ensure that it is
combined before main returns?

For example:

:- pred main(io.state(T)::di, io.state(T)::uo).

:- pred split(something::uo, io.state(T)::di, io.state(io.state(T))::uo).

:- pred merge(something::di, io.state(io.state(T))::di, io.state(T)::uo).

In which something is split off from the io.state, manipulated and later
merged back in.

This would require changing the type of main, but is still backwards
compatible, as creating a new std.io does not count as modifying the
current io module.

Michael

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list