caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christian Stork <cstork@ics.uci.edu>
To: caml-list@inria.fr
Subject: Monomorphism restriction in classes
Date: Fri, 17 Feb 2006 13:09:20 -0800	[thread overview]
Message-ID: <20060217210920.GA27593@anthony.ics.uci.edu> (raw)

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

class c (len : 'a list -> 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   <>  Support eff.org!  <>   http://www.ics.uci.edu/~cstork/
OpenPGP fingerprint:  B08B 602C C806 C492 D069  021E 41F3 8C8D 50F9 CA2F


             reply	other threads:[~2006-02-17 21:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-17 21:09 Christian Stork [this message]
2006-02-17 21:53 ` [Caml-list] " Gerd Stolpmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060217210920.GA27593@anthony.ics.uci.edu \
    --to=cstork@ics.uci.edu \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).