Recursive Types in Ocaml
Why can I not have a type like this in OCaml?
type t = string * (Left of t | Right of t)
Is there a type-theoretic reason for it?
« Continuation Typing Questions | Main | Setting Up CVS »
Why can I not have a type like this in OCaml?
type t = string * (Left of t | Right of t)
Is there a type-theoretic reason for it?
Comments
a value of this type can be defined as:
let rec x = ("tinker", `Left of ("tailor", `Right of x))Type theoretically, the type is just μX. String * (X + X), where μX. denotes a recursive type.
Posted by: Bob Atkey | October 11, 2005 6:17 PM
Thanks, both.
Posted by: ezra | October 13, 2005 4:29 PM