Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: mutually dependent class and type
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ 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 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)