English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Non generalizable type error
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-04-29 (21:59)
From: Magesh Kannan <magesh@i...>
Subject: [Caml-list] Non generalizable type error
Hi All,

In one of the OCaml modules that I wrote, there is a record definition

let xmit_SM_no_common_trans = 
  string_of_name = sm_string_of_name;
  states = [ sm_wait; sm_recv_data; sm_send_data; 
	     sm_recv_list_data; sm_send_list_data ]

whose type is 

val xmit_SM_no_common_trans : (sm_state, state, header,
'a) Statemach.state_mc

The same module has another function 

let add_common_trans_to_sm sm = sm (* just returns the passed argument *)

whose type is

val add_common_trans_to_sm : 'a -> 'a

Now I apply this function like this,

let xmit_SM = add_common_trans_to_sm xmit_SM_no_common_trans

The type of xmit_SM becomes

val xmit_SM : (sm_state, state, header, '_a) Statemach.state_mc

I get an error that this contains types that cannot be generalized. Why is
this so? What can I do to correct this error?

Thanks for your time,

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