Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can i use it in reasonml? #89

Open
useada opened this issue Jan 5, 2019 · 3 comments
Open

Can i use it in reasonml? #89

useada opened this issue Jan 5, 2019 · 3 comments

Comments

@useada
Copy link

useada commented Jan 5, 2019

I use it in reasonml, compile with esy/dune, but got some error like this:

`
This is a syntax error.

Note: the location indicated might not be accurate.

error: command failed: 'refmterr' 'dune' 'build' '-p' 'hello-reason'
esy-build-package: exiting with errors above...
error: build failed
building [email protected]
esy: exiting due to errors above
`

my dune file likes this:

(preprocess (pps lwt_ppx ppx_deriving_yojson)) (libraries yojson core ppx_deriving_yojson.runtime)

What am I doing wrong?

@rizo
Copy link

rizo commented Jan 17, 2019

You haven't shown the most important part – the syntax error in your source code.

In any case, I created a simple esy+dune project with ppx_deriving_yojson.

package.json:

{
  "name": "issue-89",
  "version": "0.0.0",
  "description": "Yojson ppx",
  "license": "MIT",
  "esy": {
    "build": "refmterr dune build"
  },
  "dependencies": {
    "refmterr": "*",
    "@opam/dune": "*",
    "ocaml": "4.6.x",
    "@esy-ocaml/reason": "*",
    "@opam/ppx_deriving_yojson": "*"
  }
}

dune:

(executable
  (public_name Main)
  (preprocess (pps ppx_deriving_yojson))
  (libraries yojson))

Main.re:

[@deriving yojson]
type person = {
  name: string,
  age: int
};

let json = person_to_yojson({ name: "Karel", age: 30 });
print_endline(Yojson.Safe.to_string(json));

With this you should be able to run esy install; esy build; esy x Main.

Hope this helps.

@roddycx
Copy link

roddycx commented Aug 20, 2019

What about using BuckleScript? I think that just needs an executable but I'm not sure where to get that.

@roddyyaga
Copy link

Update: yes you can use it in BuckleScript; see my fork here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants