Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Kenneth Adam Miller <kennethadammiller@gmail.com>
To: caml users <caml-list@inria.fr>, piqi@googlegroups.com
Subject: [Caml-list] OCaml piqi difficulties
Date: Tue, 9 Jun 2015 16:34:31 -0400	[thread overview]
Message-ID: <CAK7rcp8EdJJKuWf1Nc3CRFDenT_ueJV5oAz4yNaz8W05biaxNQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2715 bytes --]

I've been using piqi for quite a while and it's done wonders for me.

Lately though, I've had some issues with transforming some types provided
by another library into a piqi representation.

Essentially, I'm at a crossroads where I'm running into a compile error,
and I'm not sure how to fix it. Here's the root of my problem:

Error: This expression has type Stmt_piqi.stmt list list
       but an expression was expected of type
         Bapservice_piqi.Bapservice_piqi.lifted_region =
           Bapservice_piqi.Bapservice_piqi.stmt_list list
       Type Stmt_piqi.stmt list is not compatible with type
         Bapservice_piqi.Bapservice_piqi.stmt_list =
           Bapservice_piqi.Bapservice_piqi.stmt list
       Type Stmt_piqi.stmt is not compatible with type
         Bapservice_piqi.Bapservice_piqi.stmt =
           [ `cpuexn of Bapservice_piqi.Bapservice_piqi.cpuexn
           | `if_stmt of Bapservice_piqi.Bapservice_piqi.if_stmt
           | `jmp of Bapservice_piqi.Bapservice_piqi.jmp
           | `move of Bapservice_piqi.Bapservice_piqi.move
           | `special of Bapservice_piqi.Bapservice_piqi.special
           | `while_stmt of Bapservice_piqi.Bapservice_piqi.while_stmt ]



lifted_region is defined in my piqi file as a stmt list list (a list of
instructions). Here's the part that I don't know: in piqi do I import the
module instead of including it in order to get the compiler to see that the
types are equivalent?

(because they are, this is very much like debugging a phantom type error.
Stmt_piqi.stmt is the same as Bapservice_piqi.stmt).

My thinking with the above question is that if I import the module in piqi,
then the piqi command will *not* generate a whole new ml, different
entirely to the ml that was compiled and included in the library that I'm
using, bap (it currently *is*). In that case, the types will be equivalent
and everything will compile nicely.

But I attempted to import the module in my piqi file, and that results in
some compile error that I don't know how to solve:

Unbound module Stmt_piqi.

Naturally, in my makefile for generating ml of piqi encoder/decoder ocaml
modules, I have an include that points to the folder that contains the bap
stmt.piqi file. So the piqi ocaml command succeeds, but now I need to tell
ocaml how to resolve the stmt_piqi module (compiled away in
bap.serialization). I'm using oasis, and I already have bap.serialization
in my depends, and the generated piqi ml file is auto detected and the
correct bap.serialization is propagated through as a specified package on
the command line.

How do I get the compiler to either see type equivalence of the
Bapservice_piqi.stmt type or to know where to get the Stmt_piqi module?

[-- Attachment #2: Type: text/html, Size: 6126 bytes --]

             reply	other threads:[~2015-06-09 20:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-09 20:34 Kenneth Adam Miller [this message]
2015-06-09 22:48 ` Kenneth Adam Miller
2015-06-10  8:56   ` Anton Lavrik

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=CAK7rcp8EdJJKuWf1Nc3CRFDenT_ueJV5oAz4yNaz8W05biaxNQ@mail.gmail.com \
    --to=kennethadammiller@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=piqi@googlegroups.com \
    /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