Function templates in F#

后端 未结 4 774
我寻月下人不归
我寻月下人不归 2021-01-03 10:52

Let\'s say I am solving a particular problem and come up with a function

let function parameter1 ... = 
     a lot of adding, multiplying & so on with a         


        
4条回答
  •  情歌与酒
    2021-01-03 11:12

    While not ideal, and kind of bypassing your main question, you can add type annotations to force the compiler's hand:

    let greatFunction (param1:int64) (param2:int64) : int64 = (param1+1)/(param2*2)
    

    Now of course there are no implicit conversions in F#, so you will need to add L to all numeric literals, but they will show up as compiler errors at least.

提交回复
热议问题