On Fri, Nov 12, 2004 at 10:11:51AM -0600, josh wrote: > OK, Here's what I'm trying to do: > > # type doer = { file_name:string ; actor: ('a -> unit) };; > > But when I do this, it tells me that I've got "Unbound type parameter 'a ". You need to do this: # type 'a doer = { file_name:string ; actor: ('a -> unit) };; type 'a doer = { file_name : string; actor : 'a -> unit; } because you're creating a polymorphic type ('a doer). Note that this won't let you store an actor function of type, say, int -> unit and then replace it with another function of type, say, string -> unit. For the same reason it won't let you pass an ``int doer'' to a function expecting a ``string doer''. > # type t > # type doer = { file_name:string; actor (t -> unit) };; > > It works until I try to use a created record: > > # let b = {file_name = "one"; actor = (fun x -> () ) };; > # b.actor 10;; > The expression has type int but is used with type t > > even if I try to do this > > # type t = int;; > > it doesn't work. OK, this is another problem. Here what you're doing is defining a _new_ type ``t'', which is unrelated to your old type ``t''. Here's another example: # let f () = "hello";; val f : unit -> string = # f ();; - : string = "hello" # let g = f;; val g : unit -> string = # let f () = "goodbye";; val f : unit -> string = # f ();; - : string = "goodbye" # g ();; - : string = "hello" Notice that ``g'' still calls the old ``f'', even after ``f'' has been redefined. There's a beginner's list: > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Rich. -- Richard Jones. http://www.annexia.org/ http://www.j-london.com/ >>> http://www.team-notepad.com/ - collaboration tools for teams <<< Merjis Ltd. http://www.merjis.com/ - improving website return on investment Use Perl libs in OCaml - http://www.merjis.com/developers/perl4caml