Version française
Home     About     Download     Resources     Contact us    
Browse thread
phantom type thing question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: micha <micha-1@f...>
Subject: phantom type thing question

I'm getting confused while trying to implement some subtyping hierachy 
with polymorphic variants.
say I have the hierachy:

symbol -> image -> xpmimage

and types like that:

type 'a sym;;

make_symbol : params -> [`Symbol] sym;;
make_image: params -> [`Image] sym;;

or should it be:
make_image: params -> [`Symbol | `Image] sym;;
make_xpm; params -> [`Symbol | `Image | `Xpm ] sym;;

so that some functions work only on some symbols:

val get_image_width: [< `Image | `XpmImage] sym -> int;;

I think I mix up the [< ..] and [> ... ] type constructs, allthough I 
thought I understood it :-)


 Michael