You are the wrong version of camlp4 (the different campl4 binaries
load different libraries, syntaxes etc...). If you switch camlp4orf to
camlp4o your code should compile fine. Also note that I would
recommend using the excellent ocamlfind tool:

ocamlfind c -linkpkg -package sexplib,sexplib.syntax -syntax camlp4o main.ml

Till

On Wed, Mar 7, 2012 at 12:28 PM, Matej Košík
<5764c029b688c1c0d24a2e97cd7...@gmail.com> wrote:
> Hi Markus,
>
> On 03/07/2012 05:10 PM, Markus Mottl wrote:
>> On Wed, Mar 7, 2012 at 11:44, Matej Košík
>> <5764c029b688c1c0d24a2e97cd7...@gmail.com> wrote:
>>> I have found one (I guess unnecessary) disadvantage over `deriving'.
>>> If you process your *.ml file with sexplib/bin_prot preprocessor, you
>>> have to append "with ..." suffix to every type definition, otherwise you
>>> will get a an error report from the preprocessor. `Deriving' does not
>>> force you to do that. You can annotate only those type definitions,
>>> which for you makes sense to annotate.
>>
>> I'm not sure what the perceived problem is, but there should be no
>> need to annotate all type definitions.  It should suffice to annotate
>> those for which converters are needed.
>
> The following artificial example:
>
>  open Sexplib.Conv
>  type foo = int * int with sexp
>  type bar = float * float with sexp
>
> is compilable
>
>  (e.g.:
>   ocamlc -o main -pp "camlp4of -I
> /home/mkosik/lib/godi/lib/ocaml/std-lib/../pkg-lib/sexplib -I
> /home/mkosik/lib/godi/lib/ocaml/std-lib/../pkg-lib/type-conv
> pa_type_conv.cma pa_sexp_conv.cma" -I
> /home/mkosik/lib/godi/lib/ocaml/std-lib/../pkg-lib/sexplib -I
> /home/mkosik/lib/godi/lib/ocaml/std-lib/../pkg-lib/type-conv unix.cma
> nums.cma bigarray.cma sexplib.cma main.ml
>  )
>
> If you remove any of the "with sexp" clauses, you will get a
> preprocessor error:
>
>  File "main.ml", line 4, characters 18-23:
>  Parse error: "with" expected after [type_declaration] (in [str_item])
>  File "main.ml", line 1, characters 0-1:
>
> This is at least what I am experiencing.
>
>> This, of course, means that
>> any types that a type definition is referring to will also need
>> annotations (or hand-written conversion functions).
>
> Regards,
>
> Matej Kosik
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa-roc.inria.fr/wws/info/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>


-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to