3
我正在嘗試執行http://okmij.org/ftp/tagless-final/nondet-effect.html#no-functor中的一個擴展練習並將int_t
類型替換爲'a repr
。儘管試圖做到這一點,我卡上看到以下錯誤:Ocaml值與模塊和簽名中的參數化類型不匹配
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
我實施cons
看起來像
let cons: 'a repr -> 'a list_t -> 'a list_t =
liftm2 (fun h t -> h::t)
這無疑具有正確的類型。爲什麼這些顯然是相同的類型不兼容?