我正在尝试跟进论文"轻量级高通道多态性" (https://ocamllabs.github.io/higher/lightweight-higher-kinded-polymorphism.pdf) 我坚持将这个ML代码转换为F#
type (_,_) arrow =
Fn_plus : ((int ∗ int), int) arrow
| Fn_plus_cons : int → ((int ∗ int list), int list) arrow
和
let apply : type a b. (a, b) arrow ∗ a → b =
fun (appl, v) → match appl with
| Fn_plus → let (x, y) = v in x + y
| Fn_plus_cons n → let (x, l’) = v in x + n :: l’
特别是类型定义感觉就像一个巨大的魔力墙。