Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
typing problem with sexplib and mutually recursive polymorphic types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Yoann Padioleau <padator@w...>
Subject: Re: [Caml-list] typing problem with sexplib and mutually recursive polymorphic types
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:

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. 


> Cheers,
> Yitzhak
> On Mar 11, 2009, at 10:20 AM, Markus Mottl wrote:
>> On Wed, Mar 11, 2009 at 02:11, yoann padioleau <>
>> 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
>> _______________________________________________
>> Caml-list mailing list. Subscription management:
>> Archives:
>> Beginner's list:
>> Bug reports:
> -----------------------------
> Yitzhak Mandelbaum