caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: "Christoph Höger" <christoph.hoeger@tu-berlin.de>
Cc: OCaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Bug or useless error message
Date: Thu, 27 Aug 2015 23:10:38 +0900	[thread overview]
Message-ID: <0F5E857D-B7D0-4A2A-B1EA-DAA2E6596580@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <55DF1611.8020408@tu-berlin.de>

You should submit a bug report, with all the source files required.
Impossible to tell you anything without more information.

Jacques Garrigue

On 2015/08/27 22:52, Christoph Höger wrote:
> 
> 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




      reply	other threads:[~2015-08-27 14:10 UTC|newest]

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

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=0F5E857D-B7D0-4A2A-B1EA-DAA2E6596580@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=christoph.hoeger@tu-berlin.de \
    /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).