text: // Generated by ReScript, PLEASE EDIT WITH CARE
  'use strict';
  
  var Curry = require("bs-platform/lib/js/curry.js");
  var Caml_option = require("bs-platform/lib/js/caml_option.js");
  
  function iterTree(f, _tree) {
    while(true) {
      var tree = _tree;
      if (!tree) {
        return ;
      }
      Curry._1(f, tree._0);
      iterTree(f, tree._1);
      _tree = tree._2;
      continue ;
    };
  }
  
  function iterTreeCps(f, tree, cont) {
    if (!tree) {
      return Curry._1(cont, undefined);
    }
    var right = tree._2;
    var left = tree._1;
    return Curry._2(f, tree._0, (function (param) {
                  return iterTreeCps(f, left, (function (param) {
                                return iterTreeCps(f, right, cont);
                              }));
                }));
  }
  
  function ofTree(tr) {
    var next = {
      contents: undefined
    };
    var visitTree = function (t, cont) {
      if (!t) {
        return Curry._1(cont, undefined);
      }
      var right = t._2;
      var left = t._1;
      next.contents = (function (param) {
          return visitTree(left, (function (param) {
                        return visitTree(right, cont);
                      }));
        });
      return Caml_option.some(t._0);
    };
    next.contents = (function (param) {
        return visitTree(tr, (function (param) {
                      
                    }));
      });
    return function (param) {
      var func = next.contents;
      if (func !== undefined) {
        next.contents = undefined;
        return Curry._1(func, undefined);
      }
      
    };
  }
  
  exports.iterTree = iterTree;
  exports.iterTreeCps = iterTreeCps;
  exports.ofTree = ofTree;
  /* No side effect */
  