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

Dont Repeat Yourself/Open Helper #4

Open
idkjs opened this issue Nov 16, 2017 · 0 comments
Open

Dont Repeat Yourself/Open Helper #4

idkjs opened this issue Nov 16, 2017 · 0 comments

Comments

@idkjs
Copy link

idkjs commented Nov 16, 2017

At the Don't Repeat Yourself/ open helper section of your demo. The following proposed code throws an error:

let parseRepoJson = (json: repo) =>
  Json.Decode.{
    full_name: field("full_name", string, json),
    stargazers_count: field("stargazers_count", int, json),
    html_url: field("html_url", string, json)
  };

-error:

./src/index.re
Module build failed: Error: We've found a bug for you!
  /Users/shingdev/code/REASON/reason-repo-list/src/RepoData.re 29:41-44

  27 │ let parseRepoJson = (json: repo) =>
  28 │ Json.Decode.{
  29 │   full_name: field("full_name", string, json),
  30 │   stargazers_count: field("stargazers_count", int, json),
  31 │   html_url: field("html_url", string, json)

  This is:
    repo
  But somewhere wanted:
    at <anonymous>ined as Js.Json.t)

Adding back the Js.Json.t from the original verbose example makes the error go away.

let parseRepoJson = (json: Js.Json.t): repo =>
 Json.Decode.{
  full_name: field("full_name", string, json),
  stargazers_count: field("stargazers_count", int, json),
  html_url: field("html_url", string, json)
};

Not sure if this is what you intended.

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

1 participant