module IOO: sig endTheses OO Wrappers have been written to provide easy support of ExtLib IO by external librairies. If you want your library to support ExtLib IO without actually requiring ExtLib to compile, you have two choices :
You can implement classes having the same signatures as o_input and
o_output, then the ExtLib user will be able to create an IO using
from_in and from_out functions. Theses classes are providing the
same facilities than IO, and are then following the same specification.
You can also implement the classes in_channel, out_channel,
poly_in_channel and/or poly_out_channel which are the common IO
specifications established for ExtLib, OCamlNet and Camomile. It
provides a more generic interface, but with less features.
class [('a, 'b)] o_input :('a, 'b) IO.input -> object end
class [('a, 'b, 'c)] o_output :('a, 'b, 'c) IO.output -> object end
val from_in : ('a, 'b) #o_input -> ('a, 'b) IO.inputval from_out : ('a, 'b, 'c) #o_output -> ('a, 'b, 'c) IO.output
Generic IO Object Wrappers
|
class in_channel : ('a, string) IO.input -> object endclass out_channel : ('a, string, 'b) IO.output -> object endclass ['a] poly_in_channel :('a, 'b) IO.input -> object end
class ['a] poly_out_channel :('a, 'b, 'c) IO.output -> object end
val from_in_channel : #in_channel -> (char, string) IO.inputval from_out_channel : #out_channel -> (char, string, unit) IO.outputval from_poly_in_channel : 'a #poly_in_channel -> ('a, 'a list) IO.inputval from_str_in_channel : char #poly_in_channel -> (char, string) IO.inputval from_poly_out_channel : 'a #poly_out_channel -> ('a, 'a list, unit) IO.outputval from_str_out_channel : char #poly_out_channel -> (char, string, unit) IO.output