Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: John Prevost <jmp@arsdigita.com>
To: Julian Assange <proff@iq.org>
Cc: caml-list@inria.fr
Subject: Re: polymorphic variant oddity
Date: 08 Oct 2000 16:09:22 -0400	[thread overview]
Message-ID: <87lmvzjdsd.fsf@localhost.localdomain.> (raw)
In-Reply-To: <wxitr4naws.fsf@suburbia.net>

>>>>> "ja" == Julian Assange <proff@iq.org> writes:

  ja> Unbound value x
  ja> # let `F x = 1;;
  ja> This expression has type int but is here used with type [< `F of 'a | ..]
  ja> # let `F x = `F 1;;
  ja> val x : int = 1
  ja> # `F 4;;
  ja> - : [> `F of int] = `F 4

  ja> What exactly is the meaning this?

Looks like normal pattern matching to me:


# let Some x = x;;
Unbound value x
# let Some x = 1;;
This expression has type int but is here used with type 'a option
# let Some x = Some 1;;
Warning: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
None
val x : int = 1
# Some 4;; 
- : int option = Some 4

What did you expect to happen?

John.



      parent reply	other threads:[~2000-10-08 21:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-07 11:33 Julian Assange
2000-10-08 16:00 ` Pierre Weis
2000-10-08 17:22 ` Markus Mottl
2000-10-08 20:09 ` John Prevost [this message]

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=87lmvzjdsd.fsf@localhost.localdomain. \
    --to=jmp@arsdigita.com \
    --cc=caml-list@inria.fr \
    --cc=proff@iq.org \
    /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