janestreet / ppx_sexp_conv

Generation of S-expression conversion functions from type definitions
MIT License
88 stars 17 forks source link

What should I #require in utop so that it works? #4

Closed UnixJunkie closed 8 years ago

UnixJunkie commented 8 years ago
#require "i_dont_know_what";;
type t = Int of int | Float of float [@@deriving sexp];;

Thanks a lot !

ghost commented 8 years ago

You can do this:

#require "core,ppx_jane";;
open Core.Std;;
type t = Int of int | Float of float [@@deriving sexp];;
yminsky commented 8 years ago

Or

#require "ppx_sexp_conv"

if you want just the sexplib converter. And you can open Sexplib.Std instead of Core.Std for that case as well.

UnixJunkie commented 8 years ago

Thanks for the answers. I will try the minimalist way using (open Sexplib.std), and not pull the whole core just for that.

UnixJunkie commented 8 years ago

OK, it works in utop:

#require "ppx_sexp_conv";;
open Sexplib.Std
type t = {
  i: int;
  f: float
} [@@deriving sexp];;
UnixJunkie commented 8 years ago

Is it possible to compile such code with an ocamlbuild one-liner and no _tags and myocamlbuild.ml files ?

ghost commented 8 years ago

This should do: ocamlbuild -use-ocamlfind -pkg ppx_sexp_conv

UnixJunkie commented 8 years ago

Indeed, thanks!

agarwal commented 8 years ago

This issue is resolved. It can be closed.