通过类型乐趣<'a>在参数?

时间:2013-02-25 10:08:15

标签: types parameters f#

如何在F#中的参数中传递fun<'a>类型?

Example -> type myClass(a : int, myDelegate : fun<'a>)
    let theFunc = myDelegate

1 个答案:

答案 0 :(得分:4)

我想你想要

type mytype<'a> (a:int,myDelegate:'a->unit) = 
    let theFunc = myDelegate

或者,如果fun是其他地方定义的某种类型,则需要使用反引号表示法,因为fun是F#中的保留字

type mytype<'a> (a:int,myDelegate:``fun``<'a>) = 
    let theFunc = myDelegate