How to use the @glennsl/bs-json/src/Json_decode.bs.js.either function in @glennsl/bs-json

To help you get started, we’ve selected a few @glennsl/bs-json examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rebench / rebench.github.io / src / model / Model.bs.js View on Github external
switch (language$1) {
    case "js" : 
        return /* JS */16585;
    case "ml" : 
        return /* ML */17247;
    case "re" : 
        return /* RE */18355;
    default:
      throw [
            Json_decode.DecodeError,
            "Unknown language: " + (String(language$1) + "")
          ];
  }
}

var test = Json_decode.either((function (param) {
        return Json_decode.map((function (param) {
                      return /* record */[
                              /* id */param[0],
                              /* language */param[1],
                              /* code */param[2]
                            ];
                    }), (function (param) {
                      return Json_decode.tuple3(id, language, Json_decode.string, param);
                    }), param);
      }), (function (param) {
        return Json_decode.map((function (param) {
                      return /* record */[
                              /* id */param[0],
                              /* language : RE */18355,
                              /* code */param[1]
                            ];