I am stuck attempting to overload the (*) operator for a Measure type.
What I would like to see is :
> let x = 1.0 * 1.0;;
val
Note that you are redefining the (*)
operator rather than overloading it.
The trick to get it working is to write something using an intermediate type, like this:
type Mult = Mult with
static member ($) (Mult, v1: float<i>) = fun (v2: float<i>) ->
float(-1) * float(v1) * float(v2)
static member inline ($) (Mult, v1 ) = fun v2 -> v1 * v2
static member ($) (Mult, v1: Mult) = fun () -> Mult //Dummy overload
let inline (*) v1 v2 = (Mult $ v1) v2
BTW funny way to use units of measure.