Currying functions with format dependent types

前端 未结 1 1915
死守一世寂寞
死守一世寂寞 2021-01-25 11:35

As far as I\'m aware, F# doesn\'t handle printfn like it does other functions because of it\'s type dependence on the string parameter. Could someone explain to me why that prev

相关标签:
1条回答
  • 2021-01-25 12:04

    Because printn would be a simple value the way you define it. And values can't be generic in the .NET runtime.

    Make the parameter explicit so it is a function:

    let printn value = printfn "%A" value
    

    For more information, see the topic Value Restriction on MSDN.

    0 讨论(0)
提交回复
热议问题