caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Dario Teixeira <darioteixeira@yahoo.com>
To: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Private types in 3.11, again
Date: Mon, 26 Jan 2009 07:13:38 -0800 (PST)	[thread overview]
Message-ID: <918954.90415.qm@web111505.mail.gq1.yahoo.com> (raw)

Hi,

And once more, thanks for your very informative reply.  I spent the last
few days exploring these issues (there's quite some info on the Haskell
wiki) and weighting in the pros/cons of each solution.

I've decided for an approach similar to that taken by the Ocsigen guys.
That is, acknowledge that a proper modeling of this problem requires GADTs,
and that since Ocaml does not have them (yet), this is one of those cases
where the use of Obj.magic is justified.  Yes, I know Obj.magic is evil
and all that, but it does allow me to model the problem in a way that is
not too contrived and that is easily ported to a GADT solution once it
does become available in Ocaml.  In the end it's about choosing the lesser
of two evils, and so I've made my peace with having to use Obj.magic.


> In your first example, you want to simultaneously deconstruct a
> value, a reconstruct a new value with the same polymorphic type.
> For this, you need the expressive power of GADTs, i.e. the ability
> to instanciate type variables differently inside different branches
> of a pattern-matching. Since they are not available in ocaml,
> (...)

Thanks for the explanation.  So there is indeed an "expression deficit"
that GADTs fix.  Also, note that this little link-node example is not
the only instance in my current project where GADTs would be useful.
(I'm guessing that eventually reaching the limits of the type system
is part of the journey for an Ocaml programmer!...)

Best regards,
Dario Teixeira






             reply	other threads:[~2009-01-26 15:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-26 15:13 Dario Teixeira [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-01-15 17:31 Dario Teixeira
2009-01-19 15:09 ` [Caml-list] " Dario Teixeira
2009-01-20 16:33   ` Dario Teixeira
2009-01-20 17:29     ` Jacques Carette
2009-01-20 17:48       ` Dario Teixeira
2009-01-21 10:48       ` Jacques Garrigue
2009-01-21 10:38     ` Jacques Garrigue
2009-01-21 13:22   ` Jacques Garrigue
2009-01-21 19:11     ` Dario Teixeira
2009-01-21 20:17       ` Gabriel Kerneis
2009-01-22  1:36       ` Jacques Garrigue

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=918954.90415.qm@web111505.mail.gq1.yahoo.com \
    --to=darioteixeira@yahoo.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=garrigue@math.nagoya-u.ac.jp \
    /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).