caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alessandro Baretta <alex@baretta.com>
To: Ocaml <caml-list@inria.fr>
Subject: [Caml-list] Typing problem with polymorphic variants
Date: Tue, 01 Apr 2003 19:34:24 +0200	[thread overview]
Message-ID: <3E89CDA0.7090200@baretta.com> (raw)

This just baffles me.

 > Values do not match:
 >   val feature :
 >     [> `Clear | `Length of int | `Pitch of int
 >               | `Width of 'a] -> string
 > is not included in
 >   val feature : [> `Clear] -> string

Why are "match-anything" functions of the kind of

let f = function
   | `Foo -> "foo"
   | `Bar -> "bar"
   | _ -> "?"

incompatible with signatures like

val f : [> `Foo ] -> string
?


There clearly is no case when a value of type [> `Foo] will 
not be acceptable for f. So why does the type checker reject 
this?

Alex

-------------------
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


             reply	other threads:[~2003-04-01 18:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-01 17:34 Alessandro Baretta [this message]
2003-04-01 18:38 ` Ville-Pertti Keinonen
2003-04-01 17:56   ` Alessandro Baretta
2003-04-01 18:44 ` David Brown
2003-04-02  1:34   ` 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=3E89CDA0.7090200@baretta.com \
    --to=alex@baretta.com \
    --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).