Browse thread
function specialization
-
Vsevolod Fedorov
- Alessandro Baretta
- Jørgen Hermanrud Fjeld
- skaller
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2005-11-15 (12:57) |
From: | Alessandro Baretta <a.baretta@b...> |
Subject: | Re: [Caml-list] function specialization |
Vsevolod Fedorov wrote: > Hello! > > I have code like following: > ---- > > type 'a wrap = ('a -> unit) -> 'a -> unit type wrap = { action : 'a. ('a -> unit) -> 'a -> unit } > let wrap fn arg = > fn arg let wrap = { action = fun 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 *) let use (wrap : wrap) = wrap.action fn1 1; wrap.action fn2 "" Alex