【发布时间】:2017-10-05 05:03:33
【问题描述】:
我正在尝试在http://okmij.org/ftp/tagless-final/nondet-effect.html#no-functor 中进行一项扩展练习,并将int_t 类型替换为'a repr。在尝试执行此操作时,我遇到了以下错误:
Values do not match:
val cons : '_a repr -> '_a list_t -> '_a list_t
is not included in
val cons : 'a repr -> 'a list_t -> 'a list_t
我对@987654325@ 的实现看起来像
let cons: 'a repr -> 'a list_t -> 'a list_t =
liftm2 (fun h t -> h::t)
这绝对是正确的类型。为什么这些明显相同的类型不兼容?
【问题讨论】:
标签: module polymorphism ocaml