<?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="2009/10/87470a289690e18edbff126b5a7a8ac3"
  from="Yaron Minsky &lt;yminsky@g...&gt;"
  author="Yaron Minsky"
  date="2009-10-09T01:53:44"
  subject="Re: Improving OCaml&apos;s choice of type to display"
  prev="2009/10/16051196b9d9c0d5bf42b865d44384e1"
  next="2009/10/1b087dcc1f0f6132c02c68dbbb67bc95"
  prev-in-thread="2009/10/16051196b9d9c0d5bf42b865d44384e1"
  next-in-thread="2009/10/0bc68c82ed4a6bba68f2636134143811"
  prev-thread="2009/10/cc30b4a069b2db9ebf8f94287b328051"
  next-thread="2009/10/1b087dcc1f0f6132c02c68dbbb67bc95"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/16051196b9d9c0d5bf42b865d44384e1"
  from="Yaron Minsky &lt;yminsky@g...&gt;"
  author="Yaron Minsky"
  date="2009-10-09T01:40:28"
  subject="Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/87470a289690e18edbff126b5a7a8ac3"
  from="Yaron Minsky &lt;yminsky@g...&gt;"
  author="Yaron Minsky"
  date="2009-10-09T01:53:44"
  subject="Re: Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/0bc68c82ed4a6bba68f2636134143811"
  from="Jun Furuse &lt;jun.furuse@g...&gt;"
  author="Jun Furuse"
  date="2009-10-11T14:57:19"
  subject="Re: [Caml-list] Re: Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/8349209de209281dbf73cb3888588769"
  from="Yaron Minsky &lt;yminsky@g...&gt;"
  author="Yaron Minsky"
  date="2009-10-11T15:12:50"
  subject="Re: [Caml-list] Re: Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/a404572b7e870ab6714732d61e9bddd8"
  from="Jun Furuse &lt;jun.furuse@g...&gt;"
  author="Jun Furuse"
  date="2009-10-11T15:24:44"
  subject="Re: [Caml-list] Re: Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/178203bcf6f42213ff6d6e53b37b8707"
  from="Gilles Pirio &lt;gilles.ocaml@g...&gt;"
  author="Gilles Pirio"
  date="2009-10-11T19:57:29"
  subject="Re: [Caml-list] Re: Improving OCaml&apos;s choice of type to display">
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2009/10/bbdefe2c53d985fa64407ffd30ff459f"
  from="Andrej Bauer &lt;andrej.bauer@a...&gt;"
  author="Andrej Bauer"
  date="2009-10-09T07:33:02"
  subject="Re: [Caml-list] Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/b3f619ad26ab41cd18d0a4116614e3e7"
  from="Yaron Minsky &lt;yminsky@g...&gt;"
  author="Yaron Minsky"
  date="2009-10-09T09:58:06"
  subject="Re: [Caml-list] Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/44e5fad445afd1b1dba8516fa33c6a94"
  from="Alp Mestan &lt;alp@m...&gt;"
  author="Alp Mestan"
  date="2009-10-09T10:54:35"
  subject="Re: [Caml-list] Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/a0a18c8e566ee5672d4e68e674953947"
  from="Yaron Minsky &lt;yminsky@g...&gt;"
  author="Yaron Minsky"
  date="2009-10-09T11:15:03"
  subject="Re: [Caml-list] Improving OCaml&apos;s choice of type to display">
</msg>
</msg>
</msg>
<msg 
  url="2009/10/4f1ff557b4a8b3d66e406db6212e2860"
  from="Stephen Weeks &lt;sweeks@s...&gt;"
  author="Stephen Weeks"
  date="2009-10-09T18:14:12"
  subject="Re: [Caml-list] Improving OCaml&apos;s choice of type to display">
</msg>
</msg>
</msg>
</thread>

<contents>
And you can compete to come up with the most innocuous code that comes up
with the longest type.  Here's my current favorite:

# open Option.Monad_infix;;
# Map.find m 3 &gt;&gt;| fun x -&gt; x + 1;;
- : int Core.Std.Option.Monad_infix.monad = Some 4

Which of course could be rendered as:

# open Option.Monad_infix;;
# Map.find m 3 &gt;&gt;| fun x -&gt; x + 1;;
- : int option = Some 4

y

On Thu, Oct 8, 2009 at 9:40 PM, Yaron Minsky &lt;yminsky@gmail.com&gt; wrote:

&gt; Anyone who plays around with the Core library that Jane Street just
&gt; released can see showcased a rather ugly detail of how Core's design
&gt; interacts with how OCaml displays types.  Witness:
&gt;
&gt; # Int.of_string;;
&gt; - : string -&gt; Core.Std.Int.stringable = &lt;fun&gt;
&gt; # Float.of_string;;
&gt; - : string -&gt; Core_extended.Std.Float.stringable = &lt;fun&gt;
&gt;
&gt; I'd be much happier if this was rendered in the following equally correct
&gt; and more readable form:
&gt;
&gt; # Int.of_string;;
&gt; - : string -&gt; Int.t = &lt;fun&gt;
&gt; # Float.of_string;;
&gt; - : string -&gt; Float.t = &lt;fun&gt;
&gt;
&gt; Or even:
&gt;
&gt; # Int.of_string;;
&gt; - : string -&gt; int = &lt;fun&gt;
&gt; # Float.of_string;;
&gt; - : string -&gt; float = &lt;fun&gt;
&gt;
&gt; And this isn't just an issue in the top-level. The compiler also displays
&gt; types in the same difficult to read form.  I'm wondering if anyone has some
&gt; thoughts as to what we can do to make the compiler make better choices
&gt; here.  There are two issues to overcome:
&gt;
&gt;    - Dropping the module name.  I'd love to give the compiler the hint
&gt;    that Core.Std. could be dropped from the prefix in a context where that
&gt;    module is open.  This is what's done with the pervasives module already, I
&gt;    believe, so it seems like it should be doable here.
&gt;    - Choosing shorter names.  This one seems harder, but there are various
&gt;    different possibilities for what type name to print out, and a reasonable
&gt;    heuristic to use might be to pick the shortest one.  Part of the reason
&gt;    these issues come up is our use of standardized interface components (that's
&gt;    where the "stringable" type name comes from).  I suspect this one will be
&gt;    hard to fix, sadly.
&gt;
&gt; Anyway, we'd be happy with any suggestions on how to improve matters.
&gt;
&gt; y
&gt;

</contents>

</message>

