caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Chris Keane <Chris.Keane@comlab.ox.ac.uk>
To: caml-list@inria.fr
Subject: Constructed types
Date: Wed, 20 Jan 1999 10:42:18 +0000	[thread overview]
Message-ID: <199901201042.KAA01535@msc2.comlab> (raw)

If this works as it should:

  >         Objective Caml version 2.00
  >
  > # type foo =
  >     Bar of int * int;;
  > type foo = | Bar of int * int
  > # let myfun x =
  >     let (m,n) = if x = 0 then (0,0) else (1,1) in
  >       Bar (m,n);;
  > val myfun : int -> foo = <fun>

then why doesn't this?

  > # let myfun2 x =
  >     let m = if x = 0 then (0,0) else (1,1) in
  >       Bar m;;
  > The constructor Bar expects 2 argument(s),
  > but is here applied to 1 argument(s)

or even this?

  > # let myfun3 x =
  >     Bar (if x = 0 then (0,0) else (1,1));;
  > The constructor Bar expects 2 argument(s),
  > but is here applied to 1 argument(s)

Thanks,
Chris.

------------------------------------------------------------------- ><> ---
    Hardware Compilation Group, Oxford University Computing Laboratory,
            Wolfson Building, Parks Road, Oxford, OX1 3QD, U.K.
    tel:  +44 (1865) (2)73865      e-mail:  Chris.Keane@comlab.ox.ac.uk
            http://www.comlab.ox.ac.uk/oucl/users/chris.keane/




             reply	other threads:[~1999-01-20 13:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-20 10:42 Chris Keane [this message]
1999-01-21  1:22 ` Markus Mottl
1999-01-21 15:37 Toby Moth
1999-01-21 16:05 Markus Mottl

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=199901201042.KAA01535@msc2.comlab \
    --to=chris.keane@comlab.ox.ac.uk \
    --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).