caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alessandro Baretta <a.baretta@barettadeit.com>
To: Vsevolod Fedorov <sevaAtWork@mail.ru>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] function specialization
Date: Tue, 15 Nov 2005 13:57:46 +0100	[thread overview]
Message-ID: <4379DB4A.1080907@barettadeit.com> (raw)
In-Reply-To: <00a701c5e9da$1b0ebc20$670aa8c0@seva>

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



  reply	other threads:[~2005-11-15 12:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-15 11:45 Vsevolod Fedorov
2005-11-15 12:57 ` Alessandro Baretta [this message]
2005-11-15 13:00 ` [Caml-list] " Jørgen Hermanrud Fjeld
2005-11-15 13:11 ` skaller

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=4379DB4A.1080907@barettadeit.com \
    --to=a.baretta@barettadeit.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=sevaAtWork@mail.ru \
    /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).