Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Polymorphic recursion
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@k...>
Subject: Re: [Caml-list] Polymorphic recursion
From: "Lukasz Stafiniak" <l_stafiniak@hoga.pl>

> I have recently encountered some very interesting notions (cited below).
> Although I've been using OCaml for some time, up to now I didn't know about
> the existence of polymorphic records and (their reference to) the problem of
> polymorphic recursion. Perhaps a word about it should be stated in the
> manual (more evidently)? (I don't even recall to have seen the syntax in the
> manual for this.)

It is in the tutorial, but maybe confusingly under "mutable fields".

> With Your help I ventured again to "typecheck my programs before they are
> generated" etc. But now I get an error I totally don't understand. (Still it
> somehow resembles the problem it posed as an ordinary function.) Could
> someone explain? I have attached the file.

The error message I get is:
File "typedcode.ml", line 55, characters 2-420:
This field value has type
  'a annot annot valu_env option -> 'a annot valu -> 'a annot valu_env
which is less general than 'b. 'b valu_env option -> 'b valu -> 'b valu_env

Which just means that since 'a annot is not a type variable, it is
less general than valu.
Actually, it seems that the type checker is overly restrictive, as
you have defined
  type 'a annot = 'a
Note that such definitions make lots of thing more difficult, and I am
starting to desespair to handle them fully correctly: they make it
impossible to assume that 'a annot is really not a type variable.
I'll try to fix it anyway.

Jacques Garrigue

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners