caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* phantom type thing question
@ 2007-03-01  9:46 micha
       [not found] ` <95513600703010547t1f098d80p7bbff2f2c85d79a5@mail.gmail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: micha @ 2007-03-01  9:46 UTC (permalink / raw)
  To: ocaml


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




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-03-01 19:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-01  9:46 phantom type thing question micha
     [not found] ` <95513600703010547t1f098d80p7bbff2f2c85d79a5@mail.gmail.com>
2007-03-01 13:49   ` [Caml-list] " Olivier Andrieu
2007-03-01 16:40   ` micha
2007-03-01 17:03     ` Olivier Andrieu
2007-03-01 20:01       ` micha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).