Version française
Home     About     Download     Resources     Contact us    
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: Markus Mottl <markus.mottl@g...>
Subject: Re: [Caml-list] typing problem with sexplib and mutually recursive polymorphic types
On Wed, Mar 11, 2009 at 10:32, Yitzhak Mandelbaum
<yitzhakm@cs.princeton.edu> wrote:
> While I'm not sure it will help you in this case (because the code is
> generated), 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).

That's true, but unlike Haskell OCaml doesn't have mandatory types.
This means the user can't force the compiler to start out with
user-provided type declarations.  The OCaml compiler will always run
type inference first and only try to unify the result with the
user-provided type declaration, i.e. when it's too late.

Of course, there are workarounds (recursive modules, polymorphic
record fields), but, as you said, they are clunky indeed...

Cheers,
Markus

-- 
Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com