> > I had a look at it but it's a different approach than my proposal.
> > actually restricting the IO's to char/string IO while I'm proposing to
> > generics IO that can write/read anything ( chars and strings, but also
> > tokens, lists, ... ).
> Ok, I had a quick look. I think,
> 1) Output channels lack flush operation. Is that ok?
> 2) There would be pros and cons, but maybe objects (not abstract
> types) are more fitted to channels. It makes extension easier, for
I don't see how it makes extension easier. Rewriting the basic functions
inside an object or passing them to IO.create_in/out is slighty the same,
except that object method lookup is more expensive. But I'm not against
adding an OO wrapper to the IO module for people who prefers using objects.
> 3) I'd like to see filter type.
Can you explain more ?
I thing that it would be nice to add something like a pipe :
IO.pipe : () -> ('a,'b) input * ('a,'b,unit) output
> (Btw, If you attachs sources as Text/Plain, not
> Application/Octetstream, then it makes viewing more easier.)
Here's a copy/paste of IO.mli , since some people are reading directly from
the archives it's maybe better since attachments are discarded.
I wanted to commit but looks like I can't checkout the CVS in developper
mode (only anonymous). I'll try later.
----------- IO.mli --------------------
type ('a, 'b) input
type ('a, 'b, 'c) output
val default_available : unit -> 'a option
val default_close : unit -> unit
val create_in :
read:(unit -> 'a) ->
nread:(int -> 'b) ->
available:(unit -> int option) -> close:(unit -> unit) -> ('a, 'b) input
val create_out :
write:('a -> unit) ->
nwrite:('b -> unit) ->
flush:(unit -> unit) -> close:(unit -> 'c) -> ('a, 'b, 'c) output
val read : ('a, 'b) input -> 'a
val nread : ('a, 'b) input -> int -> 'b
val available : ('a, 'b) input -> int option
val close_in : ('a, 'b) input -> unit
val write : ('a, 'b, 'c) output -> 'a -> unit
val nwrite : ('a, 'b, 'c) output -> 'b -> unit
val printf : ('a, string, 'b) output -> ('c, unit, string, unit) format4 ->
val flush : ('a, 'b, 'c) output -> unit
val close_out : ('a, 'b, 'c) output -> 'c
val input_string : string -> (char, string) input
val output_string : unit -> (char, string, string) output
val input_channel : in_channel -> (char, string) input
val output_channel : out_channel -> (char, string, unit) output
val input_enum : 'a Enum.t -> ('a, 'a Enum.t) input
val output_enum : unit -> ('a, 'a Enum.t, 'a Enum.t) output