text: // Generated by Melange
  'use strict';
  
  var Curry = require("bs-platform/lib/js/curry.js");
  var Caml_obj = require("bs-platform/lib/js/caml_obj.js");
  var Caml_int32 = require("bs-platform/lib/js/caml_int32.js");
  
  function Make(Sym) {
    var pow = function (a, n, m) {
      var _n = n;
      var _acc = 1;
      while(true) {
        var acc = _acc;
        var n$1 = _n;
        if (n$1 === 0) {
          return acc;
        }
        _acc = Caml_int32.mod_(Math.imul(acc, a), m);
        _n = n$1 - 1 | 0;
        continue ;
      };
    };
    var create = function (p) {
      return {
              u: {
                contents: 0
              },
              d: {
                contents: 0
              },
              p: p
            };
    };
    var append = function (param, c) {
      var d = param.d;
      var u = param.u;
      u.contents = Caml_int32.mod_(Math.imul(u.contents, Sym.size) + Curry._1(Sym.ord, c) | 0, param.p);
      d.contents = d.contents + 1 | 0;
      
    };
    var skip = function (param, c) {
      var p = param.p;
      var d = param.d;
      var u = param.u;
      var mod = function (a, b) {
        return Caml_int32.mod_(Caml_int32.mod_(a, b) + b | 0, b);
      };
      u.contents = mod(u.contents - Math.imul(Curry._1(Sym.ord, c), pow(Sym.size, d.contents - 1 | 0, p)) | 0, p);
      d.contents = d.contents - 1 | 0;
      
    };
    var compare = Caml_obj.caml_equal;
    return {
            create: create,
            append: append,
            skip: skip,
            compare: compare
          };
  }
  
  exports.Make = Make;
  /* No side effect */
  