text: // Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE
  'use strict';
  
  var Json_decode = require("@glennsl/bs-json/src/Json_decode.bs.js");
  
  function parseCatFactJson(json) {
    return {
            id: Json_decode.field("_id", Json_decode.string, json),
            text: Json_decode.field("text", Json_decode.string, json),
            upvotes: Json_decode.field("upvotes", Json_decode.$$int, json)
          };
  }
  
  function parseCatFactsResponseJson(json) {
    return Json_decode.field("all", (function (param) {
                  return Json_decode.array(parseCatFactJson, param);
                }), json);
  }
  
  var catFactsUrl = "https://cors-anywhere.herokuapp.com/https://cat-fact.herokuapp.com/facts";
  
  function fetchCatFacts(param) {
    return fetch(catFactsUrl).then(function (prim) {
                  return prim.text();
                }).then(function (jsonText) {
                return Promise.resolve(parseCatFactsResponseJson(JSON.parse(jsonText)));
              });
  }
  
  exports.parseCatFactJson = parseCatFactJson;
  exports.parseCatFactsResponseJson = parseCatFactsResponseJson;
  exports.catFactsUrl = catFactsUrl;
  exports.fetchCatFacts = fetchCatFacts;
  /* No side effect */
  