开发者

Fiddling type inference on number conversion

开发者 https://www.devze.com 2022-12-21 12:42 出处:网络
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.

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

精彩评论

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