caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: micha <micha-1@fantasymail.de>
To: ocaml <caml-list@inria.fr>
Subject: phantom type thing question
Date: Thu, 01 Mar 2007 10:46:14 +0100	[thread overview]
Message-ID: <45E6A0E6.80502@fantasymail.de> (raw)


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




             reply	other threads:[~2007-03-01  9:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-01  9:46 micha [this message]
     [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45E6A0E6.80502@fantasymail.de \
    --to=micha-1@fantasymail.de \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).