caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* function specialization
@ 2005-11-15 11:45 Vsevolod Fedorov
  2005-11-15 12:57 ` [Caml-list] " Alessandro Baretta
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Vsevolod Fedorov @ 2005-11-15 11:45 UTC (permalink / raw)
  To: caml-list

Hello!

I have code like following:
----

type 'a wrap = ('a -> unit) -> 'a -> unit

let wrap fn arg =
  fn arg

let fn1 (v: int)    = ()
let fn2 (v: string) = ()

let use (wrap: 'a wrap) =
  wrap fn1 1;
  wrap fn2 ""
  (*   ^^^ This expression has type string -> unit but is here used with
type int -> unit *)

------
and get this error from compiler.
Is there any way to use 'wrap' function for both cases: fn1 and fn2?
Or is there some 'standard' workarounds/solutions for this problem exists?

Thanks
Seva



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

end of thread, other threads:[~2005-11-15 13:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-15 11:45 function specialization Vsevolod Fedorov
2005-11-15 12:57 ` [Caml-list] " Alessandro Baretta
2005-11-15 13:00 ` Jørgen Hermanrud Fjeld
2005-11-15 13:11 ` skaller

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