From: Jeremy Yallop <yallop@gmail.com>
To: Andreas Rossberg <rossberg@mpi-sws.org>
Cc: Gabriel Scherer <gabriel.scherer@gmail.com>,
Alain Frisch <alain.frisch@lexifi.com>,
caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] Newbie comment on constructor syntax
Date: Mon, 9 Nov 2015 22:57:31 +0000 [thread overview]
Message-ID: <CAAxsn=FfxeGReM2T_c3y7JEkr5t4VuX+EF7eoepnh97y943+wA@mail.gmail.com> (raw)
In-Reply-To: <95AE93FB-4D5A-43E2-B72F-40C348403AA6@mpi-sws.org>
On 9 November 2015 at 22:27, Andreas Rossberg <rossberg@mpi-sws.org> wrote:
>> On Nov 9, 2015, at 22:11 , Gabriel Scherer <gabriel.scherer@gmail.com> wrote:
>> I like the revised syntax choice of writing
>> type t = A of int and int list
>> instead of
>> type t = A of int * int list
>> which removes the beginner surprise without introducing other
>> unpalatable design side-effects. (It is still awkward for GADTs, but
>> such is life.)
>
> I am not fond of the revised syntax, because it does not explain why the term-level syntax for constructor application uses tuple notation.
In fact, the revised syntax doesn't use tuple notation for constructor
application! The revised type definition syntax also has a few
additional differences, such as prefix type constructor application,
besides the one Gabriel mentioned. Here's an example, showing how to
define a data type with a multi-argument constructor and to construct
and match against values, with curried notation:
# type t = [ A of int and list int ];
type t = [ A of int and list int ]
# value x = A 3 [];
value x : t = A 3 []
# fun [ A x y -> (x, y) ];
- : t -> (int * list int) = <fun>
However, partial application of constructors is not supported:
# A 3;
Characters 0-3:
A 3;
^^^
Error: The constructor A expects 2 argument(s),
but is applied here to 1 argument(s)
Jeremy.
next prev parent reply other threads:[~2015-11-09 22:57 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-06 9:33 Soegtrop, Michael
2015-11-06 10:04 ` Nicolas Ojeda Bar
2015-11-06 10:31 ` Francois Berenger
2015-11-06 12:20 ` Soegtrop, Michael
2015-11-06 12:34 ` Gabriel Scherer
2015-11-06 13:09 ` Soegtrop, Michael
2015-11-06 14:10 ` Ashish Agarwal
2015-11-06 15:19 ` Soegtrop, Michael
2015-11-06 15:21 ` Ashish Agarwal
2015-11-21 17:24 ` [Caml-list] Notation for currying Hendrik Boom
2015-11-21 17:41 ` Gabriel Scherer
2015-11-21 18:05 ` David Rajchenbach-Teller
2015-11-21 18:55 ` Gabriel Scherer
2015-11-06 12:29 ` [Caml-list] Newbie comment on constructor syntax Jonas Jensen
2015-11-06 12:46 ` Soegtrop, Michael
2015-11-06 12:54 ` Gabriel Scherer
2015-11-08 21:16 ` Florian Weimer
2015-11-08 22:50 ` Norman Hardy
2015-11-09 6:27 ` Florian Weimer
2015-11-09 13:27 ` Stefan Monnier
2015-11-09 8:09 ` Soegtrop, Michael
2015-11-09 10:00 ` Hendrik Boom
2015-11-09 10:16 ` Alain Frisch
2015-11-09 10:35 ` Andreas Rossberg
2015-11-09 12:28 ` Alain Frisch
2015-11-09 17:33 ` Alain Frisch
2015-11-09 18:08 ` Gabriel Scherer
2015-11-09 18:16 ` Andreas Rossberg
2015-11-09 21:11 ` Gabriel Scherer
2015-11-09 22:06 ` Alain Frisch
2015-11-09 22:27 ` Andreas Rossberg
2015-11-09 22:57 ` Jeremy Yallop [this message]
2015-11-10 0:11 ` Hendrik Boom
2015-11-10 8:27 ` Soegtrop, Michael
2015-11-10 10:25 ` Romain Bardou
2015-11-10 10:44 ` Alain Frisch
2015-11-10 10:55 ` Romain Bardou
2015-11-10 13:17 ` Alain Frisch
2015-11-10 13:41 ` Romain Bardou
2015-11-10 14:01 ` Alain Frisch
2015-11-13 15:36 ` Romain Bardou
2015-11-10 11:17 ` Soegtrop, Michael
2015-11-10 14:11 ` Hendrik Boom
2015-11-10 14:40 ` immanuel litzroth
2015-11-10 15:30 ` Soegtrop, Michael
2015-11-10 17:27 ` Gerd Stolpmann
2015-11-09 20:32 ` Alain Frisch
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='CAAxsn=FfxeGReM2T_c3y7JEkr5t4VuX+EF7eoepnh97y943+wA@mail.gmail.com' \
--to=yallop@gmail.com \
--cc=alain.frisch@lexifi.com \
--cc=caml-list@inria.fr \
--cc=gabriel.scherer@gmail.com \
--cc=rossberg@mpi-sws.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