Boris Yakobowski bo...@yakobowski.org writes:
On Tue, Dec 22, 2009 at 2:35 PM, Goswin von Brederlow goswin-...@web.de
wrote:
But the type inference should deduce that in
(Obj.magic fn) x
the 'a is actually 'b - 'c as I am applying an argument to it.
Sure, and it does. But it remains
Boris Yakobowski bo...@yakobowski.org writes:
On Mon, Dec 21, 2009 at 2:44 PM, Goswin von Brederlow goswin-...@web.de
wrote:
However it issues a warning so i acknowledge it's less elegant.
Which I don't quite understand.
The warning is based on the results of the type inference algorithm.
Damien Guichard alphabl...@orange.fr writes:
I once faced this situation and the solution is to use modules.
That is one good practical solution.
The simpler solution that immediatly came to my mind is eta-expansion.
type foo = {bar : 'a. 'a - 'a}
let a : int - int = fun x - x
let
On Mon, Dec 21, 2009 at 2:44 PM, Goswin von Brederlow goswin-...@web.de wrote:
However it issues a warning so i acknowledge it's less elegant.
Which I don't quite understand.
The warning is based on the results of the type inference algorithm.
You're not supposed to find values of type 'a. 'a
right, the use case is totally wrong
I'm automatically generating code from type declarations using camlp4 and it
would break down in presence of polymorphic record fields.
Here's the fix I chose (Thanks to Mr. Pouillard):
module type MagicSignature =
sig
val x : 'a
end
and I would replace
Excerpts from Jacques Le Normand's message of Sun Dec 20 18:44:57 +0100 2009:
Dear ocaml-list,
the following code does not type check:
type foo = {bar : 'a. 'a - 'a}
let a : int - int = fun x - x
let baz = {bar = Obj.magic a}
with the error
Error: This field value has type 'a - 'a