search for: use_function

Displaying 2 results from an estimated 2 matches for "use_function".

Did you mean: usb_function
2008 Mar 15
4
[LLVMdev] improving the ocaml binding's type safety
...[ llvalue | `Function ] Finally, we'll create a polymorphic type that holds the phantom type: type 'a t And then define functions that work on these types. Since we want a function that can take an llvalue, we need to specify it like this: val use_value: [> `Value ] t -> unit val use_function: [> `Function ] t -> unit For llvalue and llfunction it's obvious that it'll match, but won't it also match `Foo? Yes it will. We'll work around this by making the type 't' abstract. Then, only our module can create values of it. We'll provide helper functions to...
2008 Mar 15
0
[LLVMdev] improving the ocaml binding's type safety
...but I think you can implement ISA routines in Ocaml relatively painlessly for Type. > Here's the full example: > > foo.mli: > type 'a t > type llvalue = [ `Value ] > type llfunction = [ llvalue | `Function ] > > val use_value : [> `Value] t -> unit > val use_function : [> `Function] t -> unit > > val make_value : unit -> llvalue t > val make_function : unit -> llfunction t > > Does this sound like it could work, or am I missing something? I think your sum types are incorrect here. Value is abstract; I think you want to say somethi...