Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] tpyping question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@o...>
Subject: Re: [Caml-list] tpyping question
On Tue, 2003-08-12 at 05:02, Remi Vanicat wrote:
> skaller <skaller@ozemail.com.au> writes:
> 
> > In reality there are 20 tags, not just the 2 shown.
> > So I'd have to write:
> >
> > match x with
> > | .....
> > | `A _ as y 
> > | `B _ as y -> let (i,j) = match y with `A v->v | `B u -> (u,0) in ...
> > | ......
> 
> If `A (x,y) and `B x have a link (as it seem in your
> example) I would have define the type 
> 
> type aorB = [`A of int * int | `B of int]

I'd consider that if the relationship were strong
enough to abstract into a named type, meaning,
it applies to more than one or two switchings (match).

Unfortunately, the nature of compilers seem to be that
in each function the groupings are different. The reason for
this is probably that if they were not, then you'd not *just*
make a type unifying the two tags .. you'd just use a single
tag :-)



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners