caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] OCaml piqi difficulties
@ 2015-06-09 20:34 Kenneth Adam Miller
  2015-06-09 22:48 ` Kenneth Adam Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Kenneth Adam Miller @ 2015-06-09 20:34 UTC (permalink / raw)
  To: caml users, piqi

[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] OCaml piqi difficulties
  2015-06-09 20:34 [Caml-list] OCaml piqi difficulties Kenneth Adam Miller
@ 2015-06-09 22:48 ` Kenneth Adam Miller
  2015-06-10  8:56   ` Anton Lavrik
  0 siblings, 1 reply; 3+ messages in thread
From: Kenneth Adam Miller @ 2015-06-09 22:48 UTC (permalink / raw)
  To: caml users, piqi

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

To be more clear, after I thought about it a bit more, I think what I need
is definitely one of two things, either:

1) to edit is the include path, either for ocamlbuild or oasis. The problem
is, the implementation for a module is already in the library path... In
this way, it will know where to find the appropriate ml, or cmi, cmo/x
2) tell piqi how to fully qualify the module into the other library.
 -> http://piqi.org/doc/ocaml/#piqitoocamlmapping
Speak of the devil, I think that might be it!

*edit*
OK, so I think I got it down... now it's just a piqi usage issue.I can edit
the library interface that I'm using to expose that functionality. Now I
need to know:

.import [ module stmt .name XYZ ]

once I expose the module name, and I should be able to force it to be fully
qualified with the above. Problem is, I need to have the module name be
Bap.Std.Bap_types.Bil_types.Bil_piqi; the periods are required. Problem: I
can't put periods or '/' in the name of the module in order to get it to
work. Variations on quotes didn't seem to make a difference either...

How to get piqi to accept a fully qualified name?

On Tue, Jun 9, 2015 at 4:34 PM, Kenneth Adam Miller <
kennethadammiller@gmail.com> wrote:

> 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: 7885 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] OCaml piqi difficulties
  2015-06-09 22:48 ` Kenneth Adam Miller
@ 2015-06-10  8:56   ` Anton Lavrik
  0 siblings, 0 replies; 3+ messages in thread
From: Anton Lavrik @ 2015-06-10  8:56 UTC (permalink / raw)
  To: piqi; +Cc: caml users

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

Hi Kenneth, please see my comment here:
https://github.com/alavrik/piqi-ocaml/issues/7 I've added a small change
that should help.

Anton

On Tue, Jun 9, 2015 at 3:48 PM, Kenneth Adam Miller <
kennethadammiller@gmail.com> wrote:

> To be more clear, after I thought about it a bit more, I think what I need
> is definitely one of two things, either:
>
> 1) to edit is the include path, either for ocamlbuild or oasis. The
> problem is, the implementation for a module is already in the library
> path... In this way, it will know where to find the appropriate ml, or cmi,
> cmo/x
> 2) tell piqi how to fully qualify the module into the other library.
>  -> http://piqi.org/doc/ocaml/#piqitoocamlmapping
> Speak of the devil, I think that might be it!
>
> *edit*
> OK, so I think I got it down... now it's just a piqi usage issue.I can
> edit the library interface that I'm using to expose that functionality. Now
> I need to know:
>
> .import [ module stmt .name XYZ ]
>
> once I expose the module name, and I should be able to force it to be
> fully qualified with the above. Problem is, I need to have the module name
> be Bap.Std.Bap_types.Bil_types.Bil_piqi; the periods are required. Problem:
> I can't put periods or '/' in the name of the module in order to get it to
> work. Variations on quotes didn't seem to make a difference either...
>
> How to get piqi to accept a fully qualified name?
>
> On Tue, Jun 9, 2015 at 4:34 PM, Kenneth Adam Miller <
> kennethadammiller@gmail.com> wrote:
>
>> 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?
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "piqi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to piqi+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-10  8:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-09 20:34 [Caml-list] OCaml piqi difficulties Kenneth Adam Miller
2015-06-09 22:48 ` Kenneth Adam Miller
2015-06-10  8:56   ` Anton Lavrik

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).