[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Jeff Shaw <shawjef3@m...> |
| Subject: | Re: mutually dependent class and type |
I'm more sick than I thought. content_of_variant should have been variant_of_content, and I forgot to delete the double redundant semi-colon. Jeff Shaw wrote: > I don't know how you might directly get what you want, but here's one > way to get an equivalent result. > > class element_aux (c : [`Data of string | `Element of element list]) = > object end > > type content = Data of string | Element of element list;; > > let content_of_variant = function Data d -> `Data d | Element e -> > `Element e > > class element (c : content) = element_aux (content_of_variant c) >