Hi,
Is there any way to write a conditional based on the type
information of a value? Specifically, if we use phantom types to write a
module such as
module Units : sig
type 'a t
val to_feet : float -> [`Feet ] t
val to_meters : float -> [`Meters] t
val add : 'a t -> 'a t -> 'a t
val print : 'a t -> unit
end = struct
type 'a t = float
let to_feet x=x
let to_meters x=x
let add x y = x +. y
let print x = Printf.printf "%f (units)" x
end;;
is there anyway to modify the print statement to correctly denote which
units are used?
Thanks.
Joe
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs