From: Jesper Louis Andersen <jesper.louis.andersen@gmail.com>
To: Gabriel Scherer <gabriel.scherer@gmail.com>
Cc: Goswin von Brederlow <goswin-v-b@web.de>, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Wanted: GADT examples: string length, counting module x
Date: Mon, 19 Mar 2012 17:13:26 +0100 [thread overview]
Message-ID: <CAGrdgiVpG45Kgf2u0PHgDzH=yEOAMmydbXP-qsnLYC3MTzZSEw@mail.gmail.com> (raw)
In-Reply-To: <CAPFanBHcs4V2OHB1VjCvb+xizPbQ7NQfWH_GwAvfNfnQ1wtfLQ@mail.gmail.com>
On Mon, Mar 19, 2012 at 15:43, Gabriel Scherer
<gabriel.scherer@gmail.com> wrote:
> I suspect you're seeing too much into the GADT as they're being added
> in OCaml. Your examples are not basically about GADTs, but about
> dependent types: you want to encode values (and operations on them) at
> the type level to get more expressivity. This is a well-known and
> extremely powerful trend in programming languages design, but it also
> results in complex systems with sophisticated rules.
I like the view of Conor McBride: the types are Priests overseeing the
terms which are people. In a language like OCaml the priests and
people and not allowed to mingle with each other. What is in the
church of types, stays in the church of types. This means - and I
believe this is what the remainder of Gabriels post is about - that
the priests need to encode the people or that you need to represent
the terms as a mirroring in the types.
Real dependent types allow the priests and people to intermingle in a
specific way: terms can be part of types. Or more succinctly: Types
can be indexed by terms. This construction allow you to take a term
from the language, say n : nat, and then talk about the type 'vector
n', i.e., the vector (list) of length n.
If you want to play with dependent types, there are two ways which
seem popular at the moment: Agda or Coq. Agda is the more experimental
and programming-language-like path, whereas Coq is a full proof
assistant with automation support. But others live their life in these
tools much more than I, and they would be more knowledgable in what to
use.
--
J.
next prev parent reply other threads:[~2012-03-19 16:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-12 11:30 Goswin von Brederlow
2012-03-19 14:43 ` Gabriel Scherer
2012-03-19 16:13 ` Jesper Louis Andersen [this message]
2012-03-19 16:22 ` Raoul Duke
2012-03-21 9:48 ` Goswin von Brederlow
2012-03-23 1:07 ` [Caml-list] GADT example for universal list Goswin von Brederlow
2012-03-22 6:01 [Caml-list] Wanted: GADT examples: string length, counting module x oleg
2012-03-22 9:04 ` Gabriel Scherer
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='CAGrdgiVpG45Kgf2u0PHgDzH=yEOAMmydbXP-qsnLYC3MTzZSEw@mail.gmail.com' \
--to=jesper.louis.andersen@gmail.com \
--cc=caml-list@yquem.inria.fr \
--cc=gabriel.scherer@gmail.com \
--cc=goswin-v-b@web.de \
/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