caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Dario Teixeira <darioteixeira@yahoo.com>
To: caml-list@inria.fr, oleg@okmij.org
Subject: Re: [Caml-list] GADTs in OCaml
Date: Sun, 12 Jul 2009 05:56:49 -0700 (PDT)	[thread overview]
Message-ID: <468067.61779.qm@web111510.mail.gq1.yahoo.com> (raw)
In-Reply-To: <20090711030510.49092176DE@Adric.metnet.navy.mil>


Hi,

> We present a simple, pure, magic-free implementation of a form of
> GADTs in OCaml that is sufficient for the common applications of GADTs
> such as data structures with embedded invariants, typed printf/scanf,
> tagless interpreters. (...)

Very interesting -- clever, yet so simple!  But note that as far as the
link-nodes-shall-not-be-ancestors-of-their-kind problem is concerned, there
is one problem with the presented implementation.  Consider the following
declarations:

let t1 = text "ola"
let t2 = href "http"
let t3 = bold [t1; t2]
let t4 = mref "http" [t1]

This causes an error upon t4.  The reason is that because of t3, t1 was
unified as "node_link node_t", whereas t4 requires it to be "node_nolink node_t".  I think the solution is to revert to using polymorphic variants
for the phantom type, and take advantage of their open-ended nature.
(Though I'm guessing some extra massaging will be required -- it's Sunday
and I don't have much time to look into this).

Anyway, perhaps the Batteries folks will consider including both versions
of the Eq module?  It will certainly prove useful for many people. (Am I
correct in assuming you are releasing the code into the public domain or
at least some open-source friendly license?)

Best regards,
Dario Teixeira






  reply	other threads:[~2009-07-12 12:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-11  3:05 oleg
2009-07-12 12:56 ` Dario Teixeira [this message]
2009-07-13 12:45   ` [Caml-list] " Edgar Friendly

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=468067.61779.qm@web111510.mail.gq1.yahoo.com \
    --to=darioteixeira@yahoo.com \
    --cc=caml-list@inria.fr \
    --cc=oleg@okmij.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;
as well as URLs for NNTP newsgroup(s).