<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/11/8f2ee87fc20d2eebce952ca4abe9d3be"
  from="Oleg Trott &lt;oleg_trott@c...&gt;"
  author="Oleg Trott"
  date="2003-11-12T16:35:25"
  subject="[Caml-list] Big feature wish: IO module"
  prev="2003/11/f0ae170ec3837507642505ac411c4dd9"
  next="2003/11/ec062d9b095199b34afbfec756b70afc"
  prev-thread="2003/11/e8fd0dfd31a596714c76d480bdfae207"
  next-thread="2003/11/ec062d9b095199b34afbfec756b70afc"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Big feature wish: IO module">
<msg 
  url="2003/11/8f2ee87fc20d2eebce952ca4abe9d3be"
  from="Oleg Trott &lt;oleg_trott@c...&gt;"
  author="Oleg Trott"
  date="2003-11-12T16:35:25"
  subject="[Caml-list] Big feature wish: IO module">
</msg>
</thread>

<contents>
I'm very puzzled why after over 10 years, Caml did not acquire something like 
this ("Modern" languages seem to usually have it: Haskell has "read" and 
"show", e.g.)

(*  =========== module IO ================== *)

module type AnyType = sig type t end

type style = Binary | Caml | S_expr | XML

exception Parse_error
exception Type_error

module type S = 
  sig
    type t
    val from_channel: ?style:style -&gt; in_channel -&gt; t
    val from_string   : ?style:style -&gt; string -&gt; t
    val from_buffer  : ?style:style -&gt; string -&gt; int -&gt; t

    val to_channel: ?style:style -&gt; ?detect_sharing:bool -&gt; out_channel -&gt; t 
-&gt; unit
    val to_string: ?style:style -&gt; ?detect_sharing:bool -&gt; t -&gt; string
    val to_buffer: ?style:style -&gt; ?detect_sharing:bool -&gt; t -&gt; string -&gt; 
int-&gt;  int
  end

module Make (Any : AnyType) : S with type t = Any.t

(* ======================================== *)    

No explanation is necessary, I hope. IO module should to be type-safe and 
subsume Marshal and IOXML.

This would, of course, require compiler support, since users can not do type 
introspection, even with Camlp4 (I remember reading some sort of 
pre-announcement about adding type introspection to Camlp4. How is that 
coming along?)

BTW, there is a problem with labeled arguments within module signatures, 
right?

-- 
Oleg Trott &lt;oleg_trott@columbia.edu&gt;

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

