Displaying 2 results from an estimated 2 matches for "use_value".
Did you mean:
st_value
2008 Mar 15
4
[LLVMdev] improving the ocaml binding's type safety
...type llvalue = [ `Value ]
type llfunction = [ 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...
2008 Mar 15
0
[LLVMdev] improving the ocaml binding's type safety
...es through all
of the layers (esp. for Value), 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. V...