List Info

Thread: "ocaml_beginners"::[] closure with abstrace type.




"ocaml_beginners"::[] closure with abstrace type.
user name
2006-08-28 02:45:20
I'm having some trouble with the following.

I'm trying to interface ocaml to a c library.  I'm
representing a 
cStruct with an abstract type cStruct.

What I'd like to do is have the two functions
set_current_struct and 
get_current_struct contain a cStruct ref in a closure.

type cStruct
external create_struct : unit -> cStruct =
"create_struct"
external read_struct : struct -> cStruct -> unit =
"read_struct"
let (set_current_struct , get_current_struct) = 
   let currStruct = ref `cStruct
   in let f1 s = currStruct := s  
      and f2 () = currStruct
   in (f1,f2) 
;;

What I am getting is this.
The type of this expression,
((_[> `cStruct ] as 'a) -> unit) * (unit -> 'a
ref),
contains type variables that cannot be generalized

Can someone help me untangle this?








Archives up to August 22, 2005 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http:/
/groups.yahoo.com/group/ocaml_beginners/

<*> To unsubscribe from this group, send an email to:
    ocaml_beginners-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 



[1]

about | contact  Other archives ( Real Estate discussion Medical topics )