From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.0 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST,DNS_FROM_RFC_WHOIS autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id F3537BB84 for ; Mon, 26 Jan 2009 16:13:40 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AucCAFNhfUlDww+dkWdsb2JhbACOb4UPAQEBAQkLCgcRp3yNSAUCAYVIhHI X-IronPort-AV: E=Sophos;i="4.37,325,1231110000"; d="scan'208";a="20175091" Received: from web111505.mail.gq1.yahoo.com ([67.195.15.157]) by mail2-smtp-roc.national.inria.fr with SMTP; 26 Jan 2009 16:13:40 +0100 Received: (qmail 91776 invoked by uid 60001); 26 Jan 2009 15:13:38 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=o61fntZP1G3ewPPUfkAxE65SzyvAhxAJr1oKVDgFmEigbnbus9cMTr5Py9lzTkcqzEWsbAzSUZ2Br/rJnhQf9K1kSEQQb+oD5G8J+0lBdsZXBCgd1XwzHwmGK4qSS+pxjGJxOd8FmIU13p5AmyKfh4+XOneLNE0EglXl+I5VBxE=; X-YMail-OSG: j7SRU4UVM1nX7x0jyHdSqE7CN.H0nFIWUb7wtDdr.SI3O8gMW5TAco8mtG56yApKlspoTqB4kM3TjZJWZAy0dwHGFbl8.mzVYBnWTk0f_FE5MSKxZUBPkRVieDD9rZaOQTuI0mxHTtzIOpaS5K54.n8Hdbg1koqE.45lBi1_5nQLjcRmJ.sr2V.bRGMReQ-- Received: from [213.205.71.62] by web111505.mail.gq1.yahoo.com via HTTP; Mon, 26 Jan 2009 07:13:38 PST X-Mailer: YahooMailWebService/0.7.260.1 Date: Mon, 26 Jan 2009 07:13:38 -0800 (PST) From: Dario Teixeira Subject: Re: [Caml-list] Private types in 3.11, again To: Jacques Garrigue Cc: caml-list@yquem.inria.fr MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-ID: <918954.90415.qm@web111505.mail.gq1.yahoo.com> X-Spam: no; 0.00; haskell:01 wiki:01 ocaml:01 model:01 ocaml:01 instanciate:01 deficit:98 polymorphic:01 caml-list:01 expressive:01 expression:02 variables:02 cons:04 fix:05 types:05 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 =0A=0A=0A