* [Caml-list] polymorphism and try
@ 2003-10-14 13:17 Guillaume Châtelet
2003-10-14 15:49 ` Artem Prisyznuk
0 siblings, 1 reply; 2+ messages in thread
From: Guillaume Châtelet @ 2003-10-14 13:17 UTC (permalink / raw)
To: caml-list
I have a problem with polymorphism in a try:
# let my_try f = try f with e -> raise e ;;
val my_try : 'a -> 'a = <fun>
# let my_id = my_try (fun x -> x) ;;
- : '_a -> '_a = <fun>
# let my_array_get = my_try Array.get;;
val my_array_get : '_a array -> int -> '_a = <fun>
etc ....
Why my_id and my_array_get are not polymorphic like i whish to ?
--
Guillaume Châtelet
-------------------
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] polymorphism and try
2003-10-14 13:17 [Caml-list] polymorphism and try Guillaume Châtelet
@ 2003-10-14 15:49 ` Artem Prisyznuk
0 siblings, 0 replies; 2+ messages in thread
From: Artem Prisyznuk @ 2003-10-14 15:49 UTC (permalink / raw)
To: Guillaume Châtelet; +Cc: caml-list
On Tue, 14 Oct 2003 15:17:12 +0200, Guillaume Châtelet
<guillaume.chatelet@rd.francetelecom.com> wrote:
> # let my_try f = try f with e -> raise e ;;
This exception never raised, because you not call function f, but only
return it as result of my_try. For your purpose possible next code:
let my_try f = try f () with e -> raise e;;
let id = fun x -> x;;
let my_id a = my_try (fun () -> id a);;
let my_array_get a b c = my_try (fun () -> Array.get a b c));;
--
Artem Prysyznuk
tema@sit.kiev.ua
-------------------
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-10-14 14:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-14 13:17 [Caml-list] polymorphism and try Guillaume Châtelet
2003-10-14 15:49 ` Artem Prisyznuk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox