开发者

Fiddling type inference on number conversion

I've got a function which takes an input of type

('a * (float * 'b * float)) list

Where I'd obviously like to avoid having to explicitly include the type.

The problem is that I convert the second float to decimal, using the decimal function.

let v2 (_,(_,_,v)) = decimal v

So type 开发者_如何学编程inference defaults to seeing this:

('a * (float * 'b * int)) list

Is there anything clever I can do to avoid having to explicitly include the type signature of the function?


Is there something wrong with doing it like this?

let v2 (_,(_,_,v:float)) = decimal v
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜