English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Re: [Caml-list] Re: Generalized Algebraic Datatypes
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-10-31 (12:22)
From: Dario Teixeira <darioteixeira@y...>
Subject: Re: [Caml-list] Re: Generalized Algebraic Datatypes

> If I misunderstood you, then I still misunderstand you: the App
> constructor you quoted took only 1 "argument" (a pair), so you can't
> "partially apply it", and that's from the type declaration.
> IOW the type declaration you quoted is *not* curried.

Now I get what you mean, and there's definitely been a misunderstanding.
First, I wasn't referring to constructor App in particular, nor confusing
a tuple argument with a curried form.  I may be abusing the term, but
I used "partial application" in the most general sense, ie, including
an application with zero arguments (in other words, a first-class value).

Suppose I had the following type declaration:

  val f: int -> int -> int -> int

I could do a partial application with 2 arguments:

  let f2 = f 1 2

A partial application with 1 argument:

  let f1 = f 1

And generalising, a "partial application" with 0 arguments, which
is simply referring to f itself:

  let f0 = 0

Now, going back to the GADTs example, a declaration such as the one
below hints that the constructors may be used as first-class values
(a zero-arg "partial application"), when in fact they cannot.  That
is why I find this syntax to be inconsistent with the rest of the

type _ t =
  | IntLit : int -> int t
  | BoolLit : bool -> bool t

Best regards,
Dario Teixeira