Understand Core's `Fn.const`

前端 未结 2 1776
渐次进展
渐次进展 2021-02-15 12:23

Jane Street\'s Core lib has such a function: Fn.const.

https://github.com/janestreet/core_kernel/blob/master/lib/fn.ml

let const c = (); fun         


        
2条回答
  •  说谎
    说谎 (楼主)
    2021-02-15 12:52

    1., 2. and 3.: see seppk's answer

    4.: The OCaml type system is such that functions can't return polymorphic values. Your should read Gabriel's answers about it: What is the difference between 'a and '_l? overgeneralized curried fns

提交回复
热议问题