type 'a lazy_node =
| Empty
| Node of 'a * 'a lazy_list
and 'a lazy_list = 'a lazy_node lazy_t
let con x zl = lazy (Node (x,zl))
So there should be two types defined here: 'a lazy_node
and 'a lazy_list
.
I thought that con
's type would be 'a -> 'a lazy_list -> 'a lazy_list
However, actually when I tried it in utop
, it gave con
such a type:
val con : 'a -> 'a lazy_list -> 'a lazy_node lazy_t = <fun>
Why the return type is not 'a lazy_list
? How does OCaml infer in this case?