<?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="2006/02/cd3875acc017c9aaeafad61ed359e833"
  from="Christian Stork &lt;cstork@i...&gt;"
  author="Christian Stork"
  date="2006-02-17T21:09:10"
  subject="Monomorphism restriction in classes"
  prev="2006/02/6787c9b853874e45fbb79f09be87ee01"
  next="2006/02/c3c8a28adc8b56f31cc56338bf3e28d2"
  next-in-thread="2006/02/c3c8a28adc8b56f31cc56338bf3e28d2"
  prev-thread="2006/02/726bafa7a07b271413529afdb261744e"
  next-thread="2006/02/f8740e1d5e810115545d1dceacaa7b1d"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="Monomorphism restriction in classes">
<msg 
  url="2006/02/cd3875acc017c9aaeafad61ed359e833"
  from="Christian Stork &lt;cstork@i...&gt;"
  author="Christian Stork"
  date="2006-02-17T21:09:10"
  subject="Monomorphism restriction in classes">
<msg 
  url="2006/02/c3c8a28adc8b56f31cc56338bf3e28d2"
  from="Gerd Stolpmann &lt;info@g...&gt;"
  author="Gerd Stolpmann"
  date="2006-02-17T21:53:54"
  subject="Re: [Caml-list] Monomorphism restriction in classes">
</msg>
</msg>
</thread>

<contents>
So, what's the best work-around for this problem?

class c (len : 'a list -&gt; int) =
object 
  method str_len (l: string list) = len l
  method int_len (l: int list)    = len l
end

$ ocamlc monoRestForClasses.ml 
File "monoRestForClasses.ml", line 7, characters 40-41:
This expression has type int list but is here used with type string list
 
Thanks,
Chris

-- 
Chris Stork   &lt;&gt;  Support eff.org!  &lt;&gt;   http://www.ics.uci.edu/~cstork/
OpenPGP fingerprint:  B08B 602C C806 C492 D069  021E 41F3 8C8D 50F9 CA2F

</contents>

</message>

