Browse thread
Annotated trees
[
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: | blue storm <bluestorm.dylc@g...> |
| Subject: | Re: [Caml-list] Annotated trees |
On Mon, Jun 7, 2010 at 11:22 AM, Daniel Bünzli <daniel.buenzli@erratique.ch> wrote: > That's true and certainly a good argument for the second form if you > already know the type of your annotations and have such needs. However > if you want to keep that polymorphic (the annotation is a convenience > for the client) it results in a type variable per case which becomes > heavy. You probably know that already but there is a nice use of object types as "type-level records" that make that kind of "lots of type variables" situations tractable : type 'annot tree = | Leaf of 'leaf_annot * string | Node of 'node_annot * 'annot tree list constraint 'annot = < leaf : 'leaf_annot; node : 'node_annot >