Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Juan J. Quintela" <quintela@dc.fi.udc.es>
To: Pierre CASTERAN <Pierre.Casteran@labri.u-bordeaux.fr>
Cc: caml-list@inria.fr
Subject: Re: Weak types ?
Date: 05 Feb 1998 17:05:23 +0100	[thread overview]
Message-ID: <ytthg6eavgc.fsf@krilin.dc.fi.udc.es> (raw)
In-Reply-To: Pierre CASTERAN's message of Tue, 3 Feb 1998 16:46:22 +0100 (MET)

Pierre CASTERAN <Pierre.Casteran@labri.u-bordeaux.fr> wrote:

> let toto =
>   let id x = x
>   in id id;;
> (*
>  val toto : '_a -> '_a = <fun>
>              ^      ^
> 
>              why not " 'a " ?  
>              
> *)

Hi,
	I really dont remember the reason, but I remember one solution,
to put explicity the varibles in the binbidng, i. e.:

# let toto y = 
    let id x = x
    in (id id) y;;
val toto : 'a -> 'a = <fun>

Now it works with the normal values:

# toto 5;;
- : int = 5
# toto true;;
- : bool = true

But the identity function returns again the extrange type variables:
# toto (fun z -> z);;
- : '_a -> '_a = <fun>


You can solve this again using the same technique:

# let f y = (toto (fun z -> z)) y;;
val f : 'a -> 'a = <fun>

 
I remember some mail (I think in this list) about this matter. It turs
to be problem with the eta reduction but I don't remind the details, I
remember the solution, to put the varibles in the bindings.

I hope this helps.

Cheers, Juan.

PS. Someone knows the details for this behaviour?







  parent reply	other threads:[~1998-02-09 12:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-03 15:46 Pierre CASTERAN
1998-02-04 19:07 ` Simon Helsen
1998-02-05 16:05 ` Juan J. Quintela [this message]
1998-02-09 16:00 ` Pierre Weis
1998-02-09 16:31   ` Simon Helsen
1998-02-10 18:51     ` Pierre Weis

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=ytthg6eavgc.fsf@krilin.dc.fi.udc.es \
    --to=quintela@dc.fi.udc.es \
    --cc=Pierre.Casteran@labri.u-bordeaux.fr \
    --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