caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Yoann Padioleau <padator@wanadoo.fr>
To: Yitzhak Mandelbaum <yitzhakm@CS.Princeton.EDU>
Cc: Markus Mottl <markus.mottl@gmail.com>,
	yoann padioleau <padator@wanadoo.fr>,
	Caml-list List <caml-list@inria.fr>
Subject: Re: [Caml-list] typing problem with sexplib and mutually recursive  polymorphic types
Date: Wed, 11 Mar 2009 18:08:37 -0500	[thread overview]
Message-ID: <87ljrby7wq.fsf@aryx.cs.uiuc.edu> (raw)
In-Reply-To: <6D1EF1C5-3561-4D45-AE32-48F80EC84E58@cs.princeton.edu> (Yitzhak Mandelbaum's message of "Wed\, 11 Mar 2009 10\:32\:26 -0400")

Yitzhak Mandelbaum <yitzhakm@CS.Princeton.EDU> writes:

> While I'm not sure it will help you in this case (because the code is
> generated), 

The code is generated, but I am ok with modifying it. I use 
typeconv/sexplib/binprot and camlp4 just as a way to produce a first draft
and then I refine the result. I prefer to see the generated code
and have concrete files (and in this case in fact I have no
choice as the the default generated code is not good enough).

> I should note that type *inference* for polymorphic
> recursion is undecidable, but type *checking* is not. Moreover, its
> pretty easy to do in OCaml (if a bit clunky).
>
> An earlier discussion on this list covered a number of ways to do it.
> Here's one:
>
> http://groups.google.com/group/fa.caml/msg/d85e3f62dd52d365

Thanks. I tried the {f: 'a. 'a } trick and it works on my
simplified example but I failed using it on my original file. Never mind,
I artificially broke the mutually recursive dependency
and now it works. 

Thanks.

>
> Cheers,
> Yitzhak
>
>
> On Mar 11, 2009, at 10:20 AM, Markus Mottl wrote:
>
>> On Wed, Mar 11, 2009 at 02:11, yoann padioleau <padator@wanadoo.fr>
>> wrote:
>>> Yes on this example, but what if I can't move it out because
>>> the types really need to be mutually recursive ?
>>
>> I'm afraid, I don't see any straightforward way of achieving this
>> goal.  If the above were allowed in a truly recursive way, you'd
>> essentially end up with polymorphic recursion, which is undecidable.
>>
>> Regards,
>> Markus
>>
>> -- 
>> Markus Mottl        http://www.ocaml.info
>> markus.mottl@gmail.com
>>
>> _______________________________________________
>> Caml-list mailing list. Subscription management:
>> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
>> Archives: http://caml.inria.fr
>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
> -----------------------------
> Yitzhak Mandelbaum


      parent reply	other threads:[~2009-03-11 23:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-11  2:45 Yoann Padioleau
2009-03-11  4:25 ` [Caml-list] " Markus Mottl
2009-03-11  6:11   ` yoann padioleau
2009-03-11 14:20     ` Markus Mottl
2009-03-11 14:32       ` Yitzhak Mandelbaum
2009-03-11 14:44         ` Markus Mottl
2009-03-11 16:16           ` Damien Doligez
2009-03-11 16:43             ` Markus Mottl
2009-03-11 19:03               ` Till Varoquaux
2009-03-12  1:42               ` Jacques Garrigue
2009-03-11 23:08         ` Yoann Padioleau [this message]

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=87ljrby7wq.fsf@aryx.cs.uiuc.edu \
    --to=padator@wanadoo.fr \
    --cc=caml-list@inria.fr \
    --cc=markus.mottl@gmail.com \
    --cc=yitzhakm@CS.Princeton.EDU \
    /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).