caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Monomorphism restriction in classes
@ 2006-02-17 21:09 Christian Stork
  2006-02-17 21:53 ` [Caml-list] " Gerd Stolpmann
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Stork @ 2006-02-17 21:09 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-02-17 21:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-17 21:09 Monomorphism restriction in classes Christian Stork
2006-02-17 21:53 ` [Caml-list] " Gerd Stolpmann

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).