Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jacques Carette <carette@mcmaster.ca>
To: OCaml <caml-list@inria.fr>
Subject: Not a variant??
Date: Tue, 19 Aug 2008 18:53:58 -0400	[thread overview]
Message-ID: <48AB4F06.4070208@mcmaster.ca> (raw)

The function f1 below works fine -- so type d is seen to be a variant type.
However, f2 does not compile because type c is *not* a variant type. 

However, if one looks at O'Caml's output for type c, it visually looks 
like a variant, while that of d does not.  This is highly confusing.

This looks like a bug to me -- both c and d should be recognized as 
variant types.

Jacques

type a = [`A ]
type b = [`B ]
type 'a c = 'a
    constraint 'a = [< a | b]
    ;;
type 'a d = 'a
    constraint 'a = b
    ;;

let f1 = function
    | #d -> true
    | _  -> false

let f2 = function
    | #c -> true
    | _  -> false
;;


             reply	other threads:[~2008-08-19 22:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-19 22:53 Jacques Carette [this message]
2008-08-20  3:21 ` [Caml-list] " Jacques Garrigue
2008-08-20 13:24   ` Jacques Carette
2008-08-21  5:10     ` Jacques Garrigue

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=48AB4F06.4070208@mcmaster.ca \
    --to=carette@mcmaster.ca \
    --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