Are Infinite Types (aka Recursive Types) not possible in F#?

前端 未结 3 1163
南笙
南笙 2020-12-30 06:51

I was chatting with Sadek Drobi on twitter when be brought up that F# didn\'t seem to support Infinite Types. It turns out that in C# you can do something along these lines

3条回答
  •  天命终不由人
    2020-12-30 07:32

    Recursive record types should work as well.

    type A = { A : A }
    let rec a : A = { A = a }
    

    I'd be interested in a practical application. Or even an impractical one :)

提交回复
热议问题