Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Narrowing coercions for functions with optional parameters
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Stefano Zacchiroli <zack@c...>
Subject: Re: [Caml-list] Narrowing coercions for functions with optional parameters
On Sun, Feb 24, 2002 at 03:01:25PM +0100, Tomasz Zielonka wrote:
> # let coerce f x = f x
> val coerce : ('a -> 'b) -> 'a -> 'b = <fun>
> 
> # coerce g ;;
> - : int -> int = <fun>

With such a call you haven't change the original "g" function so the
coersion of "g" to "int -> int" doesn't work because it was applied to
the old "g" function.

Try this (after executing your examples of course):

     # let g = coerce g;;
     val g : int -> int = <fun>
     # (g : int -> int) ;;  
     - : int -> int = <fun>

Hope this helps.
Cheers.

-- 
Stefano Zacchiroli - undergraduate student of CS @ Univ. Bologna, Italy
zack@cs.unibo.it | ICQ# 33538863 | http://www.cs.unibo.it/~zacchiro
"I know you believe you understood what you think I said, but I am not
sure you realize that what you heard is not what I meant!" -- G.Romney
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners