caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Christoph Höger" <christoph.hoeger@tu-berlin.de>
To: Ocaml Mailing List <caml-list@inria.fr>
Subject: [Caml-list] Bug or useless error message
Date: Thu, 27 Aug 2015 15:52:17 +0200	[thread overview]
Message-ID: <55DF1611.8020408@tu-berlin.de> (raw)

Dear all,

right now I am unable to produce a working example of that problem, so
please bear with me.

Basically, I just patched ppx_deriving_yojson to generate polymorphic
functions for recursive types, i.e.

type 'a foo = ...
 and bar = int foo [@@deriving yojson]

becomes

let rec foo_of_yojson : 'a. (json -> [`Ok of 'a, `Error of string]) ->
json -> [`Ok of 'a, `Error of string] = ...
and bar_of_yojson = ...

this does, indeed, work in the test cases.

If I apply this method to my (large) real world module, I get a strange
error:

Error: Signature mismatch:
       ...
       Values do not match:
         val typedef_struct_of_yojson :
           (Yojson.Safe.json -> [ `Error of string | `Ok of 'a ]) ->
           Yojson.Safe.json ->
           [ `Error of string | `Ok of 'a typedef_struct ]
       is not included in
         val typedef_struct_of_yojson :
           (Yojson.Safe.json -> [ `Error of string | `Ok of 'a ]) ->
           Yojson.Safe.json ->
           [ `Error of string | `Ok of 'a typedef_struct ]

Syntactically, the types are the same, but obviously they are not equal
in their internal representation.

I can workaround this problem by hiding this particular function from
the interface (yes, it only occurs in one function out of ~300).
However, this message bugs me: Is something like this expected when
using explicit generalization?

regards,

Christoph

-- 
Christoph Höger

Technische Universität Berlin
Fakultät IV - Elektrotechnik und Informatik
Übersetzerbau und Programmiersprachen

Sekr. TEL12-2, Ernst-Reuter-Platz 7, 10587 Berlin

Tel.: +49 (30) 314-24890
E-Mail: christoph.hoeger@tu-berlin.de

             reply	other threads:[~2015-08-27 13:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-27 13:52 Christoph Höger [this message]
2015-08-27 14:10 ` Jacques Garrigue

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=55DF1611.8020408@tu-berlin.de \
    --to=christoph.hoeger@tu-berlin.de \
    --cc=caml-list@inria.fr \
    /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).