ocaml GADT:为什么需要 "type a."?

ocaml GADT : why "type a." needed?

ocaml manual的§7.20的GADT基本示例中,'type a.'是什么意思? 为什么声明 "eval : a term -> a" 还不够?

type _ term =
          | Int : int -> int term
          | Add : (int -> int -> int) term
          | App : ('b -> 'a) term * 'b term -> 'a term

        let rec eval : type a. a term -> a = function
          | Int n    -> n                 (* a = int *)
          | Add      -> (fun x y -> x+y)  (* a = int -> int -> int *)
          | App(f,x) -> (eval f) (eval x)

Jacque 在 ML'2011 研讨会上的 slide 有一个很好的介绍。使用局部抽象类型的语法来引入通用表达式范围变量的想法。