// Generated by psc-bundle 0.10.2
var PS = {};
(function(exports) {
    "use strict";

  exports.fromCharArray = function (a) {
    return a.join("");
  };

  exports._indexOf = function (just) {
    return function (nothing) {
      return function (x) {
        return function (s) {
          var i = s.indexOf(x);
          return i === -1 ? nothing : just(i);
        };
      };
    };
  };

  exports._lastIndexOf = function (just) {
    return function (nothing) {
      return function (x) {
        return function (s) {
          var i = s.lastIndexOf(x);
          return i === -1 ? nothing : just(i);
        };
      };
    };
  };

  exports.length = function (s) {
    return s.length;
  };

  exports.replace = function (s1) {
    return function (s2) {
      return function (s3) {
        return s3.replace(s1, s2);
      };
    };
  };

  exports.take = function (n) {
    return function (s) {
      return s.substr(0, n);
    };
  };

  exports.drop = function (n) {
    return function (s) {
      return s.substring(n);
    };
  };

  exports.count = function (p) {
    return function (s) {
      for (var i = 0; i < s.length && p(s.charAt(i)); i++); {}
      return i;
    };
  };

  exports.split = function (sep) {
    return function (s) {
      return s.split(sep);
    };
  };

  exports.toCharArray = function (s) {
    return s.split("");
  };

  exports.toLower = function (s) {
    return s.toLowerCase();
  };

  exports.toUpper = function (s) {
    return s.toUpperCase();
  };

  exports.trim = function (s) {
    return s.trim();
  };

  exports.joinWith = function (s) {
    return function (xs) {
      return xs.join(s);
    };
  };
})(PS["Data.String"] = PS["Data.String"] || {});
(function(exports) {
    "use strict";

  exports.arrayMap = function (f) {
    return function (arr) {
      var l = arr.length;
      var result = new Array(l);
      for (var i = 0; i < l; i++) {
        result[i] = f(arr[i]);
      }
      return result;
    };
  };
})(PS["Data.Functor"] = PS["Data.Functor"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Semigroupoid = function (compose) {
      this.compose = compose;
  };
  var semigroupoidFn = new Semigroupoid(function (f) {
      return function (g) {
          return function (x) {
              return f(g(x));
          };
      };
  });
  var compose = function (dict) {
      return dict.compose;
  };
  exports["Semigroupoid"] = Semigroupoid;
  exports["compose"] = compose;
  exports["semigroupoidFn"] = semigroupoidFn;
})(PS["Control.Semigroupoid"] = PS["Control.Semigroupoid"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Control_Semigroupoid = PS["Control.Semigroupoid"];        
  var Category = function (__superclass_Control$dotSemigroupoid$dotSemigroupoid_0, id) {
      this["__superclass_Control.Semigroupoid.Semigroupoid_0"] = __superclass_Control$dotSemigroupoid$dotSemigroupoid_0;
      this.id = id;
  };
  var id = function (dict) {
      return dict.id;
  };
  var categoryFn = new Category(function () {
      return Control_Semigroupoid.semigroupoidFn;
  }, function (x) {
      return x;
  });
  exports["Category"] = Category;
  exports["id"] = id;
  exports["categoryFn"] = categoryFn;
})(PS["Control.Category"] = PS["Control.Category"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Control_Category = PS["Control.Category"];        
  var on = function (f) {
      return function (g) {
          return function (x) {
              return function (y) {
                  return f(g(x))(g(y));
              };
          };
      };
  };
  var flip = function (f) {
      return function (b) {
          return function (a) {
              return f(a)(b);
          };
      };
  };
  var $$const = function (a) {
      return function (v) {
          return a;
      };
  };
  exports["const"] = $$const;
  exports["flip"] = flip;
  exports["on"] = on;
})(PS["Data.Function"] = PS["Data.Function"] || {});
(function(exports) {
    "use strict";

  exports.unit = {};
})(PS["Data.Unit"] = PS["Data.Unit"] || {});
(function(exports) {
    "use strict";

  exports.showIntImpl = function (n) {
    return n.toString();
  };

  exports.showStringImpl = function (s) {
    var l = s.length;
    return "\"" + s.replace(
      /[\0-\x1F\x7F"\\]/g,
      function (c, i) { // jshint ignore:line
        switch (c) {
          case "\"":
          case "\\":
            return "\\" + c;
          case "\x07": return "\\a";
          case "\b": return "\\b";
          case "\f": return "\\f";
          case "\n": return "\\n";
          case "\r": return "\\r";
          case "\t": return "\\t";
          case "\v": return "\\v";
        }
        var k = i + 1;
        var empty = k < l && s[k] >= "0" && s[k] <= "9" ? "\\&" : "";
        return "\\" + c.charCodeAt(0).toString(10) + empty;
      }
    ) + "\"";
  };

  exports.showArrayImpl = function (f) {
    return function (xs) {
      var ss = [];
      for (var i = 0, l = xs.length; i < l; i++) {
        ss[i] = f(xs[i]);
      }
      return "[" + ss.join(",") + "]";
    };
  };
})(PS["Data.Show"] = PS["Data.Show"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.Show"];     
  var Show = function (show) {
      this.show = show;
  };
  var showString = new Show($foreign.showStringImpl);
  var showInt = new Show($foreign.showIntImpl);
  var show = function (dict) {
      return dict.show;
  };
  var showArray = function (dictShow) {
      return new Show($foreign.showArrayImpl(show(dictShow)));
  };
  exports["Show"] = Show;
  exports["show"] = show;
  exports["showInt"] = showInt;
  exports["showString"] = showString;
  exports["showArray"] = showArray;
})(PS["Data.Show"] = PS["Data.Show"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.Unit"];
  var Data_Show = PS["Data.Show"];
  exports["unit"] = $foreign.unit;
})(PS["Data.Unit"] = PS["Data.Unit"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.Functor"];
  var Data_Function = PS["Data.Function"];
  var Data_Unit = PS["Data.Unit"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];        
  var Functor = function (map) {
      this.map = map;
  };
  var map = function (dict) {
      return dict.map;
  };
  var mapFlipped = function (dictFunctor) {
      return function (fa) {
          return function (f) {
              return map(dictFunctor)(f)(fa);
          };
      };
  };
  var $$void = function (dictFunctor) {
      return map(dictFunctor)(Data_Function["const"](Data_Unit.unit));
  };
  var functorFn = new Functor(Control_Semigroupoid.compose(Control_Semigroupoid.semigroupoidFn));
  var functorArray = new Functor($foreign.arrayMap);
  exports["Functor"] = Functor;
  exports["map"] = map;
  exports["mapFlipped"] = mapFlipped;
  exports["void"] = $$void;
  exports["functorFn"] = functorFn;
  exports["functorArray"] = functorArray;
})(PS["Data.Functor"] = PS["Data.Functor"] || {});
(function(exports) {
    "use strict";

  exports.concatString = function (s1) {
    return function (s2) {
      return s1 + s2;
    };
  };

  exports.concatArray = function (xs) {
    return function (ys) {
      if (xs.length === 0) return ys;
      if (ys.length === 0) return xs;
      return xs.concat(ys);
    };
  };
})(PS["Data.Semigroup"] = PS["Data.Semigroup"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.Semigroup"];
  var Data_Unit = PS["Data.Unit"];
  var Data_Void = PS["Data.Void"];        
  var Semigroup = function (append) {
      this.append = append;
  }; 
  var semigroupString = new Semigroup($foreign.concatString);
  var semigroupArray = new Semigroup($foreign.concatArray);
  var append = function (dict) {
      return dict.append;
  };
  exports["Semigroup"] = Semigroup;
  exports["append"] = append;
  exports["semigroupString"] = semigroupString;
  exports["semigroupArray"] = semigroupArray;
})(PS["Data.Semigroup"] = PS["Data.Semigroup"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Data_Functor = PS["Data.Functor"];
  var Data_Semigroup = PS["Data.Semigroup"];        
  var Alt = function (__superclass_Data$dotFunctor$dotFunctor_0, alt) {
      this["__superclass_Data.Functor.Functor_0"] = __superclass_Data$dotFunctor$dotFunctor_0;
      this.alt = alt;
  };                                                       
  var alt = function (dict) {
      return dict.alt;
  };
  exports["Alt"] = Alt;
  exports["alt"] = alt;
})(PS["Control.Alt"] = PS["Control.Alt"] || {});
(function(exports) {
    "use strict";

  exports.arrayApply = function (fs) {
    return function (xs) {
      var result = [];
      var n = 0;
      for (var i = 0, l = fs.length; i < l; i++) {
        for (var j = 0, k = xs.length; j < k; j++) {
          result[n++] = fs[i](xs[j]);
        }
      }
      return result;
    };
  };
})(PS["Control.Apply"] = PS["Control.Apply"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Control.Apply"];
  var Data_Functor = PS["Data.Functor"];
  var Data_Function = PS["Data.Function"];
  var Control_Category = PS["Control.Category"];        
  var Apply = function (__superclass_Data$dotFunctor$dotFunctor_0, apply) {
      this["__superclass_Data.Functor.Functor_0"] = __superclass_Data$dotFunctor$dotFunctor_0;
      this.apply = apply;
  }; 
  var applyArray = new Apply(function () {
      return Data_Functor.functorArray;
  }, $foreign.arrayApply);
  var apply = function (dict) {
      return dict.apply;
  };
  var applySecond = function (dictApply) {
      return function (a) {
          return function (b) {
              return apply(dictApply)(Data_Functor.map(dictApply["__superclass_Data.Functor.Functor_0"]())(Data_Function["const"](Control_Category.id(Control_Category.categoryFn)))(a))(b);
          };
      };
  };
  var lift2 = function (dictApply) {
      return function (f) {
          return function (a) {
              return function (b) {
                  return apply(dictApply)(Data_Functor.map(dictApply["__superclass_Data.Functor.Functor_0"]())(f)(a))(b);
              };
          };
      };
  };
  exports["Apply"] = Apply;
  exports["apply"] = apply;
  exports["applySecond"] = applySecond;
  exports["lift2"] = lift2;
  exports["applyArray"] = applyArray;
})(PS["Control.Apply"] = PS["Control.Apply"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Control_Apply = PS["Control.Apply"];
  var Data_Functor = PS["Data.Functor"];
  var Data_Unit = PS["Data.Unit"];        
  var Applicative = function (__superclass_Control$dotApply$dotApply_0, pure) {
      this["__superclass_Control.Apply.Apply_0"] = __superclass_Control$dotApply$dotApply_0;
      this.pure = pure;
  };
  var pure = function (dict) {
      return dict.pure;
  };
  var unless = function (dictApplicative) {
      return function (v) {
          return function (v1) {
              if (!v) {
                  return v1;
              };
              if (v) {
                  return pure(dictApplicative)(Data_Unit.unit);
              };
              throw new Error("Failed pattern match at Control.Applicative line 63, column 1 - line 63, column 19: " + [ v.constructor.name, v1.constructor.name ]);
          };
      };
  };
  var when = function (dictApplicative) {
      return function (v) {
          return function (v1) {
              if (v) {
                  return v1;
              };
              if (!v) {
                  return pure(dictApplicative)(Data_Unit.unit);
              };
              throw new Error("Failed pattern match at Control.Applicative line 58, column 1 - line 58, column 16: " + [ v.constructor.name, v1.constructor.name ]);
          };
      };
  };
  var liftA1 = function (dictApplicative) {
      return function (f) {
          return function (a) {
              return Control_Apply.apply(dictApplicative["__superclass_Control.Apply.Apply_0"]())(pure(dictApplicative)(f))(a);
          };
      };
  };
  exports["Applicative"] = Applicative;
  exports["liftA1"] = liftA1;
  exports["pure"] = pure;
  exports["unless"] = unless;
  exports["when"] = when;
})(PS["Control.Applicative"] = PS["Control.Applicative"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Control_Alt = PS["Control.Alt"];
  var Data_Functor = PS["Data.Functor"];        
  var Plus = function (__superclass_Control$dotAlt$dotAlt_0, empty) {
      this["__superclass_Control.Alt.Alt_0"] = __superclass_Control$dotAlt$dotAlt_0;
      this.empty = empty;
  };       
  var empty = function (dict) {
      return dict.empty;
  };
  exports["Plus"] = Plus;
  exports["empty"] = empty;
})(PS["Control.Plus"] = PS["Control.Plus"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Control_Alt = PS["Control.Alt"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Plus = PS["Control.Plus"];
  var Data_Functor = PS["Data.Functor"];        
  var Alternative = function (__superclass_Control$dotApplicative$dotApplicative_0, __superclass_Control$dotPlus$dotPlus_1) {
      this["__superclass_Control.Applicative.Applicative_0"] = __superclass_Control$dotApplicative$dotApplicative_0;
      this["__superclass_Control.Plus.Plus_1"] = __superclass_Control$dotPlus$dotPlus_1;
  };
  exports["Alternative"] = Alternative;
})(PS["Control.Alternative"] = PS["Control.Alternative"] || {});
(function(exports) {
    "use strict";

  exports.arrayBind = function (arr) {
    return function (f) {
      var result = [];
      for (var i = 0, l = arr.length; i < l; i++) {
        Array.prototype.push.apply(result, f(arr[i]));
      }
      return result;
    };
  };
})(PS["Control.Bind"] = PS["Control.Bind"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Control.Bind"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Category = PS["Control.Category"];
  var Data_Function = PS["Data.Function"];
  var Data_Functor = PS["Data.Functor"];        
  var Bind = function (__superclass_Control$dotApply$dotApply_0, bind) {
      this["__superclass_Control.Apply.Apply_0"] = __superclass_Control$dotApply$dotApply_0;
      this.bind = bind;
  }; 
  var bindArray = new Bind(function () {
      return Control_Apply.applyArray;
  }, $foreign.arrayBind);
  var bind = function (dict) {
      return dict.bind;
  };
  var bindFlipped = function (dictBind) {
      return Data_Function.flip(bind(dictBind));
  };
  var composeKleisli = function (dictBind) {
      return function (f) {
          return function (g) {
              return function (a) {
                  return bind(dictBind)(f(a))(g);
              };
          };
      };
  };
  exports["Bind"] = Bind;
  exports["bind"] = bind;
  exports["bindFlipped"] = bindFlipped;
  exports["composeKleisli"] = composeKleisli;
  exports["bindArray"] = bindArray;
})(PS["Control.Bind"] = PS["Control.Bind"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Bind = PS["Control.Bind"];
  var Data_Functor = PS["Data.Functor"];
  var Data_Unit = PS["Data.Unit"];        
  var Monad = function (__superclass_Control$dotApplicative$dotApplicative_0, __superclass_Control$dotBind$dotBind_1) {
      this["__superclass_Control.Applicative.Applicative_0"] = __superclass_Control$dotApplicative$dotApplicative_0;
      this["__superclass_Control.Bind.Bind_1"] = __superclass_Control$dotBind$dotBind_1;
  };
  var ap = function (dictMonad) {
      return function (f) {
          return function (a) {
              return Control_Bind.bind(dictMonad["__superclass_Control.Bind.Bind_1"]())(f)(function (v) {
                  return Control_Bind.bind(dictMonad["__superclass_Control.Bind.Bind_1"]())(a)(function (v1) {
                      return Control_Applicative.pure(dictMonad["__superclass_Control.Applicative.Applicative_0"]())(v(v1));
                  });
              });
          };
      };
  };
  exports["Monad"] = Monad;
  exports["ap"] = ap;
})(PS["Control.Monad"] = PS["Control.Monad"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Control_Alt = PS["Control.Alt"];
  var Control_Alternative = PS["Control.Alternative"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad = PS["Control.Monad"];
  var Control_Plus = PS["Control.Plus"];
  var Data_Functor = PS["Data.Functor"];
  var Data_Unit = PS["Data.Unit"];        
  var MonadZero = function (__superclass_Control$dotAlternative$dotAlternative_1, __superclass_Control$dotMonad$dotMonad_0) {
      this["__superclass_Control.Alternative.Alternative_1"] = __superclass_Control$dotAlternative$dotAlternative_1;
      this["__superclass_Control.Monad.Monad_0"] = __superclass_Control$dotMonad$dotMonad_0;
  }; 
  var guard = function (dictMonadZero) {
      return function (v) {
          if (v) {
              return Control_Applicative.pure((dictMonadZero["__superclass_Control.Alternative.Alternative_1"]())["__superclass_Control.Applicative.Applicative_0"]())(Data_Unit.unit);
          };
          if (!v) {
              return Control_Plus.empty((dictMonadZero["__superclass_Control.Alternative.Alternative_1"]())["__superclass_Control.Plus.Plus_1"]());
          };
          throw new Error("Failed pattern match at Control.MonadZero line 52, column 1 - line 52, column 23: " + [ v.constructor.name ]);
      };
  };
  exports["MonadZero"] = MonadZero;
  exports["guard"] = guard;
})(PS["Control.MonadZero"] = PS["Control.MonadZero"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Data_Function = PS["Data.Function"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Unit = PS["Data.Unit"];        
  var Monoid = function (__superclass_Data$dotSemigroup$dotSemigroup_0, mempty) {
      this["__superclass_Data.Semigroup.Semigroup_0"] = __superclass_Data$dotSemigroup$dotSemigroup_0;
      this.mempty = mempty;
  };                 
  var monoidString = new Monoid(function () {
      return Data_Semigroup.semigroupString;
  }, "");
  var monoidArray = new Monoid(function () {
      return Data_Semigroup.semigroupArray;
  }, [  ]);
  var mempty = function (dict) {
      return dict.mempty;
  };
  exports["Monoid"] = Monoid;
  exports["mempty"] = mempty;
  exports["monoidString"] = monoidString;
  exports["monoidArray"] = monoidArray;
})(PS["Data.Monoid"] = PS["Data.Monoid"] || {});
(function(exports) {
    "use strict";

  exports.refEq = function (r1) {
    return function (r2) {
      return r1 === r2;
    };
  };

  exports.eqArrayImpl = function (f) {
    return function (xs) {
      return function (ys) {
        if (xs.length !== ys.length) return false;
        for (var i = 0; i < xs.length; i++) {
          if (!f(xs[i])(ys[i])) return false;
        }
        return true;
      };
    };
  };
})(PS["Data.Eq"] = PS["Data.Eq"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.Eq"];
  var Data_Unit = PS["Data.Unit"];
  var Data_Void = PS["Data.Void"];        
  var Eq = function (eq) {
      this.eq = eq;
  }; 
  var eqString = new Eq($foreign.refEq);
  var eqInt = new Eq($foreign.refEq);
  var eqChar = new Eq($foreign.refEq);   
  var eq = function (dict) {
      return dict.eq;
  };
  var eqArray = function (dictEq) {
      return new Eq($foreign.eqArrayImpl(eq(dictEq)));
  };
  exports["Eq"] = Eq;
  exports["eq"] = eq;
  exports["eqInt"] = eqInt;
  exports["eqChar"] = eqChar;
  exports["eqString"] = eqString;
  exports["eqArray"] = eqArray;
})(PS["Data.Eq"] = PS["Data.Eq"] || {});
(function(exports) {
    "use strict";

  exports.ordArrayImpl = function (f) {
    return function (xs) {
      return function (ys) {
        var i = 0;
        var xlen = xs.length;
        var ylen = ys.length;
        while (i < xlen && i < ylen) {
          var x = xs[i];
          var y = ys[i];
          var o = f(x)(y);
          if (o !== 0) {
            return o;
          }
          i++;
        }
        if (xlen === ylen) {
          return 0;
        } else if (xlen > ylen) {
          return -1;
        } else {
          return 1;
        }
      };
    };
  };
})(PS["Data.Ord"] = PS["Data.Ord"] || {});
(function(exports) {
    "use strict";

  exports.unsafeCompareImpl = function (lt) {
    return function (eq) {
      return function (gt) {
        return function (x) {
          return function (y) {
            return x < y ? lt : x === y ? eq : gt;
          };
        };
      };
    };
  };
})(PS["Data.Ord.Unsafe"] = PS["Data.Ord.Unsafe"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Data_Eq = PS["Data.Eq"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Show = PS["Data.Show"];        
  var LT = (function () {
      function LT() {

      };
      LT.value = new LT();
      return LT;
  })();
  var GT = (function () {
      function GT() {

      };
      GT.value = new GT();
      return GT;
  })();
  var EQ = (function () {
      function EQ() {

      };
      EQ.value = new EQ();
      return EQ;
  })();
  var semigroupOrdering = new Data_Semigroup.Semigroup(function (v) {
      return function (v1) {
          if (v instanceof LT) {
              return LT.value;
          };
          if (v instanceof GT) {
              return GT.value;
          };
          if (v instanceof EQ) {
              return v1;
          };
          throw new Error("Failed pattern match at Data.Ordering line 22, column 3 - line 22, column 19: " + [ v.constructor.name, v1.constructor.name ]);
      };
  });
  var eqOrdering = new Data_Eq.Eq(function (v) {
      return function (v1) {
          if (v instanceof LT && v1 instanceof LT) {
              return true;
          };
          if (v instanceof GT && v1 instanceof GT) {
              return true;
          };
          if (v instanceof EQ && v1 instanceof EQ) {
              return true;
          };
          return false;
      };
  });
  exports["LT"] = LT;
  exports["GT"] = GT;
  exports["EQ"] = EQ;
  exports["eqOrdering"] = eqOrdering;
  exports["semigroupOrdering"] = semigroupOrdering;
})(PS["Data.Ordering"] = PS["Data.Ordering"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.Ord.Unsafe"];
  var Data_Ordering = PS["Data.Ordering"];        
  var unsafeCompare = $foreign.unsafeCompareImpl(Data_Ordering.LT.value)(Data_Ordering.EQ.value)(Data_Ordering.GT.value);
  exports["unsafeCompare"] = unsafeCompare;
})(PS["Data.Ord.Unsafe"] = PS["Data.Ord.Unsafe"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.Semiring"];
  var Data_Unit = PS["Data.Unit"];        
  var Semiring = function (add, mul, one, zero) {
      this.add = add;
      this.mul = mul;
      this.one = one;
      this.zero = zero;
  };
  var zero = function (dict) {
      return dict.zero;
  };                                                                     
  var one = function (dict) {
      return dict.one;
  };
  var mul = function (dict) {
      return dict.mul;
  };
  var add = function (dict) {
      return dict.add;
  };
  exports["Semiring"] = Semiring;
  exports["add"] = add;
  exports["mul"] = mul;
  exports["one"] = one;
  exports["zero"] = zero;
})(PS["Data.Semiring"] = PS["Data.Semiring"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.Ord"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Function = PS["Data.Function"];
  var Data_Ord_Unsafe = PS["Data.Ord.Unsafe"];
  var Data_Ordering = PS["Data.Ordering"];
  var Data_Ring = PS["Data.Ring"];
  var Data_Unit = PS["Data.Unit"];
  var Data_Void = PS["Data.Void"];
  var Data_Semiring = PS["Data.Semiring"];        
  var Ord = function (__superclass_Data$dotEq$dotEq_0, compare) {
      this["__superclass_Data.Eq.Eq_0"] = __superclass_Data$dotEq$dotEq_0;
      this.compare = compare;
  }; 
  var ordString = new Ord(function () {
      return Data_Eq.eqString;
  }, Data_Ord_Unsafe.unsafeCompare);
  var ordInt = new Ord(function () {
      return Data_Eq.eqInt;
  }, Data_Ord_Unsafe.unsafeCompare);
  var ordChar = new Ord(function () {
      return Data_Eq.eqChar;
  }, Data_Ord_Unsafe.unsafeCompare);
  var compare = function (dict) {
      return dict.compare;
  };
  var greaterThan = function (dictOrd) {
      return function (a1) {
          return function (a2) {
              var $22 = compare(dictOrd)(a1)(a2);
              if ($22 instanceof Data_Ordering.GT) {
                  return true;
              };
              return false;
          };
      };
  };
  var lessThan = function (dictOrd) {
      return function (a1) {
          return function (a2) {
              var $25 = compare(dictOrd)(a1)(a2);
              if ($25 instanceof Data_Ordering.LT) {
                  return true;
              };
              return false;
          };
      };
  };
  var ordArray = function (dictOrd) {
      return new Ord(function () {
          return Data_Eq.eqArray(dictOrd["__superclass_Data.Eq.Eq_0"]());
      }, (function () {
          var toDelta = function (x) {
              return function (y) {
                  var $29 = compare(dictOrd)(x)(y);
                  if ($29 instanceof Data_Ordering.EQ) {
                      return 0;
                  };
                  if ($29 instanceof Data_Ordering.LT) {
                      return 1;
                  };
                  if ($29 instanceof Data_Ordering.GT) {
                      return -1;
                  };
                  throw new Error("Failed pattern match at Data.Ord line 60, column 7 - line 65, column 1: " + [ $29.constructor.name ]);
              };
          };
          return function (xs) {
              return function (ys) {
                  return compare(ordInt)(0)($foreign.ordArrayImpl(toDelta)(xs)(ys));
              };
          };
      })());
  };
  var between = function (dictOrd) {
      return function (low) {
          return function (hi) {
              return function (x) {
                  if (lessThan(dictOrd)(x)(low)) {
                      return false;
                  };
                  if (greaterThan(dictOrd)(x)(hi)) {
                      return false;
                  };
                  if (true) {
                      return true;
                  };
                  throw new Error("Failed pattern match at Data.Ord line 150, column 1 - line 153, column 16: " + [ low.constructor.name, hi.constructor.name, x.constructor.name ]);
              };
          };
      };
  };
  exports["Ord"] = Ord;
  exports["between"] = between;
  exports["compare"] = compare;
  exports["greaterThan"] = greaterThan;
  exports["lessThan"] = lessThan;
  exports["ordInt"] = ordInt;
  exports["ordString"] = ordString;
  exports["ordChar"] = ordChar;
  exports["ordArray"] = ordArray;
})(PS["Data.Ord"] = PS["Data.Ord"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Alt = PS["Control.Alt"];
  var Control_Alternative = PS["Control.Alternative"];
  var Control_Extend = PS["Control.Extend"];
  var Control_MonadZero = PS["Control.MonadZero"];
  var Control_Plus = PS["Control.Plus"];
  var Data_Functor_Invariant = PS["Data.Functor.Invariant"];
  var Data_Monoid = PS["Data.Monoid"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad = PS["Control.Monad"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Ordering = PS["Data.Ordering"];
  var Data_Bounded = PS["Data.Bounded"];
  var Data_Show = PS["Data.Show"];
  var Data_Unit = PS["Data.Unit"];
  var Data_Function = PS["Data.Function"];
  var Control_Category = PS["Control.Category"];        
  var Nothing = (function () {
      function Nothing() {

      };
      Nothing.value = new Nothing();
      return Nothing;
  })();
  var Just = (function () {
      function Just(value0) {
          this.value0 = value0;
      };
      Just.create = function (value0) {
          return new Just(value0);
      };
      return Just;
  })();
  var showMaybe = function (dictShow) {
      return new Data_Show.Show(function (v) {
          if (v instanceof Just) {
              return "(Just " + (Data_Show.show(dictShow)(v.value0) + ")");
          };
          if (v instanceof Nothing) {
              return "Nothing";
          };
          throw new Error("Failed pattern match at Data.Maybe line 202, column 3 - line 203, column 3: " + [ v.constructor.name ]);
      });
  };
  var maybe = function (v) {
      return function (v1) {
          return function (v2) {
              if (v2 instanceof Nothing) {
                  return v;
              };
              if (v2 instanceof Just) {
                  return v1(v2.value0);
              };
              throw new Error("Failed pattern match at Data.Maybe line 214, column 1 - line 214, column 22: " + [ v.constructor.name, v1.constructor.name, v2.constructor.name ]);
          };
      };
  };
  var isNothing = maybe(true)(Data_Function["const"](false));
  var isJust = maybe(false)(Data_Function["const"](true));
  var functorMaybe = new Data_Functor.Functor(function (v) {
      return function (v1) {
          if (v1 instanceof Just) {
              return new Just(v(v1.value0));
          };
          return Nothing.value;
      };
  });
  var fromMaybe = function (a) {
      return maybe(a)(Control_Category.id(Control_Category.categoryFn));
  };
  var fromJust = function (dictPartial) {
      return function (v) {
          var __unused = function (dictPartial1) {
              return function ($dollar33) {
                  return $dollar33;
              };
          };
          return __unused(dictPartial)((function () {
              if (v instanceof Just) {
                  return v.value0;
              };
              throw new Error("Failed pattern match at Data.Maybe line 265, column 1 - line 265, column 21: " + [ v.constructor.name ]);
          })());
      };
  };
  var applyMaybe = new Control_Apply.Apply(function () {
      return functorMaybe;
  }, function (v) {
      return function (v1) {
          if (v instanceof Just) {
              return Data_Functor.map(functorMaybe)(v.value0)(v1);
          };
          if (v instanceof Nothing) {
              return Nothing.value;
          };
          throw new Error("Failed pattern match at Data.Maybe line 67, column 3 - line 67, column 31: " + [ v.constructor.name, v1.constructor.name ]);
      };
  });
  var bindMaybe = new Control_Bind.Bind(function () {
      return applyMaybe;
  }, function (v) {
      return function (v1) {
          if (v instanceof Just) {
              return v1(v.value0);
          };
          if (v instanceof Nothing) {
              return Nothing.value;
          };
          throw new Error("Failed pattern match at Data.Maybe line 126, column 3 - line 126, column 24: " + [ v.constructor.name, v1.constructor.name ]);
      };
  });
  var altMaybe = new Control_Alt.Alt(function () {
      return functorMaybe;
  }, function (v) {
      return function (v1) {
          if (v instanceof Nothing) {
              return v1;
          };
          return v;
      };
  });
  exports["Nothing"] = Nothing;
  exports["Just"] = Just;
  exports["fromJust"] = fromJust;
  exports["fromMaybe"] = fromMaybe;
  exports["isJust"] = isJust;
  exports["isNothing"] = isNothing;
  exports["maybe"] = maybe;
  exports["functorMaybe"] = functorMaybe;
  exports["applyMaybe"] = applyMaybe;
  exports["altMaybe"] = altMaybe;
  exports["bindMaybe"] = bindMaybe;
  exports["showMaybe"] = showMaybe;
})(PS["Data.Maybe"] = PS["Data.Maybe"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Functor = PS["Data.Functor"];        
  var Newtype = function (unwrap, wrap) {
      this.unwrap = unwrap;
      this.wrap = wrap;
  };
  var wrap = function (dict) {
      return dict.wrap;
  };
  var unwrap = function (dict) {
      return dict.unwrap;
  };
  var alaF = function (dictFunctor) {
      return function (dictFunctor1) {
          return function (dictNewtype) {
              return function (dictNewtype1) {
                  return function (v) {
                      return function (f) {
                          return function ($32) {
                              return Data_Functor.map(dictFunctor1)(unwrap(dictNewtype1))(f(Data_Functor.map(dictFunctor)(wrap(dictNewtype))($32)));
                          };
                      };
                  };
              };
          };
      };
  };
  exports["Newtype"] = Newtype;
  exports["alaF"] = alaF;
  exports["unwrap"] = unwrap;
  exports["wrap"] = wrap;
})(PS["Data.Newtype"] = PS["Data.Newtype"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.String"];
  var Prelude = PS["Prelude"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Newtype = PS["Data.Newtype"];
  var Data_String_Unsafe = PS["Data.String.Unsafe"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Show = PS["Data.Show"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Semiring = PS["Data.Semiring"];
  var Data_Ordering = PS["Data.Ordering"];
  var Data_Ring = PS["Data.Ring"];
  var Data_Function = PS["Data.Function"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];                          
  var takeWhile = function (p) {
      return function (s) {
          return $foreign.take($foreign.count(p)(s))(s);
      };
  }; 
  var $$null = function (s) {
      return s === "";
  };                                                                                                  
  var lastIndexOf = $foreign._lastIndexOf(Data_Maybe.Just.create)(Data_Maybe.Nothing.value);
  var stripSuffix = function (v) {
      return function (str) {
          var $32 = lastIndexOf(v)(str);
          if ($32 instanceof Data_Maybe.Just && $32.value0 === $foreign.length(str) - $foreign.length(v)) {
              return Data_Maybe.Just.create($foreign.take($32.value0)(str));
          };
          return Data_Maybe.Nothing.value;
      };
  };                                                                                          
  var indexOf = $foreign._indexOf(Data_Maybe.Just.create)(Data_Maybe.Nothing.value);
  var stripPrefix = function (v) {
      return function (str) {
          var $36 = indexOf(v)(str);
          if ($36 instanceof Data_Maybe.Just && $36.value0 === 0) {
              return Data_Maybe.Just.create($foreign.drop($foreign.length(v))(str));
          };
          return Data_Maybe.Nothing.value;
      };
  };
  exports["indexOf"] = indexOf;
  exports["lastIndexOf"] = lastIndexOf;
  exports["null"] = $$null;
  exports["stripPrefix"] = stripPrefix;
  exports["stripSuffix"] = stripSuffix;
  exports["takeWhile"] = takeWhile;
  exports["fromCharArray"] = $foreign.fromCharArray;
  exports["joinWith"] = $foreign.joinWith;
  exports["length"] = $foreign.length;
  exports["replace"] = $foreign.replace;
  exports["split"] = $foreign.split;
  exports["toCharArray"] = $foreign.toCharArray;
  exports["toLower"] = $foreign.toLower;
  exports["toUpper"] = $foreign.toUpper;
  exports["trim"] = $foreign.trim;
})(PS["Data.String"] = PS["Data.String"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_String = PS["Data.String"];
  var Data_Show = PS["Data.Show"];
  var Data_Semiring = PS["Data.Semiring"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];        
  var Bold = (function () {
      function Bold() {

      };
      Bold.value = new Bold();
      return Bold;
  })();
  var Dim = (function () {
      function Dim() {

      };
      Dim.value = new Dim();
      return Dim;
  })();
  var Italic = (function () {
      function Italic() {

      };
      Italic.value = new Italic();
      return Italic;
  })();
  var Underline = (function () {
      function Underline() {

      };
      Underline.value = new Underline();
      return Underline;
  })();
  var Inverse = (function () {
      function Inverse() {

      };
      Inverse.value = new Inverse();
      return Inverse;
  })();
  var Strikethrough = (function () {
      function Strikethrough() {

      };
      Strikethrough.value = new Strikethrough();
      return Strikethrough;
  })();
  var ToEnd = (function () {
      function ToEnd() {

      };
      ToEnd.value = new ToEnd();
      return ToEnd;
  })();
  var FromBeginning = (function () {
      function FromBeginning() {

      };
      FromBeginning.value = new FromBeginning();
      return FromBeginning;
  })();
  var Entire = (function () {
      function Entire() {

      };
      Entire.value = new Entire();
      return Entire;
  })();
  var White = (function () {
      function White() {

      };
      White.value = new White();
      return White;
  })();
  var Black = (function () {
      function Black() {

      };
      Black.value = new Black();
      return Black;
  })();
  var Blue = (function () {
      function Blue() {

      };
      Blue.value = new Blue();
      return Blue;
  })();
  var Cyan = (function () {
      function Cyan() {

      };
      Cyan.value = new Cyan();
      return Cyan;
  })();
  var Green = (function () {
      function Green() {

      };
      Green.value = new Green();
      return Green;
  })();
  var Magenta = (function () {
      function Magenta() {

      };
      Magenta.value = new Magenta();
      return Magenta;
  })();
  var Red = (function () {
      function Red() {

      };
      Red.value = new Red();
      return Red;
  })();
  var Yellow = (function () {
      function Yellow() {

      };
      Yellow.value = new Yellow();
      return Yellow;
  })();
  var Grey = (function () {
      function Grey() {

      };
      Grey.value = new Grey();
      return Grey;
  })();
  var BrightBlack = (function () {
      function BrightBlack() {

      };
      BrightBlack.value = new BrightBlack();
      return BrightBlack;
  })();
  var BrightRed = (function () {
      function BrightRed() {

      };
      BrightRed.value = new BrightRed();
      return BrightRed;
  })();
  var BrightGreen = (function () {
      function BrightGreen() {

      };
      BrightGreen.value = new BrightGreen();
      return BrightGreen;
  })();
  var BrightYellow = (function () {
      function BrightYellow() {

      };
      BrightYellow.value = new BrightYellow();
      return BrightYellow;
  })();
  var BrightBlue = (function () {
      function BrightBlue() {

      };
      BrightBlue.value = new BrightBlue();
      return BrightBlue;
  })();
  var BrightMagenta = (function () {
      function BrightMagenta() {

      };
      BrightMagenta.value = new BrightMagenta();
      return BrightMagenta;
  })();
  var BrightCyan = (function () {
      function BrightCyan() {

      };
      BrightCyan.value = new BrightCyan();
      return BrightCyan;
  })();
  var BrightWhite = (function () {
      function BrightWhite() {

      };
      BrightWhite.value = new BrightWhite();
      return BrightWhite;
  })();
  var Reset = (function () {
      function Reset() {

      };
      Reset.value = new Reset();
      return Reset;
  })();
  var PMode = (function () {
      function PMode(value0) {
          this.value0 = value0;
      };
      PMode.create = function (value0) {
          return new PMode(value0);
      };
      return PMode;
  })();
  var PForeground = (function () {
      function PForeground(value0) {
          this.value0 = value0;
      };
      PForeground.create = function (value0) {
          return new PForeground(value0);
      };
      return PForeground;
  })();
  var PBackground = (function () {
      function PBackground(value0) {
          this.value0 = value0;
      };
      PBackground.create = function (value0) {
          return new PBackground(value0);
      };
      return PBackground;
  })();
  var Up = (function () {
      function Up(value0) {
          this.value0 = value0;
      };
      Up.create = function (value0) {
          return new Up(value0);
      };
      return Up;
  })();
  var Down = (function () {
      function Down(value0) {
          this.value0 = value0;
      };
      Down.create = function (value0) {
          return new Down(value0);
      };
      return Down;
  })();
  var Forward = (function () {
      function Forward(value0) {
          this.value0 = value0;
      };
      Forward.create = function (value0) {
          return new Forward(value0);
      };
      return Forward;
  })();
  var Back = (function () {
      function Back(value0) {
          this.value0 = value0;
      };
      Back.create = function (value0) {
          return new Back(value0);
      };
      return Back;
  })();
  var NextLine = (function () {
      function NextLine(value0) {
          this.value0 = value0;
      };
      NextLine.create = function (value0) {
          return new NextLine(value0);
      };
      return NextLine;
  })();
  var PreviousLine = (function () {
      function PreviousLine(value0) {
          this.value0 = value0;
      };
      PreviousLine.create = function (value0) {
          return new PreviousLine(value0);
      };
      return PreviousLine;
  })();
  var HorizontalAbsolute = (function () {
      function HorizontalAbsolute(value0) {
          this.value0 = value0;
      };
      HorizontalAbsolute.create = function (value0) {
          return new HorizontalAbsolute(value0);
      };
      return HorizontalAbsolute;
  })();
  var Position = (function () {
      function Position(value0, value1) {
          this.value0 = value0;
          this.value1 = value1;
      };
      Position.create = function (value0) {
          return function (value1) {
              return new Position(value0, value1);
          };
      };
      return Position;
  })();
  var EraseData = (function () {
      function EraseData(value0) {
          this.value0 = value0;
      };
      EraseData.create = function (value0) {
          return new EraseData(value0);
      };
      return EraseData;
  })();
  var EraseLine = (function () {
      function EraseLine(value0) {
          this.value0 = value0;
      };
      EraseLine.create = function (value0) {
          return new EraseLine(value0);
      };
      return EraseLine;
  })();
  var ScrollUp = (function () {
      function ScrollUp(value0) {
          this.value0 = value0;
      };
      ScrollUp.create = function (value0) {
          return new ScrollUp(value0);
      };
      return ScrollUp;
  })();
  var ScrollDown = (function () {
      function ScrollDown(value0) {
          this.value0 = value0;
      };
      ScrollDown.create = function (value0) {
          return new ScrollDown(value0);
      };
      return ScrollDown;
  })();
  var Graphics = (function () {
      function Graphics(value0) {
          this.value0 = value0;
      };
      Graphics.create = function (value0) {
          return new Graphics(value0);
      };
      return Graphics;
  })();
  var SavePosition = (function () {
      function SavePosition() {

      };
      SavePosition.value = new SavePosition();
      return SavePosition;
  })();
  var RestorePosition = (function () {
      function RestorePosition() {

      };
      RestorePosition.value = new RestorePosition();
      return RestorePosition;
  })();
  var QueryPosition = (function () {
      function QueryPosition() {

      };
      QueryPosition.value = new QueryPosition();
      return QueryPosition;
  })();
  var HideCursor = (function () {
      function HideCursor() {

      };
      HideCursor.value = new HideCursor();
      return HideCursor;
  })();
  var ShowCursor = (function () {
      function ShowCursor() {

      };
      ShowCursor.value = new ShowCursor();
      return ShowCursor;
  })();
  var prefix = "\x1b[";
  var eraseParamToString = function (ep) {
      if (ep instanceof ToEnd) {
          return "0";
      };
      if (ep instanceof FromBeginning) {
          return "1";
      };
      if (ep instanceof Entire) {
          return "2";
      };
      throw new Error("Failed pattern match at Ansi.Codes line 79, column 3 - line 84, column 1: " + [ ep.constructor.name ]);
  };
  var colorSuffix = "m";
  var colorCode = function (c) {
      if (c instanceof White) {
          return 37;
      };
      if (c instanceof Black) {
          return 30;
      };
      if (c instanceof Blue) {
          return 34;
      };
      if (c instanceof Cyan) {
          return 36;
      };
      if (c instanceof Green) {
          return 32;
      };
      if (c instanceof Magenta) {
          return 35;
      };
      if (c instanceof Red) {
          return 31;
      };
      if (c instanceof Yellow) {
          return 33;
      };
      if (c instanceof Grey) {
          return 90;
      };
      if (c instanceof BrightBlack) {
          return 90;
      };
      if (c instanceof BrightRed) {
          return 91;
      };
      if (c instanceof BrightGreen) {
          return 92;
      };
      if (c instanceof BrightYellow) {
          return 93;
      };
      if (c instanceof BrightBlue) {
          return 94;
      };
      if (c instanceof BrightMagenta) {
          return 95;
      };
      if (c instanceof BrightCyan) {
          return 96;
      };
      if (c instanceof BrightWhite) {
          return 97;
      };
      throw new Error("Failed pattern match at Ansi.Codes line 140, column 3 - line 157, column 20: " + [ c.constructor.name ]);
  };
  var codeForRenderingMode = function (m) {
      if (m instanceof Bold) {
          return 1;
      };
      if (m instanceof Dim) {
          return 2;
      };
      if (m instanceof Italic) {
          return 3;
      };
      if (m instanceof Underline) {
          return 4;
      };
      if (m instanceof Inverse) {
          return 7;
      };
      if (m instanceof Strikethrough) {
          return 9;
      };
      throw new Error("Failed pattern match at Ansi.Codes line 110, column 3 - line 118, column 1: " + [ m.constructor.name ]);
  };
  var graphicsParamToString = function (gp) {
      if (gp instanceof Reset) {
          return "0";
      };
      if (gp instanceof PMode) {
          return Data_Show.show(Data_Show.showInt)(codeForRenderingMode(gp.value0));
      };
      if (gp instanceof PForeground) {
          return Data_Show.show(Data_Show.showInt)(colorCode(gp.value0));
      };
      if (gp instanceof PBackground) {
          return Data_Show.show(Data_Show.showInt)(colorCode(gp.value0) + 10 | 0);
      };
      throw new Error("Failed pattern match at Ansi.Codes line 94, column 3 - line 98, column 45: " + [ gp.constructor.name ]);
  };
  var escapeCodeToString = (function () {
      var go = function (c) {
          if (c instanceof Up) {
              return Data_Show.show(Data_Show.showInt)(c.value0) + "A";
          };
          if (c instanceof Down) {
              return Data_Show.show(Data_Show.showInt)(c.value0) + "B";
          };
          if (c instanceof Forward) {
              return Data_Show.show(Data_Show.showInt)(c.value0) + "C";
          };
          if (c instanceof Back) {
              return Data_Show.show(Data_Show.showInt)(c.value0) + "D";
          };
          if (c instanceof NextLine) {
              return Data_Show.show(Data_Show.showInt)(c.value0) + "E";
          };
          if (c instanceof PreviousLine) {
              return Data_Show.show(Data_Show.showInt)(c.value0) + "F";
          };
          if (c instanceof HorizontalAbsolute) {
              return Data_Show.show(Data_Show.showInt)(c.value0) + "G";
          };
          if (c instanceof Position) {
              return Data_Show.show(Data_Show.showInt)(c.value0) + (";" + (Data_Show.show(Data_Show.showInt)(c.value1) + "H"));
          };
          if (c instanceof EraseData) {
              return eraseParamToString(c.value0) + "J";
          };
          if (c instanceof EraseLine) {
              return eraseParamToString(c.value0) + "K";
          };
          if (c instanceof ScrollUp) {
              return Data_Show.show(Data_Show.showInt)(c.value0) + "S";
          };
          if (c instanceof ScrollDown) {
              return Data_Show.show(Data_Show.showInt)(c.value0) + "T";
          };
          if (c instanceof Graphics) {
              return Data_String.joinWith(";")(Data_Functor.map(Data_Functor.functorArray)(graphicsParamToString)(c.value0)) + colorSuffix;
          };
          if (c instanceof SavePosition) {
              return "s";
          };
          if (c instanceof RestorePosition) {
              return "u";
          };
          if (c instanceof QueryPosition) {
              return "6n";
          };
          if (c instanceof HideCursor) {
              return "?25l";
          };
          if (c instanceof ShowCursor) {
              return "?25h";
          };
          throw new Error("Failed pattern match at Ansi.Codes line 43, column 5 - line 63, column 3: " + [ c.constructor.name ]);
      };
      return function ($23) {
          return (function (v) {
              return prefix + v;
          })(go($23));
      };
  })();
  exports["White"] = White;
  exports["Black"] = Black;
  exports["Blue"] = Blue;
  exports["Cyan"] = Cyan;
  exports["Green"] = Green;
  exports["Magenta"] = Magenta;
  exports["Red"] = Red;
  exports["Yellow"] = Yellow;
  exports["Grey"] = Grey;
  exports["BrightBlack"] = BrightBlack;
  exports["BrightRed"] = BrightRed;
  exports["BrightGreen"] = BrightGreen;
  exports["BrightYellow"] = BrightYellow;
  exports["BrightBlue"] = BrightBlue;
  exports["BrightMagenta"] = BrightMagenta;
  exports["BrightCyan"] = BrightCyan;
  exports["BrightWhite"] = BrightWhite;
  exports["ToEnd"] = ToEnd;
  exports["FromBeginning"] = FromBeginning;
  exports["Entire"] = Entire;
  exports["Up"] = Up;
  exports["Down"] = Down;
  exports["Forward"] = Forward;
  exports["Back"] = Back;
  exports["NextLine"] = NextLine;
  exports["PreviousLine"] = PreviousLine;
  exports["HorizontalAbsolute"] = HorizontalAbsolute;
  exports["Position"] = Position;
  exports["EraseData"] = EraseData;
  exports["EraseLine"] = EraseLine;
  exports["ScrollUp"] = ScrollUp;
  exports["ScrollDown"] = ScrollDown;
  exports["Graphics"] = Graphics;
  exports["SavePosition"] = SavePosition;
  exports["RestorePosition"] = RestorePosition;
  exports["QueryPosition"] = QueryPosition;
  exports["HideCursor"] = HideCursor;
  exports["ShowCursor"] = ShowCursor;
  exports["Reset"] = Reset;
  exports["PMode"] = PMode;
  exports["PForeground"] = PForeground;
  exports["PBackground"] = PBackground;
  exports["Bold"] = Bold;
  exports["Dim"] = Dim;
  exports["Italic"] = Italic;
  exports["Underline"] = Underline;
  exports["Inverse"] = Inverse;
  exports["Strikethrough"] = Strikethrough;
  exports["codeForRenderingMode"] = codeForRenderingMode;
  exports["colorCode"] = colorCode;
  exports["colorSuffix"] = colorSuffix;
  exports["eraseParamToString"] = eraseParamToString;
  exports["escapeCodeToString"] = escapeCodeToString;
  exports["graphicsParamToString"] = graphicsParamToString;
  exports["prefix"] = prefix;
})(PS["Ansi.Codes"] = PS["Ansi.Codes"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Ansi_Codes = PS["Ansi.Codes"];
  var Control_Bind = PS["Control.Bind"];        
  var withGraphics = function (dictMonad) {
      return function (write) {
          return function (params) {
              return function (text) {
                  return Control_Bind.bind(dictMonad["__superclass_Control.Bind.Bind_1"]())(write(Ansi_Codes.escapeCodeToString(new Ansi_Codes.Graphics(params))))(function () {
                      return Control_Bind.bind(dictMonad["__superclass_Control.Bind.Bind_1"]())(write(text))(function () {
                          return write(Ansi_Codes.escapeCodeToString(new Ansi_Codes.Graphics([ Ansi_Codes.Reset.value ])));
                      });
                  });
              };
          };
      };
  };                                                               
  var foreground = function (c) {
      return [ new Ansi_Codes.PForeground(c) ];
  };                                                       
  var bold = [ new Ansi_Codes.PMode(Ansi_Codes.Bold.value) ];
  exports["bold"] = bold;
  exports["foreground"] = foreground;
  exports["withGraphics"] = withGraphics;
})(PS["Ansi.Output"] = PS["Ansi.Output"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Data_Unit = PS["Data.Unit"];        
  var Lazy = function (defer) {
      this.defer = defer;
  };
  var defer = function (dict) {
      return dict.defer;
  };
  exports["Lazy"] = Lazy;
  exports["defer"] = defer;
})(PS["Control.Lazy"] = PS["Control.Lazy"] || {});
(function(exports) {
  /* globals setTimeout, clearTimeout, setImmediate, clearImmediate */
  "use strict";

  exports._unsafeInterleaveAff = function (aff) {
    return aff;
  };

  exports._forkAff = function (nonCanceler, aff) {
    var voidF = function () {};

    return function (success) {
      var canceler = aff(voidF, voidF);
      success(canceler);
      return nonCanceler;
    };
  };

  exports._makeAff = function (cb) {
    return function (success, error) {
      try {
        return cb(function (e) {
          return function () {
            error(e);
          };
        })(function (v) {
          return function () {
            success(v);
          };
        })();
      } catch (err) {
        error(err);
      }
    };
  };

  exports._pure = function (nonCanceler, v) {
    return function (success) {
      success(v);
      return nonCanceler;
    };
  };

  exports._throwError = function (nonCanceler, e) {
    return function (success, error) {
      error(e);
      return nonCanceler;
    };
  };

  exports._fmap = function (f, aff) {
    return function (success, error) {
      try {
        return aff(function (v) {
          try {
            var v2 = f(v);
          } catch (err) {
            error(err);
          }
          success(v2);
        }, error);
      } catch (err) {
        error(err);
      }
    };
  };

  exports._bind = function (alwaysCanceler, aff, f) {
    return function (success, error) {
      var canceler1, canceler2;

      var isCanceled    = false;
      var requestCancel = false;

      var onCanceler = function () {};

      canceler1 = aff(function (v) {
        if (requestCancel) {
          isCanceled = true;

          return alwaysCanceler;
        } else {
          canceler2 = f(v)(success, error);

          onCanceler(canceler2);

          return canceler2;
        }
      }, error);

      return function (e) {
        return function (s, f) {
          requestCancel = true;

          if (canceler2 !== undefined) {
            return canceler2(e)(s, f);
          } else {
            return canceler1(e)(function (bool) {
              if (bool || isCanceled) {
                s(true);
              } else {
                onCanceler = function (canceler) {
                  canceler(e)(s, f);
                };
              }
            }, f);
          }
        };
      };
    };
  };

  exports._attempt = function (Left, Right, aff) {
    return function (success) {
      try {
        return aff(function (v) {
          success(Right(v));
        }, function (e) {
          success(Left(e));
        });
      } catch (err) {
        success(Left(err));
      }
    };
  };

  exports._runAff = function (errorT, successT, aff) {
    return function () {
      return aff(function (v) {
        successT(v)();
      }, function (e) {
        errorT(e)();
      });
    };
  };

  exports._liftEff = function (nonCanceler, e) {
    return function (success, error) {
      var result;
      try {
        result = e();
      } catch (err) {
        error(err);
        return nonCanceler;
      }

      success(result);
      return nonCanceler;
    };
  };
})(PS["Control.Monad.Aff"] = PS["Control.Monad.Aff"] || {});
(function(exports) {
    "use strict";

  exports._makeVar = function (nonCanceler) {
    return function (success, error) {
      try {
        success({
          consumers: [],
          producers: [],
          error: undefined
        });
      } catch (err) {
        error(err);
      }

      return nonCanceler;
    };
  };

  exports._takeVar = function (nonCanceler, avar) {
    return function (success, error) {
      if (avar.error !== undefined) {
        error(avar.error);
      } else if (avar.producers.length > 0) {
        var producer = avar.producers.shift();

        producer(success, error);
      } else {
        avar.consumers.push({ success: success, error: error });
      }

      return nonCanceler;
    };
  };

  exports._peekVar = function (nonCanceler, avar) {
    return function (success, error) {
      if (avar.error !== undefined) {
        error(avar.error);
      } else if (avar.producers.length > 0) {
        var producer = avar.producers[0];
        producer(success, error);
      } else {
        avar.consumers.push({ peek: true, success: success, error: error });
      }
      return nonCanceler;
    };
  };

  /* jshint loopfunc: true */
  exports._putVar = function (nonCanceler, avar, a) {
    return function (success, error) {
      if (avar.error !== undefined) {
        error(avar.error);
      } else {
        var wasPeek;
        do {
          wasPeek = false;

          if (avar.consumers.length === 0) {
            avar.producers.push(function (success, error) {
              try {
                success(a);
              } catch (err) {
                error(err);
              }
            });

            success({});
          } else {
            var consumer = avar.consumers.shift();
            try {
              consumer.success(a);
            } catch (err) {
              error(err);
              return;
            }
            if (consumer.peek === true) {
              wasPeek = true;
            }

            success({});
          }
        } while (wasPeek);
      }

      return nonCanceler;
    };
  };
})(PS["Control.Monad.Aff.Internal"] = PS["Control.Monad.Aff.Internal"] || {});
(function(exports) {
    "use strict";

  exports.error = function (msg) {
    return new Error(msg);
  };

  exports.message = function (e) {
    return e.message;
  };

  exports.throwException = function (e) {
    return function () {
      throw e;
    };
  };

  exports.catchException = function (c) {
    return function (t) {
      return function () {
        try {
          return t();
        } catch (e) {
          if (e instanceof Error || Object.prototype.toString.call(e) === "[object Error]") {
            return c(e)();
          } else {
            return c(new Error(e.toString()))();
          }
        }
      };
    };
  };
})(PS["Control.Monad.Eff.Exception"] = PS["Control.Monad.Eff.Exception"] || {});
(function(exports) {
    "use strict";

  exports.pureE = function (a) {
    return function () {
      return a;
    };
  };

  exports.bindE = function (a) {
    return function (f) {
      return function () {
        return f(a())();
      };
    };
  };

  exports.runPure = function (f) {
    return f();
  };
})(PS["Control.Monad.Eff"] = PS["Control.Monad.Eff"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Control.Monad.Eff"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad = PS["Control.Monad"];
  var Data_Functor = PS["Data.Functor"];
  var Data_Unit = PS["Data.Unit"];        
  var monadEff = new Control_Monad.Monad(function () {
      return applicativeEff;
  }, function () {
      return bindEff;
  });
  var bindEff = new Control_Bind.Bind(function () {
      return applyEff;
  }, $foreign.bindE);
  var applyEff = new Control_Apply.Apply(function () {
      return functorEff;
  }, Control_Monad.ap(monadEff));
  var applicativeEff = new Control_Applicative.Applicative(function () {
      return applyEff;
  }, $foreign.pureE);
  var functorEff = new Data_Functor.Functor(Control_Applicative.liftA1(applicativeEff));
  exports["functorEff"] = functorEff;
  exports["applyEff"] = applyEff;
  exports["applicativeEff"] = applicativeEff;
  exports["bindEff"] = bindEff;
  exports["monadEff"] = monadEff;
  exports["runPure"] = $foreign.runPure;
})(PS["Control.Monad.Eff"] = PS["Control.Monad.Eff"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Control_Category = PS["Control.Category"];        
  var Bifunctor = function (bimap) {
      this.bimap = bimap;
  };
  var bimap = function (dict) {
      return dict.bimap;
  };
  var lmap = function (dictBifunctor) {
      return function (f) {
          return bimap(dictBifunctor)(f)(Control_Category.id(Control_Category.categoryFn));
      };
  };
  exports["Bifunctor"] = Bifunctor;
  exports["bimap"] = bimap;
  exports["lmap"] = lmap;
})(PS["Data.Bifunctor"] = PS["Data.Bifunctor"] || {});
(function(exports) {
    "use strict";

  exports.foldrArray = function (f) {
    return function (init) {
      return function (xs) {
        var acc = init;
        var len = xs.length;
        for (var i = len - 1; i >= 0; i--) {
          acc = f(xs[i])(acc);
        }
        return acc;
      };
    };
  };

  exports.foldlArray = function (f) {
    return function (init) {
      return function (xs) {
        var acc = init;
        var len = xs.length;
        for (var i = 0; i < len; i++) {
          acc = f(acc)(xs[i]);
        }
        return acc;
      };
    };
  };
})(PS["Data.Foldable"] = PS["Data.Foldable"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Extend = PS["Control.Extend"];
  var Data_Functor_Invariant = PS["Data.Functor.Invariant"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Monoid = PS["Data.Monoid"];
  var Data_Newtype = PS["Data.Newtype"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Bounded = PS["Data.Bounded"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad = PS["Control.Monad"];
  var Data_Show = PS["Data.Show"];
  var Data_Semigroup = PS["Data.Semigroup"];        
  var First = function (x) {
      return x;
  };
  var semigroupFirst = new Data_Semigroup.Semigroup(function (v) {
      return function (v1) {
          if (v instanceof Data_Maybe.Just) {
              return v;
          };
          return v1;
      };
  });
  var newtypeFirst = new Data_Newtype.Newtype(function (n) {
      return n;
  }, First);
  var monoidFirst = new Data_Monoid.Monoid(function () {
      return semigroupFirst;
  }, Data_Maybe.Nothing.value);
  exports["First"] = First;
  exports["newtypeFirst"] = newtypeFirst;
  exports["semigroupFirst"] = semigroupFirst;
  exports["monoidFirst"] = monoidFirst;
})(PS["Data.Maybe.First"] = PS["Data.Maybe.First"] || {});
(function(exports) {
    "use strict";

  exports.boolConj = function (b1) {
    return function (b2) {
      return b1 && b2;
    };
  };

  exports.boolDisj = function (b1) {
    return function (b2) {
      return b1 || b2;
    };
  };

  exports.boolNot = function (b) {
    return !b;
  };
})(PS["Data.HeytingAlgebra"] = PS["Data.HeytingAlgebra"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.HeytingAlgebra"];
  var Data_Unit = PS["Data.Unit"];        
  var HeytingAlgebra = function (conj, disj, ff, implies, not, tt) {
      this.conj = conj;
      this.disj = disj;
      this.ff = ff;
      this.implies = implies;
      this.not = not;
      this.tt = tt;
  };
  var tt = function (dict) {
      return dict.tt;
  };
  var not = function (dict) {
      return dict.not;
  };
  var implies = function (dict) {
      return dict.implies;
  };                 
  var ff = function (dict) {
      return dict.ff;
  };
  var disj = function (dict) {
      return dict.disj;
  };
  var heytingAlgebraBoolean = new HeytingAlgebra($foreign.boolConj, $foreign.boolDisj, false, function (a) {
      return function (b) {
          return disj(heytingAlgebraBoolean)(not(heytingAlgebraBoolean)(a))(b);
      };
  }, $foreign.boolNot, true);
  var conj = function (dict) {
      return dict.conj;
  };
  exports["HeytingAlgebra"] = HeytingAlgebra;
  exports["conj"] = conj;
  exports["disj"] = disj;
  exports["ff"] = ff;
  exports["implies"] = implies;
  exports["not"] = not;
  exports["tt"] = tt;
  exports["heytingAlgebraBoolean"] = heytingAlgebraBoolean;
})(PS["Data.HeytingAlgebra"] = PS["Data.HeytingAlgebra"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Comonad = PS["Control.Comonad"];
  var Control_Extend = PS["Control.Extend"];
  var Data_Functor_Invariant = PS["Data.Functor.Invariant"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_Monoid = PS["Data.Monoid"];
  var Data_Newtype = PS["Data.Newtype"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Bounded = PS["Data.Bounded"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad = PS["Control.Monad"];
  var Data_Show = PS["Data.Show"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Semiring = PS["Data.Semiring"];        
  var Conj = function (x) {
      return x;
  };
  var semigroupConj = function (dictHeytingAlgebra) {
      return new Data_Semigroup.Semigroup(function (v) {
          return function (v1) {
              return Data_HeytingAlgebra.conj(dictHeytingAlgebra)(v)(v1);
          };
      });
  };
  var newtypeConj = new Data_Newtype.Newtype(function (n) {
      return n;
  }, Conj);
  var monoidConj = function (dictHeytingAlgebra) {
      return new Data_Monoid.Monoid(function () {
          return semigroupConj(dictHeytingAlgebra);
      }, Data_HeytingAlgebra.tt(dictHeytingAlgebra));
  };
  exports["Conj"] = Conj;
  exports["newtypeConj"] = newtypeConj;
  exports["semigroupConj"] = semigroupConj;
  exports["monoidConj"] = monoidConj;
})(PS["Data.Monoid.Conj"] = PS["Data.Monoid.Conj"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Comonad = PS["Control.Comonad"];
  var Control_Extend = PS["Control.Extend"];
  var Data_Functor_Invariant = PS["Data.Functor.Invariant"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_Monoid = PS["Data.Monoid"];
  var Data_Newtype = PS["Data.Newtype"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Bounded = PS["Data.Bounded"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad = PS["Control.Monad"];
  var Data_Show = PS["Data.Show"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Semiring = PS["Data.Semiring"];        
  var Disj = function (x) {
      return x;
  };
  var semigroupDisj = function (dictHeytingAlgebra) {
      return new Data_Semigroup.Semigroup(function (v) {
          return function (v1) {
              return Data_HeytingAlgebra.disj(dictHeytingAlgebra)(v)(v1);
          };
      });
  };
  var newtypeDisj = new Data_Newtype.Newtype(function (n) {
      return n;
  }, Disj);
  var monoidDisj = function (dictHeytingAlgebra) {
      return new Data_Monoid.Monoid(function () {
          return semigroupDisj(dictHeytingAlgebra);
      }, Data_HeytingAlgebra.ff(dictHeytingAlgebra));
  };
  exports["Disj"] = Disj;
  exports["newtypeDisj"] = newtypeDisj;
  exports["semigroupDisj"] = semigroupDisj;
  exports["monoidDisj"] = monoidDisj;
})(PS["Data.Monoid.Disj"] = PS["Data.Monoid.Disj"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.Foldable"];
  var Prelude = PS["Prelude"];
  var Control_Plus = PS["Control.Plus"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Maybe_First = PS["Data.Maybe.First"];
  var Data_Maybe_Last = PS["Data.Maybe.Last"];
  var Data_Monoid = PS["Data.Monoid"];
  var Data_Monoid_Additive = PS["Data.Monoid.Additive"];
  var Data_Monoid_Conj = PS["Data.Monoid.Conj"];
  var Data_Monoid_Disj = PS["Data.Monoid.Disj"];
  var Data_Monoid_Dual = PS["Data.Monoid.Dual"];
  var Data_Monoid_Endo = PS["Data.Monoid.Endo"];
  var Data_Monoid_Multiplicative = PS["Data.Monoid.Multiplicative"];
  var Data_Newtype = PS["Data.Newtype"];
  var Control_Alt = PS["Control.Alt"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Unit = PS["Data.Unit"];
  var Data_Function = PS["Data.Function"];
  var Control_Category = PS["Control.Category"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Ordering = PS["Data.Ordering"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Semiring = PS["Data.Semiring"];
  var Data_Functor = PS["Data.Functor"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];        
  var Foldable = function (foldMap, foldl, foldr) {
      this.foldMap = foldMap;
      this.foldl = foldl;
      this.foldr = foldr;
  };
  var foldr = function (dict) {
      return dict.foldr;
  };
  var traverse_ = function (dictApplicative) {
      return function (dictFoldable) {
          return function (f) {
              return foldr(dictFoldable)(function ($169) {
                  return Control_Apply.applySecond(dictApplicative["__superclass_Control.Apply.Apply_0"]())(f($169));
              })(Control_Applicative.pure(dictApplicative)(Data_Unit.unit));
          };
      };
  };
  var for_ = function (dictApplicative) {
      return function (dictFoldable) {
          return Data_Function.flip(traverse_(dictApplicative)(dictFoldable));
      };
  };
  var foldl = function (dict) {
      return dict.foldl;
  };
  var intercalate = function (dictFoldable) {
      return function (dictMonoid) {
          return function (sep) {
              return function (xs) {
                  var go = function (v) {
                      return function (x) {
                          if (v.init) {
                              return {
                                  init: false, 
                                  acc: x
                              };
                          };
                          return {
                              init: false, 
                              acc: Data_Semigroup.append(dictMonoid["__superclass_Data.Semigroup.Semigroup_0"]())(v.acc)(Data_Semigroup.append(dictMonoid["__superclass_Data.Semigroup.Semigroup_0"]())(sep)(x))
                          };
                      };
                  };
                  return (foldl(dictFoldable)(go)({
                      init: true, 
                      acc: Data_Monoid.mempty(dictMonoid)
                  })(xs)).acc;
              };
          };
      };
  };
  var maximumBy = function (dictFoldable) {
      return function (cmp) {
          var max$prime = function (v) {
              return function (v1) {
                  if (v instanceof Data_Maybe.Nothing) {
                      return new Data_Maybe.Just(v1);
                  };
                  if (v instanceof Data_Maybe.Just) {
                      return new Data_Maybe.Just((function () {
                          var $92 = Data_Eq.eq(Data_Ordering.eqOrdering)(cmp(v.value0)(v1))(Data_Ordering.GT.value);
                          if ($92) {
                              return v.value0;
                          };
                          if (!$92) {
                              return v1;
                          };
                          throw new Error("Failed pattern match at Data.Foldable line 291, column 27 - line 291, column 57: " + [ $92.constructor.name ]);
                      })());
                  };
                  throw new Error("Failed pattern match at Data.Foldable line 290, column 3 - line 290, column 27: " + [ v.constructor.name, v1.constructor.name ]);
              };
          };
          return foldl(dictFoldable)(max$prime)(Data_Maybe.Nothing.value);
      };
  };
  var maximum = function (dictOrd) {
      return function (dictFoldable) {
          return maximumBy(dictFoldable)(Data_Ord.compare(dictOrd));
      };
  }; 
  var foldMapDefaultR = function (dictFoldable) {
      return function (dictMonoid) {
          return function (f) {
              return function (xs) {
                  return foldr(dictFoldable)(function (x) {
                      return function (acc) {
                          return Data_Semigroup.append(dictMonoid["__superclass_Data.Semigroup.Semigroup_0"]())(f(x))(acc);
                      };
                  })(Data_Monoid.mempty(dictMonoid))(xs);
              };
          };
      };
  };
  var foldableArray = new Foldable(function (dictMonoid) {
      return foldMapDefaultR(foldableArray)(dictMonoid);
  }, $foreign.foldlArray, $foreign.foldrArray);
  var foldMap = function (dict) {
      return dict.foldMap;
  };
  var fold = function (dictFoldable) {
      return function (dictMonoid) {
          return foldMap(dictFoldable)(dictMonoid)(Control_Category.id(Control_Category.categoryFn));
      };
  };
  var find = function (dictFoldable) {
      return function (p) {
          var go = function (v) {
              return function (v1) {
                  if (v instanceof Data_Maybe.Nothing && p(v1)) {
                      return new Data_Maybe.Just(v1);
                  };
                  return v;
              };
          };
          return foldl(dictFoldable)(go)(Data_Maybe.Nothing.value);
      };
  };
  var any = function (dictFoldable) {
      return function (dictHeytingAlgebra) {
          return function (p) {
              return Data_Newtype.alaF(Data_Functor.functorFn)(Data_Functor.functorFn)(Data_Monoid_Disj.newtypeDisj)(Data_Monoid_Disj.newtypeDisj)(Data_Monoid_Disj.Disj)(foldMap(dictFoldable)(Data_Monoid_Disj.monoidDisj(dictHeytingAlgebra)))(p);
          };
      };
  };
  var elem = function (dictFoldable) {
      return function (dictEq) {
          return function ($172) {
              return any(dictFoldable)(Data_HeytingAlgebra.heytingAlgebraBoolean)(Data_Eq.eq(dictEq)($172));
          };
      };
  };
  var notElem = function (dictFoldable) {
      return function (dictEq) {
          return function (x) {
              return function ($173) {
                  return !elem(dictFoldable)(dictEq)(x)($173);
              };
          };
      };
  };
  var all = function (dictFoldable) {
      return function (dictHeytingAlgebra) {
          return function (p) {
              return Data_Newtype.alaF(Data_Functor.functorFn)(Data_Functor.functorFn)(Data_Monoid_Conj.newtypeConj)(Data_Monoid_Conj.newtypeConj)(Data_Monoid_Conj.Conj)(foldMap(dictFoldable)(Data_Monoid_Conj.monoidConj(dictHeytingAlgebra)))(p);
          };
      };
  };
  exports["Foldable"] = Foldable;
  exports["all"] = all;
  exports["any"] = any;
  exports["elem"] = elem;
  exports["find"] = find;
  exports["fold"] = fold;
  exports["foldMap"] = foldMap;
  exports["foldMapDefaultR"] = foldMapDefaultR;
  exports["foldl"] = foldl;
  exports["foldr"] = foldr;
  exports["for_"] = for_;
  exports["intercalate"] = intercalate;
  exports["maximum"] = maximum;
  exports["maximumBy"] = maximumBy;
  exports["notElem"] = notElem;
  exports["traverse_"] = traverse_;
  exports["foldableArray"] = foldableArray;
})(PS["Data.Foldable"] = PS["Data.Foldable"] || {});
(function(exports) {
    "use strict";

  // jshint maxparams: 3

  exports.traverseArrayImpl = function () {
    function Cont(fn) {
      this.fn = fn;
    }

    var emptyList = {};

    var ConsCell = function (head, tail) {
      this.head = head;
      this.tail = tail;
    };

    function consList(x) {
      return function (xs) {
        return new ConsCell(x, xs);
      };
    }

    function listToArray(list) {
      var arr = [];
      while (list !== emptyList) {
        arr.push(list.head);
        list = list.tail;
      }
      return arr;
    }

    return function (apply) {
      return function (map) {
        return function (pure) {
          return function (f) {
            var buildFrom = function (x, ys) {
              return apply(map(consList)(f(x)))(ys);
            };

            var go = function (acc, currentLen, xs) {
              if (currentLen === 0) {
                return acc;
              } else {
                var last = xs[currentLen - 1];
                return new Cont(function () {
                  return go(buildFrom(last, acc), currentLen - 1, xs);
                });
              }
            };

            return function (array) {
              var result = go(pure(emptyList), array.length, array);
              while (result instanceof Cont) {
                result = result.fn();
              }

              return map(listToArray)(result);
            };
          };
        };
      };
    };
  }();
})(PS["Data.Traversable"] = PS["Data.Traversable"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.Traversable"];
  var Prelude = PS["Prelude"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Maybe_First = PS["Data.Maybe.First"];
  var Data_Maybe_Last = PS["Data.Maybe.Last"];
  var Data_Monoid_Additive = PS["Data.Monoid.Additive"];
  var Data_Monoid_Conj = PS["Data.Monoid.Conj"];
  var Data_Monoid_Disj = PS["Data.Monoid.Disj"];
  var Data_Monoid_Dual = PS["Data.Monoid.Dual"];
  var Data_Monoid_Multiplicative = PS["Data.Monoid.Multiplicative"];
  var Control_Apply = PS["Control.Apply"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Category = PS["Control.Category"];
  var Traversable = function (__superclass_Data$dotFoldable$dotFoldable_1, __superclass_Data$dotFunctor$dotFunctor_0, sequence, traverse) {
      this["__superclass_Data.Foldable.Foldable_1"] = __superclass_Data$dotFoldable$dotFoldable_1;
      this["__superclass_Data.Functor.Functor_0"] = __superclass_Data$dotFunctor$dotFunctor_0;
      this.sequence = sequence;
      this.traverse = traverse;
  };
  var traverse = function (dict) {
      return dict.traverse;
  };
  var sequenceDefault = function (dictTraversable) {
      return function (dictApplicative) {
          return function (tma) {
              return traverse(dictTraversable)(dictApplicative)(Control_Category.id(Control_Category.categoryFn))(tma);
          };
      };
  };
  var traversableArray = new Traversable(function () {
      return Data_Foldable.foldableArray;
  }, function () {
      return Data_Functor.functorArray;
  }, function (dictApplicative) {
      return sequenceDefault(traversableArray)(dictApplicative);
  }, function (dictApplicative) {
      return $foreign.traverseArrayImpl(Control_Apply.apply(dictApplicative["__superclass_Control.Apply.Apply_0"]()))(Data_Functor.map((dictApplicative["__superclass_Control.Apply.Apply_0"]())["__superclass_Data.Functor.Functor_0"]()))(Control_Applicative.pure(dictApplicative));
  });
  var sequence = function (dict) {
      return dict.sequence;
  }; 
  var $$for = function (dictApplicative) {
      return function (dictTraversable) {
          return function (x) {
              return function (f) {
                  return traverse(dictTraversable)(dictApplicative)(f)(x);
              };
          };
      };
  };
  exports["Traversable"] = Traversable;
  exports["for"] = $$for;
  exports["sequence"] = sequence;
  exports["sequenceDefault"] = sequenceDefault;
  exports["traverse"] = traverse;
  exports["traversableArray"] = traversableArray;
})(PS["Data.Traversable"] = PS["Data.Traversable"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Alt = PS["Control.Alt"];
  var Control_Extend = PS["Control.Extend"];
  var Data_Bifoldable = PS["Data.Bifoldable"];
  var Data_Bifunctor = PS["Data.Bifunctor"];
  var Data_Bitraversable = PS["Data.Bitraversable"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Functor_Invariant = PS["Data.Functor.Invariant"];
  var Data_Monoid = PS["Data.Monoid"];
  var Data_Traversable = PS["Data.Traversable"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad = PS["Control.Monad"];
  var Data_Show = PS["Data.Show"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Ordering = PS["Data.Ordering"];
  var Data_Bounded = PS["Data.Bounded"];
  var Data_Semiring = PS["Data.Semiring"];
  var Data_Function = PS["Data.Function"];        
  var Left = (function () {
      function Left(value0) {
          this.value0 = value0;
      };
      Left.create = function (value0) {
          return new Left(value0);
      };
      return Left;
  })();
  var Right = (function () {
      function Right(value0) {
          this.value0 = value0;
      };
      Right.create = function (value0) {
          return new Right(value0);
      };
      return Right;
  })();
  var functorEither = new Data_Functor.Functor(function (v) {
      return function (v1) {
          if (v1 instanceof Left) {
              return new Left(v1.value0);
          };
          if (v1 instanceof Right) {
              return new Right(v(v1.value0));
          };
          throw new Error("Failed pattern match at Data.Either line 35, column 3 - line 35, column 26: " + [ v.constructor.name, v1.constructor.name ]);
      };
  });
  var either = function (v) {
      return function (v1) {
          return function (v2) {
              if (v2 instanceof Left) {
                  return v(v2.value0);
              };
              if (v2 instanceof Right) {
                  return v1(v2.value0);
              };
              throw new Error("Failed pattern match at Data.Either line 224, column 1 - line 224, column 26: " + [ v.constructor.name, v1.constructor.name, v2.constructor.name ]);
          };
      };
  };
  var bifunctorEither = new Data_Bifunctor.Bifunctor(function (v) {
      return function (v1) {
          return function (v2) {
              if (v2 instanceof Left) {
                  return new Left(v(v2.value0));
              };
              if (v2 instanceof Right) {
                  return new Right(v1(v2.value0));
              };
              throw new Error("Failed pattern match at Data.Either line 42, column 3 - line 42, column 34: " + [ v.constructor.name, v1.constructor.name, v2.constructor.name ]);
          };
      };
  });
  var applyEither = new Control_Apply.Apply(function () {
      return functorEither;
  }, function (v) {
      return function (v1) {
          if (v instanceof Left) {
              return new Left(v.value0);
          };
          if (v instanceof Right) {
              return Data_Functor.map(functorEither)(v.value0)(v1);
          };
          throw new Error("Failed pattern match at Data.Either line 78, column 3 - line 78, column 28: " + [ v.constructor.name, v1.constructor.name ]);
      };
  });
  var applicativeEither = new Control_Applicative.Applicative(function () {
      return applyEither;
  }, Right.create);
  exports["Left"] = Left;
  exports["Right"] = Right;
  exports["either"] = either;
  exports["functorEither"] = functorEither;
  exports["bifunctorEither"] = bifunctorEither;
  exports["applyEither"] = applyEither;
  exports["applicativeEither"] = applicativeEither;
})(PS["Data.Either"] = PS["Data.Either"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Control.Monad.Eff.Exception"];
  var Prelude = PS["Prelude"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Data_Either = PS["Data.Either"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Show = PS["Data.Show"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Functor = PS["Data.Functor"];
  exports["catchException"] = $foreign.catchException;
  exports["error"] = $foreign.error;
  exports["message"] = $foreign.message;
  exports["throwException"] = $foreign.throwException;
})(PS["Control.Monad.Eff.Exception"] = PS["Control.Monad.Eff.Exception"] || {});
(function(exports) {
    "use strict";

  exports.runFn2 = function (fn) {
    return function (a) {
      return function (b) {
        return fn(a, b);
      };
    };
  };

  exports.runFn4 = function (fn) {
    return function (a) {
      return function (b) {
        return function (c) {
          return function (d) {
            return fn(a, b, c, d);
          };
        };
      };
    };
  };
})(PS["Data.Function.Uncurried"] = PS["Data.Function.Uncurried"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.Function.Uncurried"];
  var Data_Unit = PS["Data.Unit"];
  exports["runFn2"] = $foreign.runFn2;
  exports["runFn4"] = $foreign.runFn4;
})(PS["Data.Function.Uncurried"] = PS["Data.Function.Uncurried"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Control.Monad.Aff.Internal"];
  var Prelude = PS["Prelude"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
  exports["_makeVar"] = $foreign._makeVar;
  exports["_peekVar"] = $foreign._peekVar;
  exports["_putVar"] = $foreign._putVar;
  exports["_takeVar"] = $foreign._takeVar;
})(PS["Control.Monad.Aff.Internal"] = PS["Control.Monad.Aff.Internal"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Control_Category = PS["Control.Category"];
  var Control_Monad = PS["Control.Monad"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];        
  var MonadEff = function (__superclass_Control$dotMonad$dotMonad_0, liftEff) {
      this["__superclass_Control.Monad.Monad_0"] = __superclass_Control$dotMonad$dotMonad_0;
      this.liftEff = liftEff;
  };                                                   
  var liftEff = function (dict) {
      return dict.liftEff;
  };
  exports["MonadEff"] = MonadEff;
  exports["liftEff"] = liftEff;
})(PS["Control.Monad.Eff.Class"] = PS["Control.Monad.Eff.Class"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Either = PS["Data.Either"];
  var Data_Function = PS["Data.Function"];
  var Data_Unit = PS["Data.Unit"];        
  var MonadError = function (__superclass_Control$dotMonad$dotMonad_0, catchError, throwError) {
      this["__superclass_Control.Monad.Monad_0"] = __superclass_Control$dotMonad$dotMonad_0;
      this.catchError = catchError;
      this.throwError = throwError;
  };
  var throwError = function (dict) {
      return dict.throwError;
  };                          
  var catchError = function (dict) {
      return dict.catchError;
  };
  var catchJust = function (dictMonadError) {
      return function (p) {
          return function (act) {
              return function (handler) {
                  var handle = function (e) {
                      var $12 = p(e);
                      if ($12 instanceof Data_Maybe.Nothing) {
                          return throwError(dictMonadError)(e);
                      };
                      if ($12 instanceof Data_Maybe.Just) {
                          return handler($12.value0);
                      };
                      throw new Error("Failed pattern match at Control.Monad.Error.Class line 44, column 5 - line 46, column 26: " + [ $12.constructor.name ]);
                  };
                  return catchError(dictMonadError)(act)(handle);
              };
          };
      };
  };
  exports["MonadError"] = MonadError;
  exports["catchError"] = catchError;
  exports["catchJust"] = catchJust;
  exports["throwError"] = throwError;
})(PS["Control.Monad.Error.Class"] = PS["Control.Monad.Error.Class"] || {});
(function(exports) {
    "use strict";

  // module Unsafe.Coerce

  exports.unsafeCoerce = function (x) {
    return x;
  };
})(PS["Unsafe.Coerce"] = PS["Unsafe.Coerce"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Unsafe.Coerce"];
  exports["unsafeCoerce"] = $foreign.unsafeCoerce;
})(PS["Unsafe.Coerce"] = PS["Unsafe.Coerce"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Control.Monad.Aff"];
  var Prelude = PS["Prelude"];
  var Control_Alt = PS["Control.Alt"];
  var Control_Alternative = PS["Control.Alternative"];
  var Control_Monad_Aff_Internal = PS["Control.Monad.Aff.Internal"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
  var Control_Monad_Rec_Class = PS["Control.Monad.Rec.Class"];
  var Control_MonadPlus = PS["Control.MonadPlus"];
  var Control_Parallel = PS["Control.Parallel"];
  var Control_Plus = PS["Control.Plus"];
  var Data_Either = PS["Data.Either"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
  var Data_Monoid = PS["Data.Monoid"];
  var Data_Newtype = PS["Data.Newtype"];
  var Unsafe_Coerce = PS["Unsafe.Coerce"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Control_Apply = PS["Control.Apply"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad = PS["Control.Monad"];
  var Data_Function = PS["Data.Function"];
  var Control_MonadZero = PS["Control.MonadZero"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Semiring = PS["Data.Semiring"];
  var Control_Parallel_Class = PS["Control.Parallel.Class"];
  var Data_Unit = PS["Data.Unit"];
  var Canceler = function (x) {
      return x;
  };
  var runAff = function (ex) {
      return function (f) {
          return function (aff) {
              return $foreign._runAff(ex, f, aff);
          };
      };
  };         
  var makeAff$prime = function (h) {
      return $foreign._makeAff(h);
  };
  var functorAff = new Data_Functor.Functor(function (f) {
      return function (fa) {
          return $foreign._fmap(f, fa);
      };
  });                                        
  var cancel = function (v) {
      return v;
  };
  var launchAff = (function () {
      var lowerEx = Data_Functor.map(Control_Monad_Eff.functorEff)(function ($47) {
          return Canceler(Data_Functor.map(Data_Functor.functorFn)($foreign._unsafeInterleaveAff)(cancel($47)));
      });
      return function ($48) {
          return lowerEx(runAff(Control_Monad_Eff_Exception.throwException)(Data_Function["const"](Control_Applicative.pure(Control_Monad_Eff.applicativeEff)(Data_Unit.unit)))($foreign._unsafeInterleaveAff($48)));
      };
  })();
  var attempt = function (aff) {
      return $foreign._attempt(Data_Either.Left.create, Data_Either.Right.create, aff);
  };
  var apathize = function (a) {
      return Data_Functor.map(functorAff)(Data_Function["const"](Data_Unit.unit))(attempt(a));
  };
  var applyAff = new Control_Apply.Apply(function () {
      return functorAff;
  }, function (ff) {
      return function (fa) {
          return $foreign._bind(alwaysCanceler, ff, function (f) {
              return Data_Functor.map(functorAff)(f)(fa);
          });
      };
  });
  var applicativeAff = new Control_Applicative.Applicative(function () {
      return applyAff;
  }, function (v) {
      return $foreign._pure(nonCanceler, v);
  });
  var nonCanceler = Data_Function["const"](Control_Applicative.pure(applicativeAff)(false));
  var alwaysCanceler = Data_Function["const"](Control_Applicative.pure(applicativeAff)(true));
  var forkAff = function (aff) {
      return $foreign._forkAff(nonCanceler, aff);
  };
  var makeAff = function (h) {
      return makeAff$prime(function (e) {
          return function (a) {
              return Data_Functor.map(Control_Monad_Eff.functorEff)(Data_Function["const"](nonCanceler))(h(e)(a));
          };
      });
  };                                                                         
  var bindAff = new Control_Bind.Bind(function () {
      return applyAff;
  }, function (fa) {
      return function (f) {
          return $foreign._bind(alwaysCanceler, fa, f);
      };
  });
  var monadAff = new Control_Monad.Monad(function () {
      return applicativeAff;
  }, function () {
      return bindAff;
  });
  var monadEffAff = new Control_Monad_Eff_Class.MonadEff(function () {
      return monadAff;
  }, function (eff) {
      return $foreign._liftEff(nonCanceler, eff);
  });
  var monadErrorAff = new Control_Monad_Error_Class.MonadError(function () {
      return monadAff;
  }, function (aff) {
      return function (ex) {
          return Control_Bind.bind(bindAff)(attempt(aff))(Data_Either.either(ex)(Control_Applicative.pure(applicativeAff)));
      };
  }, function (e) {
      return $foreign._throwError(nonCanceler, e);
  });
  exports["Canceler"] = Canceler;
  exports["apathize"] = apathize;
  exports["attempt"] = attempt;
  exports["cancel"] = cancel;
  exports["forkAff"] = forkAff;
  exports["launchAff"] = launchAff;
  exports["makeAff"] = makeAff;
  exports["nonCanceler"] = nonCanceler;
  exports["runAff"] = runAff;
  exports["functorAff"] = functorAff;
  exports["applyAff"] = applyAff;
  exports["applicativeAff"] = applicativeAff;
  exports["bindAff"] = bindAff;
  exports["monadAff"] = monadAff;
  exports["monadEffAff"] = monadEffAff;
  exports["monadErrorAff"] = monadErrorAff;
})(PS["Control.Monad.Aff"] = PS["Control.Monad.Aff"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Control_Monad_Aff_Internal = PS["Control.Monad.Aff.Internal"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
  var Unsafe_Coerce = PS["Unsafe.Coerce"];
  var Data_Function = PS["Data.Function"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];        
  var fromAVBox = Unsafe_Coerce.unsafeCoerce;
  var makeVar = fromAVBox(Control_Monad_Aff_Internal._makeVar(Control_Monad_Aff.nonCanceler));
  var peekVar = function (q) {
      return fromAVBox(Control_Monad_Aff_Internal._peekVar(Control_Monad_Aff.nonCanceler, q));
  };
  var putVar = function (q) {
      return function (a) {
          return fromAVBox(Control_Monad_Aff_Internal._putVar(Control_Monad_Aff.nonCanceler, q, a));
      };
  };
  var takeVar = function (q) {
      return fromAVBox(Control_Monad_Aff_Internal._takeVar(Control_Monad_Aff.nonCanceler, q));
  };
  exports["makeVar"] = makeVar;
  exports["peekVar"] = peekVar;
  exports["putVar"] = putVar;
  exports["takeVar"] = takeVar;
})(PS["Control.Monad.Aff.AVar"] = PS["Control.Monad.Aff.AVar"] || {});
(function(exports) {
    "use strict";

  exports.log = function (s) {
    return function () {
      console.log(s);
      return {};
    };
  };

  exports.error = function (s) {
    return function () {
      console.error(s);
      return {};
    };
  };
})(PS["Control.Monad.Eff.Console"] = PS["Control.Monad.Eff.Console"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Control.Monad.Eff.Console"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Data_Show = PS["Data.Show"];
  var Data_Unit = PS["Data.Unit"];
  exports["error"] = $foreign.error;
  exports["log"] = $foreign.log;
})(PS["Control.Monad.Eff.Console"] = PS["Control.Monad.Eff.Console"] || {});
(function(exports) {
    "use strict";

  exports.unsafeCoerceEff = function (f) {
    return f;
  };
})(PS["Control.Monad.Eff.Unsafe"] = PS["Control.Monad.Eff.Unsafe"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Control.Monad.Eff.Unsafe"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];        
  var unsafePerformEff = function ($0) {
      return Control_Monad_Eff.runPure($foreign.unsafeCoerceEff($0));
  };
  exports["unsafePerformEff"] = unsafePerformEff;
  exports["unsafeCoerceEff"] = $foreign.unsafeCoerceEff;
})(PS["Control.Monad.Eff.Unsafe"] = PS["Control.Monad.Eff.Unsafe"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Control_Monad_Eff_Unsafe = PS["Control.Monad.Eff.Unsafe"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];        
  var unsafeThrowException = function ($0) {
      return Control_Monad_Eff_Unsafe.unsafePerformEff(Control_Monad_Eff_Exception.throwException($0));
  };
  var unsafeThrow = function ($1) {
      return unsafeThrowException(Control_Monad_Eff_Exception.error($1));
  };
  exports["unsafeThrow"] = unsafeThrow;
  exports["unsafeThrowException"] = unsafeThrowException;
})(PS["Control.Monad.Eff.Exception.Unsafe"] = PS["Control.Monad.Eff.Exception.Unsafe"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Biapplicative = PS["Control.Biapplicative"];
  var Control_Biapply = PS["Control.Biapply"];
  var Control_Comonad = PS["Control.Comonad"];
  var Control_Extend = PS["Control.Extend"];
  var Control_Lazy = PS["Control.Lazy"];
  var Data_Bifoldable = PS["Data.Bifoldable"];
  var Data_Bifunctor = PS["Data.Bifunctor"];
  var Data_Bitraversable = PS["Data.Bitraversable"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Functor_Invariant = PS["Data.Functor.Invariant"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Maybe_First = PS["Data.Maybe.First"];
  var Data_Monoid = PS["Data.Monoid"];
  var Data_Newtype = PS["Data.Newtype"];
  var Data_Traversable = PS["Data.Traversable"];
  var Data_Show = PS["Data.Show"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Ordering = PS["Data.Ordering"];
  var Data_Bounded = PS["Data.Bounded"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Semiring = PS["Data.Semiring"];
  var Data_Ring = PS["Data.Ring"];
  var Data_CommutativeRing = PS["Data.CommutativeRing"];
  var Data_BooleanAlgebra = PS["Data.BooleanAlgebra"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad = PS["Control.Monad"];
  var Data_Function = PS["Data.Function"];
  var Data_Unit = PS["Data.Unit"];        
  var Tuple = (function () {
      function Tuple(value0, value1) {
          this.value0 = value0;
          this.value1 = value1;
      };
      Tuple.create = function (value0) {
          return function (value1) {
              return new Tuple(value0, value1);
          };
      };
      return Tuple;
  })();
  var snd = function (v) {
      return v.value1;
  };
  var showTuple = function (dictShow) {
      return function (dictShow1) {
          return new Data_Show.Show(function (v) {
              return "(Tuple " + (Data_Show.show(dictShow)(v.value0) + (" " + (Data_Show.show(dictShow1)(v.value1) + ")")));
          });
      };
  }; 
  var semigroupTuple = function (dictSemigroup) {
      return function (dictSemigroup1) {
          return new Data_Semigroup.Semigroup(function (v) {
              return function (v1) {
                  return new Tuple(Data_Semigroup.append(dictSemigroup)(v.value0)(v1.value0), Data_Semigroup.append(dictSemigroup1)(v.value1)(v1.value1));
              };
          });
      };
  };
  var monoidTuple = function (dictMonoid) {
      return function (dictMonoid1) {
          return new Data_Monoid.Monoid(function () {
              return semigroupTuple(dictMonoid["__superclass_Data.Semigroup.Semigroup_0"]())(dictMonoid1["__superclass_Data.Semigroup.Semigroup_0"]());
          }, new Tuple(Data_Monoid.mempty(dictMonoid), Data_Monoid.mempty(dictMonoid1)));
      };
  };
  var lookup = function (dictFoldable) {
      return function (dictEq) {
          return function (a) {
              return function ($255) {
                  return Data_Newtype.unwrap(Data_Maybe_First.newtypeFirst)(Data_Foldable.foldMap(dictFoldable)(Data_Maybe_First.monoidFirst)(function (v) {
                      var $135 = Data_Eq.eq(dictEq)(a)(v.value0);
                      if ($135) {
                          return new Data_Maybe.Just(v.value1);
                      };
                      if (!$135) {
                          return Data_Maybe.Nothing.value;
                      };
                      throw new Error("Failed pattern match at Data.Tuple line 170, column 55 - line 170, column 90: " + [ $135.constructor.name ]);
                  })($255));
              };
          };
      };
  };                                                                                                    
  var fst = function (v) {
      return v.value0;
  };
  exports["Tuple"] = Tuple;
  exports["fst"] = fst;
  exports["lookup"] = lookup;
  exports["snd"] = snd;
  exports["showTuple"] = showTuple;
  exports["semigroupTuple"] = semigroupTuple;
  exports["monoidTuple"] = monoidTuple;
})(PS["Data.Tuple"] = PS["Data.Tuple"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Tuple = PS["Data.Tuple"];
  var Data_Unit = PS["Data.Unit"];        
  var MonadState = function (__superclass_Control$dotMonad$dotMonad_0, state) {
      this["__superclass_Control.Monad.Monad_0"] = __superclass_Control$dotMonad$dotMonad_0;
      this.state = state;
  };
  var state = function (dict) {
      return dict.state;
  };
  var modify = function (dictMonadState) {
      return function (f) {
          return state(dictMonadState)(function (s) {
              return new Data_Tuple.Tuple(Data_Unit.unit, f(s));
          });
      };
  };
  var gets = function (dictMonadState) {
      return function (f) {
          return state(dictMonadState)(function (s) {
              return new Data_Tuple.Tuple(f(s), s);
          });
      };
  };
  var get = function (dictMonadState) {
      return state(dictMonadState)(function (s) {
          return new Data_Tuple.Tuple(s, s);
      });
  };
  exports["MonadState"] = MonadState;
  exports["get"] = get;
  exports["gets"] = gets;
  exports["modify"] = modify;
  exports["state"] = state;
})(PS["Control.Monad.State.Class"] = PS["Control.Monad.State.Class"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];        
  var MonadTrans = function (lift) {
      this.lift = lift;
  };
  var lift = function (dict) {
      return dict.lift;
  };
  exports["MonadTrans"] = MonadTrans;
  exports["lift"] = lift;
})(PS["Control.Monad.Trans.Class"] = PS["Control.Monad.Trans.Class"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Alt = PS["Control.Alt"];
  var Control_Alternative = PS["Control.Alternative"];
  var Control_Monad_Cont_Class = PS["Control.Monad.Cont.Class"];
  var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
  var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
  var Control_Monad_Reader_Class = PS["Control.Monad.Reader.Class"];
  var Control_Monad_Rec_Class = PS["Control.Monad.Rec.Class"];
  var Control_Monad_State_Class = PS["Control.Monad.State.Class"];
  var Control_Monad_Trans_Class = PS["Control.Monad.Trans.Class"];
  var Control_Monad_Writer_Class = PS["Control.Monad.Writer.Class"];
  var Control_MonadPlus = PS["Control.MonadPlus"];
  var Control_MonadZero = PS["Control.MonadZero"];
  var Control_Plus = PS["Control.Plus"];
  var Data_Either = PS["Data.Either"];
  var Data_Monoid = PS["Data.Monoid"];
  var Data_Newtype = PS["Data.Newtype"];
  var Data_Tuple = PS["Data.Tuple"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Monad = PS["Control.Monad"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Control_Bind = PS["Control.Bind"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Function = PS["Data.Function"];
  var Control_Category = PS["Control.Category"];        
  var ExceptT = function (x) {
      return x;
  };
  var runExceptT = function (v) {
      return v;
  };          
  var monadTransExceptT = new Control_Monad_Trans_Class.MonadTrans(function (dictMonad) {
      return function (m) {
          return Control_Bind.bind(dictMonad["__superclass_Control.Bind.Bind_1"]())(m)(function (v) {
              return Control_Applicative.pure(dictMonad["__superclass_Control.Applicative.Applicative_0"]())(new Data_Either.Right(v));
          });
      };
  });
  var mapExceptT = function (f) {
      return function (v) {
          return f(v);
      };
  };
  var functorExceptT = function (dictFunctor) {
      return new Data_Functor.Functor(function (f) {
          return mapExceptT(Data_Functor.map(dictFunctor)(Data_Functor.map(Data_Either.functorEither)(f)));
      });
  };
  var monadExceptT = function (dictMonad) {
      return new Control_Monad.Monad(function () {
          return applicativeExceptT(dictMonad);
      }, function () {
          return bindExceptT(dictMonad);
      });
  };
  var bindExceptT = function (dictMonad) {
      return new Control_Bind.Bind(function () {
          return applyExceptT(dictMonad);
      }, function (v) {
          return function (k) {
              return Control_Bind.bind(dictMonad["__superclass_Control.Bind.Bind_1"]())(v)(Data_Either.either(function ($88) {
                  return Control_Applicative.pure(dictMonad["__superclass_Control.Applicative.Applicative_0"]())(Data_Either.Left.create($88));
              })(function (a) {
                  var $56 = k(a);
                  return $56;
              }));
          };
      });
  };
  var applyExceptT = function (dictMonad) {
      return new Control_Apply.Apply(function () {
          return functorExceptT(((dictMonad["__superclass_Control.Bind.Bind_1"]())["__superclass_Control.Apply.Apply_0"]())["__superclass_Data.Functor.Functor_0"]());
      }, Control_Monad.ap(monadExceptT(dictMonad)));
  };
  var applicativeExceptT = function (dictMonad) {
      return new Control_Applicative.Applicative(function () {
          return applyExceptT(dictMonad);
      }, function ($89) {
          return ExceptT(Control_Applicative.pure(dictMonad["__superclass_Control.Applicative.Applicative_0"]())(Data_Either.Right.create($89)));
      });
  };
  var monadErrorExceptT = function (dictMonad) {
      return new Control_Monad_Error_Class.MonadError(function () {
          return monadExceptT(dictMonad);
      }, function (v) {
          return function (k) {
              return Control_Bind.bind(dictMonad["__superclass_Control.Bind.Bind_1"]())(v)(Data_Either.either(function (a) {
                  var $60 = k(a);
                  return $60;
              })(function ($91) {
                  return Control_Applicative.pure(dictMonad["__superclass_Control.Applicative.Applicative_0"]())(Data_Either.Right.create($91));
              }));
          };
      }, function ($92) {
          return ExceptT(Control_Applicative.pure(dictMonad["__superclass_Control.Applicative.Applicative_0"]())(Data_Either.Left.create($92)));
      });
  };
  var monadStateExceptT = function (dictMonadState) {
      return new Control_Monad_State_Class.MonadState(function () {
          return monadExceptT(dictMonadState["__superclass_Control.Monad.Monad_0"]());
      }, function (f) {
          return Control_Monad_Trans_Class.lift(monadTransExceptT)(dictMonadState["__superclass_Control.Monad.Monad_0"]())(Control_Monad_State_Class.state(dictMonadState)(f));
      });
  };
  exports["ExceptT"] = ExceptT;
  exports["mapExceptT"] = mapExceptT;
  exports["runExceptT"] = runExceptT;
  exports["functorExceptT"] = functorExceptT;
  exports["applyExceptT"] = applyExceptT;
  exports["applicativeExceptT"] = applicativeExceptT;
  exports["bindExceptT"] = bindExceptT;
  exports["monadExceptT"] = monadExceptT;
  exports["monadTransExceptT"] = monadTransExceptT;
  exports["monadErrorExceptT"] = monadErrorExceptT;
  exports["monadStateExceptT"] = monadStateExceptT;
})(PS["Control.Monad.Except.Trans"] = PS["Control.Monad.Except.Trans"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Alt = PS["Control.Alt"];
  var Control_Comonad = PS["Control.Comonad"];
  var Control_Extend = PS["Control.Extend"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Functor_Invariant = PS["Data.Functor.Invariant"];
  var Data_Monoid = PS["Data.Monoid"];
  var Data_Newtype = PS["Data.Newtype"];
  var Data_Traversable = PS["Data.Traversable"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Bounded = PS["Data.Bounded"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_BooleanAlgebra = PS["Data.BooleanAlgebra"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Semiring = PS["Data.Semiring"];
  var Data_EuclideanRing = PS["Data.EuclideanRing"];
  var Data_Ring = PS["Data.Ring"];
  var Data_CommutativeRing = PS["Data.CommutativeRing"];
  var Data_Field = PS["Data.Field"];
  var Data_Show = PS["Data.Show"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad = PS["Control.Monad"];        
  var Identity = function (x) {
      return x;
  };
  var newtypeIdentity = new Data_Newtype.Newtype(function (n) {
      return n;
  }, Identity);
  var functorIdentity = new Data_Functor.Functor(function (f) {
      return function (v) {
          return f(v);
      };
  });
  var applyIdentity = new Control_Apply.Apply(function () {
      return functorIdentity;
  }, function (v) {
      return function (v1) {
          return v(v1);
      };
  });
  var bindIdentity = new Control_Bind.Bind(function () {
      return applyIdentity;
  }, function (v) {
      return function (f) {
          return f(v);
      };
  });
  var applicativeIdentity = new Control_Applicative.Applicative(function () {
      return applyIdentity;
  }, Identity);
  var monadIdentity = new Control_Monad.Monad(function () {
      return applicativeIdentity;
  }, function () {
      return bindIdentity;
  });
  exports["Identity"] = Identity;
  exports["newtypeIdentity"] = newtypeIdentity;
  exports["functorIdentity"] = functorIdentity;
  exports["applyIdentity"] = applyIdentity;
  exports["applicativeIdentity"] = applicativeIdentity;
  exports["bindIdentity"] = bindIdentity;
  exports["monadIdentity"] = monadIdentity;
})(PS["Data.Identity"] = PS["Data.Identity"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
  var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
  var Data_Either = PS["Data.Either"];
  var Data_Identity = PS["Data.Identity"];
  var Data_Newtype = PS["Data.Newtype"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];                                 
  var runExcept = function ($0) {
      return Data_Newtype.unwrap(Data_Identity.newtypeIdentity)(Control_Monad_Except_Trans.runExceptT($0));
  };
  var mapExcept = function (f) {
      return Control_Monad_Except_Trans.mapExceptT(function ($1) {
          return Data_Identity.Identity(f(Data_Newtype.unwrap(Data_Identity.newtypeIdentity)($1)));
      });
  };
  exports["mapExcept"] = mapExcept;
  exports["runExcept"] = runExcept;
})(PS["Control.Monad.Except"] = PS["Control.Monad.Except"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Alt = PS["Control.Alt"];
  var Control_Alternative = PS["Control.Alternative"];
  var Control_Lazy = PS["Control.Lazy"];
  var Control_Monad_Cont_Class = PS["Control.Monad.Cont.Class"];
  var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
  var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
  var Control_Monad_Reader_Class = PS["Control.Monad.Reader.Class"];
  var Control_Monad_Rec_Class = PS["Control.Monad.Rec.Class"];
  var Control_Monad_State_Class = PS["Control.Monad.State.Class"];
  var Control_Monad_Trans_Class = PS["Control.Monad.Trans.Class"];
  var Control_Monad_Writer_Class = PS["Control.Monad.Writer.Class"];
  var Control_MonadPlus = PS["Control.MonadPlus"];
  var Control_MonadZero = PS["Control.MonadZero"];
  var Control_Plus = PS["Control.Plus"];
  var Data_Newtype = PS["Data.Newtype"];
  var Data_Tuple = PS["Data.Tuple"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Monad = PS["Control.Monad"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Function = PS["Data.Function"];
  var Control_Bind = PS["Control.Bind"];
  var Data_Unit = PS["Data.Unit"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];        
  var StateT = function (x) {
      return x;
  };
  var runStateT = function (v) {
      return v;
  };         
  var monadTransStateT = new Control_Monad_Trans_Class.MonadTrans(function (dictMonad) {
      return function (m) {
          return function (s) {
              return Control_Bind.bind(dictMonad["__superclass_Control.Bind.Bind_1"]())(m)(function (v) {
                  return Control_Applicative.pure(dictMonad["__superclass_Control.Applicative.Applicative_0"]())(new Data_Tuple.Tuple(v, s));
              });
          };
      };
  });
  var lazyStateT = new Control_Lazy.Lazy(function (f) {
      return function (s) {
          var $52 = f(Data_Unit.unit);
          return $52(s);
      };
  });
  var functorStateT = function (dictFunctor) {
      return new Data_Functor.Functor(function (f) {
          return function (v) {
              return function (s) {
                  return Data_Functor.map(dictFunctor)(function (v1) {
                      return new Data_Tuple.Tuple(f(v1.value0), v1.value1);
                  })(v(s));
              };
          };
      });
  };
  var evalStateT = function (dictFunctor) {
      return function (v) {
          return function (s) {
              return Data_Functor.map(dictFunctor)(Data_Tuple.fst)(v(s));
          };
      };
  };
  var monadStateT = function (dictMonad) {
      return new Control_Monad.Monad(function () {
          return applicativeStateT(dictMonad);
      }, function () {
          return bindStateT(dictMonad);
      });
  };
  var bindStateT = function (dictMonad) {
      return new Control_Bind.Bind(function () {
          return applyStateT(dictMonad);
      }, function (v) {
          return function (f) {
              return function (s) {
                  return Control_Bind.bind(dictMonad["__superclass_Control.Bind.Bind_1"]())(v(s))(function (v1) {
                      var $65 = f(v1.value0);
                      return $65(v1.value1);
                  });
              };
          };
      });
  };
  var applyStateT = function (dictMonad) {
      return new Control_Apply.Apply(function () {
          return functorStateT(((dictMonad["__superclass_Control.Bind.Bind_1"]())["__superclass_Control.Apply.Apply_0"]())["__superclass_Data.Functor.Functor_0"]());
      }, Control_Monad.ap(monadStateT(dictMonad)));
  };
  var applicativeStateT = function (dictMonad) {
      return new Control_Applicative.Applicative(function () {
          return applyStateT(dictMonad);
      }, function (a) {
          return function (s) {
              return Control_Applicative.pure(dictMonad["__superclass_Control.Applicative.Applicative_0"]())(new Data_Tuple.Tuple(a, s));
          };
      });
  };
  var monadStateStateT = function (dictMonad) {
      return new Control_Monad_State_Class.MonadState(function () {
          return monadStateT(dictMonad);
      }, function (f) {
          return StateT(function ($101) {
              return Control_Applicative.pure(dictMonad["__superclass_Control.Applicative.Applicative_0"]())(f($101));
          });
      });
  };
  exports["StateT"] = StateT;
  exports["evalStateT"] = evalStateT;
  exports["runStateT"] = runStateT;
  exports["functorStateT"] = functorStateT;
  exports["applyStateT"] = applyStateT;
  exports["applicativeStateT"] = applicativeStateT;
  exports["bindStateT"] = bindStateT;
  exports["monadStateT"] = monadStateT;
  exports["monadTransStateT"] = monadTransStateT;
  exports["lazyStateT"] = lazyStateT;
  exports["monadStateStateT"] = monadStateStateT;
})(PS["Control.Monad.State.Trans"] = PS["Control.Monad.State.Trans"] || {});
(function(exports) {
    "use strict";

  //------------------------------------------------------------------------------
  // Array creation --------------------------------------------------------------
  //------------------------------------------------------------------------------

  exports.range = function (start) {
    return function (end) {
      var step = start > end ? -1 : 1;
      var result = [];
      for (var i = start, n = 0; i !== end; i += step) {
        result[n++] = i;
      }
      result[n] = i;
      return result;
    };
  };   

  //------------------------------------------------------------------------------
  // Array size ------------------------------------------------------------------
  //------------------------------------------------------------------------------

  exports.length = function (xs) {
    return xs.length;
  };

  //------------------------------------------------------------------------------
  // Extending arrays ------------------------------------------------------------
  //------------------------------------------------------------------------------

  exports.cons = function (e) {
    return function (l) {
      return [e].concat(l);
    };
  };

  //------------------------------------------------------------------------------
  // Non-indexed reads -----------------------------------------------------------
  //------------------------------------------------------------------------------

  exports["uncons'"] = function (empty) {
    return function (next) {
      return function (xs) {
        return xs.length === 0 ? empty({}) : next(xs[0])(xs.slice(1));
      };
    };
  };

  //------------------------------------------------------------------------------
  // Indexed operations ----------------------------------------------------------
  //------------------------------------------------------------------------------

  exports.indexImpl = function (just) {
    return function (nothing) {
      return function (xs) {
        return function (i) {
          return i < 0 || i >= xs.length ? nothing :  just(xs[i]);
        };
      };
    };
  };

  exports.concat = function (xss) {
    var result = [];
    for (var i = 0, l = xss.length; i < l; i++) {
      var xs = xss[i];
      for (var j = 0, m = xs.length; j < m; j++) {
        result.push(xs[j]);
      }
    }
    return result;
  };

  exports.filter = function (f) {
    return function (xs) {
      return xs.filter(f);
    };
  };

  //------------------------------------------------------------------------------
  // Sorting ---------------------------------------------------------------------
  //------------------------------------------------------------------------------

  exports.sortImpl = function (f) {
    return function (l) {
      // jshint maxparams: 2
      return l.slice().sort(function (x, y) {
        return f(x)(y);
      });
    };
  };

  //------------------------------------------------------------------------------
  // Subarrays -------------------------------------------------------------------
  //------------------------------------------------------------------------------

  exports.slice = function (s) {
    return function (e) {
      return function (l) {
        return l.slice(s, e);
      };
    };
  };

  exports.drop = function (n) {
    return function (l) {
      return n < 1 ? l : l.slice(n);
    };
  };

  //------------------------------------------------------------------------------
  // Zipping ---------------------------------------------------------------------
  //------------------------------------------------------------------------------

  exports.zipWith = function (f) {
    return function (xs) {
      return function (ys) {
        var l = xs.length < ys.length ? xs.length : ys.length;
        var result = new Array(l);
        for (var i = 0; i < l; i++) {
          result[i] = f(xs[i])(ys[i]);
        }
        return result;
      };
    };
  };
})(PS["Data.Array"] = PS["Data.Array"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Alt = PS["Control.Alt"];
  var Control_Alternative = PS["Control.Alternative"];
  var Control_Plus = PS["Control.Plus"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Traversable = PS["Data.Traversable"];
  var Data_Show = PS["Data.Show"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Eq = PS["Data.Eq"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Ordering = PS["Data.Ordering"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Category = PS["Control.Category"];        
  var NonEmpty = (function () {
      function NonEmpty(value0, value1) {
          this.value0 = value0;
          this.value1 = value1;
      };
      NonEmpty.create = function (value0) {
          return function (value1) {
              return new NonEmpty(value0, value1);
          };
      };
      return NonEmpty;
  })();
  var singleton = function (dictPlus) {
      return function (a) {
          return new NonEmpty(a, Control_Plus.empty(dictPlus));
      };
  };
  var showNonEmpty = function (dictShow) {
      return function (dictShow1) {
          return new Data_Show.Show(function (v) {
              return "(NonEmpty " + (Data_Show.show(dictShow)(v.value0) + (" " + (Data_Show.show(dictShow1)(v.value1) + ")")));
          });
      };
  };
  var functorNonEmpty = function (dictFunctor) {
      return new Data_Functor.Functor(function (f) {
          return function (v) {
              return new NonEmpty(f(v.value0), Data_Functor.map(dictFunctor)(f)(v.value1));
          };
      });
  };
  exports["NonEmpty"] = NonEmpty;
  exports["singleton"] = singleton;
  exports["showNonEmpty"] = showNonEmpty;
  exports["functorNonEmpty"] = functorNonEmpty;
})(PS["Data.NonEmpty"] = PS["Data.NonEmpty"] || {});
(function(exports) {
    "use strict";

  exports.unfoldrArrayImpl = function (isNothing) {
    return function (fromJust) {
      return function (fst) {
        return function (snd) {
          return function (f) {
            return function (b) {
              var result = [];
              while (true) {
                var maybe = f(b);
                if (isNothing(maybe)) return result;
                var tuple = fromJust(maybe);
                result.push(fst(tuple));
                b = snd(tuple);
              }
            };
          };
        };
      };
    };
  };
})(PS["Data.Unfoldable"] = PS["Data.Unfoldable"] || {});
(function(exports) {
    "use strict";

  // module Partial.Unsafe

  exports.unsafePartial = function (f) {
    return f();
  };
})(PS["Partial.Unsafe"] = PS["Partial.Unsafe"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Partial.Unsafe"];
  var Partial = PS["Partial"];
  exports["unsafePartial"] = $foreign.unsafePartial;
})(PS["Partial.Unsafe"] = PS["Partial.Unsafe"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.Unfoldable"];
  var Prelude = PS["Prelude"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Traversable = PS["Data.Traversable"];
  var Data_Tuple = PS["Data.Tuple"];
  var Partial_Unsafe = PS["Partial.Unsafe"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Ring = PS["Data.Ring"];
  var Data_Function = PS["Data.Function"];
  var Data_Unit = PS["Data.Unit"];
  var Data_Functor = PS["Data.Functor"];        
  var Unfoldable = function (unfoldr) {
      this.unfoldr = unfoldr;
  };
  var unfoldr = function (dict) {
      return dict.unfoldr;
  };
  var unfoldableArray = new Unfoldable($foreign.unfoldrArrayImpl(Data_Maybe.isNothing)(Partial_Unsafe.unsafePartial(function (dictPartial) {
      return Data_Maybe.fromJust(dictPartial);
  }))(Data_Tuple.fst)(Data_Tuple.snd));
  exports["Unfoldable"] = Unfoldable;
  exports["unfoldr"] = unfoldr;
  exports["unfoldableArray"] = unfoldableArray;
})(PS["Data.Unfoldable"] = PS["Data.Unfoldable"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var otherwise = true;
  exports["otherwise"] = otherwise;
})(PS["Data.Boolean"] = PS["Data.Boolean"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.Array"];
  var Prelude = PS["Prelude"];
  var Control_Alt = PS["Control.Alt"];
  var Control_Alternative = PS["Control.Alternative"];
  var Control_Lazy = PS["Control.Lazy"];
  var Control_Monad_Rec_Class = PS["Control.Monad.Rec.Class"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_NonEmpty = PS["Data.NonEmpty"];
  var Data_Traversable = PS["Data.Traversable"];
  var Data_Tuple = PS["Data.Tuple"];
  var Data_Unfoldable = PS["Data.Unfoldable"];
  var Partial_Unsafe = PS["Partial.Unsafe"];
  var Data_Function = PS["Data.Function"];
  var Data_Ordering = PS["Data.Ordering"];
  var Data_Ring = PS["Data.Ring"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Eq = PS["Data.Eq"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Control_Apply = PS["Control.Apply"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Boolean = PS["Data.Boolean"];
  var Data_Semiring = PS["Data.Semiring"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Control_Bind = PS["Control.Bind"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Control_Category = PS["Control.Category"];
  var sortBy = function (comp) {
      return function (xs) {
          var comp$prime = function (x) {
              return function (y) {
                  var $53 = comp(x)(y);
                  if ($53 instanceof Data_Ordering.GT) {
                      return 1;
                  };
                  if ($53 instanceof Data_Ordering.EQ) {
                      return 0;
                  };
                  if ($53 instanceof Data_Ordering.LT) {
                      return -1;
                  };
                  throw new Error("Failed pattern match at Data.Array line 451, column 15 - line 456, column 1: " + [ $53.constructor.name ]);
              };
          };
          return $foreign.sortImpl(comp$prime)(xs);
      };
  };
  var sort = function (dictOrd) {
      return function (xs) {
          return sortBy(Data_Ord.compare(dictOrd))(xs);
      };
  };
  var singleton = function (a) {
      return [ a ];
  };
  var $$null = function (xs) {
      return $foreign.length(xs) === 0;
  };
  var some = function (dictAlternative) {
      return function (dictLazy) {
          return function (v) {
              return Control_Apply.apply((dictAlternative["__superclass_Control.Applicative.Applicative_0"]())["__superclass_Control.Apply.Apply_0"]())(Data_Functor.map(((dictAlternative["__superclass_Control.Plus.Plus_1"]())["__superclass_Control.Alt.Alt_0"]())["__superclass_Data.Functor.Functor_0"]())($foreign.cons)(v))(Control_Lazy.defer(dictLazy)(function (v1) {
                  return many(dictAlternative)(dictLazy)(v);
              }));
          };
      };
  };
  var many = function (dictAlternative) {
      return function (dictLazy) {
          return function (v) {
              return Control_Alt.alt((dictAlternative["__superclass_Control.Plus.Plus_1"]())["__superclass_Control.Alt.Alt_0"]())(some(dictAlternative)(dictLazy)(v))(Control_Applicative.pure(dictAlternative["__superclass_Control.Applicative.Applicative_0"]())([  ]));
          };
      };
  };
  var index = $foreign.indexImpl(Data_Maybe.Just.create)(Data_Maybe.Nothing.value);
  var head = $foreign["uncons'"](Data_Function["const"](Data_Maybe.Nothing.value))(function (x) {
      return function (v) {
          return new Data_Maybe.Just(x);
      };
  });
  var concatMap = Data_Function.flip(Control_Bind.bind(Control_Bind.bindArray));
  var mapMaybe = function (f) {
      return concatMap(function ($77) {
          return Data_Maybe.maybe([  ])(singleton)(f($77));
      });
  };
  var catMaybes = mapMaybe(Control_Category.id(Control_Category.categoryFn));
  exports["catMaybes"] = catMaybes;
  exports["concatMap"] = concatMap;
  exports["head"] = head;
  exports["index"] = index;
  exports["many"] = many;
  exports["mapMaybe"] = mapMaybe;
  exports["null"] = $$null;
  exports["singleton"] = singleton;
  exports["some"] = some;
  exports["sort"] = sort;
  exports["sortBy"] = sortBy;
  exports["concat"] = $foreign.concat;
  exports["drop"] = $foreign.drop;
  exports["filter"] = $foreign.filter;
  exports["length"] = $foreign.length;
  exports["range"] = $foreign.range;
  exports["zipWith"] = $foreign.zipWith;
})(PS["Data.Array"] = PS["Data.Array"] || {});
(function(exports) {
    "use strict";

  exports.toLower = function (c) {
    return c.toLowerCase();
  };
})(PS["Data.Char"] = PS["Data.Char"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.Char"];
  exports["toLower"] = $foreign.toLower;
})(PS["Data.Char"] = PS["Data.Char"] || {});
(function(exports) {
  /* global exports */
  "use strict";

  // jshint maxparams: 3
  exports.parseJSONImpl = function (left, right, str) {
    try {
      return right(JSON.parse(str));
    } catch (e) {
      return left(e.toString());
    }
  };
  // jshint maxparams: 1

  exports.toForeign = function (value) {
    return value;
  };

  exports.unsafeFromForeign = function (value) {
    return value;
  };

  exports.typeOf = function (value) {
    return typeof value;
  };

  exports.tagOf = function (value) {
    return Object.prototype.toString.call(value).slice(8, -1);
  };

  exports.isNull = function (value) {
    return value === null;
  };

  exports.isUndefined = function (value) {
    return value === undefined;
  };

  exports.isArray = Array.isArray || function (value) {
    return Object.prototype.toString.call(value) === "[object Array]";
  };
})(PS["Data.Foreign"] = PS["Data.Foreign"] || {});
(function(exports) {
    "use strict";

  // module Data.Int

  exports.fromNumberImpl = function (just) {
    return function (nothing) {
      return function (n) {
        /* jshint bitwise: false */
        return (n | 0) === n ? just(n) : nothing;
      };
    };
  };

  exports.fromStringAsImpl = function (just) {
    return function (nothing) {
      return function (radix) {
        var digits;
        if (radix < 11) {
          digits = "[0-" + (radix - 1).toString() + "]";
        } else if (radix === 11) {
          digits = "[0-9a]";
        } else {
          digits = "[0-9a-" + String.fromCharCode(86 + radix) + "]";
        }
        var pattern = new RegExp("^[\\+\\-]?" + digits + "+$", "i");

        return function (s) {
          /* jshint bitwise: false */
          if (pattern.test(s)) {
            var i = parseInt(s, radix);
            return (i | 0) === i ? just(i) : nothing;
          } else {
            return nothing;
          }
        };
      };
    };
  };
})(PS["Data.Int"] = PS["Data.Int"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.Int"];
  var Data_Boolean = PS["Data.Boolean"];
  var Data_BooleanAlgebra = PS["Data.BooleanAlgebra"];
  var Data_Bounded = PS["Data.Bounded"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Function = PS["Data.Function"];
  var Data_Int_Bits = PS["Data.Int.Bits"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Ord = PS["Data.Ord"];
  var $$Math = PS["Math"];
  var Partial_Unsafe = PS["Partial.Unsafe"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var fromStringAs = $foreign.fromStringAsImpl(Data_Maybe.Just.create)(Data_Maybe.Nothing.value);
  var fromString = fromStringAs(10);
  var fromNumber = $foreign.fromNumberImpl(Data_Maybe.Just.create)(Data_Maybe.Nothing.value);
  exports["fromNumber"] = fromNumber;
  exports["fromString"] = fromString;
  exports["fromStringAs"] = fromStringAs;
})(PS["Data.Int"] = PS["Data.Int"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Alt = PS["Control.Alt"];
  var Control_Alternative = PS["Control.Alternative"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Comonad = PS["Control.Comonad"];
  var Control_Extend = PS["Control.Extend"];
  var Control_MonadPlus = PS["Control.MonadPlus"];
  var Control_MonadZero = PS["Control.MonadZero"];
  var Control_Plus = PS["Control.Plus"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Generic = PS["Data.Generic"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Monoid = PS["Data.Monoid"];
  var Data_Newtype = PS["Data.Newtype"];
  var Data_NonEmpty = PS["Data.NonEmpty"];
  var Data_Traversable = PS["Data.Traversable"];
  var Data_Tuple = PS["Data.Tuple"];
  var Data_Unfoldable = PS["Data.Unfoldable"];
  var Data_Unit = PS["Data.Unit"];
  var Data_Show = PS["Data.Show"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Functor = PS["Data.Functor"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Function = PS["Data.Function"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Ordering = PS["Data.Ordering"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Category = PS["Control.Category"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad = PS["Control.Monad"];        
  var Nil = (function () {
      function Nil() {

      };
      Nil.value = new Nil();
      return Nil;
  })();
  var Cons = (function () {
      function Cons(value0, value1) {
          this.value0 = value0;
          this.value1 = value1;
      };
      Cons.create = function (value0) {
          return function (value1) {
              return new Cons(value0, value1);
          };
      };
      return Cons;
  })();
  var NonEmptyList = function (x) {
      return x;
  };
  var semigroupList = new Data_Semigroup.Semigroup(function (v) {
      return function (ys) {
          if (v instanceof Nil) {
              return ys;
          };
          if (v instanceof Cons) {
              return new Cons(v.value0, Data_Semigroup.append(semigroupList)(v.value1)(ys));
          };
          throw new Error("Failed pattern match at Data.List.Types line 53, column 3 - line 53, column 21: " + [ v.constructor.name, ys.constructor.name ]);
      };
  });
  var foldableList = new Data_Foldable.Foldable(function (dictMonoid) {
      return function (f) {
          return Data_Foldable.foldl(foldableList)(function (acc) {
              return function ($133) {
                  return Data_Semigroup.append(dictMonoid["__superclass_Data.Semigroup.Semigroup_0"]())(acc)(f($133));
              };
          })(Data_Monoid.mempty(dictMonoid));
      };
  }, function (f) {
      var go = function (__copy_b) {
          return function (__copy_v) {
              var b = __copy_b;
              var v = __copy_v;
              tco: while (true) {
                  if (v instanceof Nil) {
                      return b;
                  };
                  if (v instanceof Cons) {
                      var __tco_b = f(b)(v.value0);
                      var __tco_v = v.value1;
                      b = __tco_b;
                      v = __tco_v;
                      continue tco;
                  };
                  throw new Error("Failed pattern match at Data.List.Types line 67, column 3 - line 70, column 34: " + [ b.constructor.name, v.constructor.name ]);
              };
          };
      };
      return go;
  }, function (f) {
      return function (b) {
          return function (as) {
              var rev = function (__copy_acc) {
                  return function (__copy_v) {
                      var acc = __copy_acc;
                      var v = __copy_v;
                      tco: while (true) {
                          if (v instanceof Nil) {
                              return acc;
                          };
                          if (v instanceof Cons) {
                              var __tco_acc = new Cons(v.value0, acc);
                              var __tco_v = v.value1;
                              acc = __tco_acc;
                              v = __tco_v;
                              continue tco;
                          };
                          throw new Error("Failed pattern match at Data.List.Types line 63, column 3 - line 66, column 40: " + [ acc.constructor.name, v.constructor.name ]);
                      };
                  };
              };
              return Data_Foldable.foldl(foldableList)(Data_Function.flip(f))(b)(rev(Nil.value)(as));
          };
      };
  });                                                                     
  var functorList = new Data_Functor.Functor(function (f) {
      return Data_Foldable.foldr(foldableList)(function (x) {
          return function (acc) {
              return new Cons(f(x), acc);
          };
      })(Nil.value);
  });
  var functorNonEmptyList = Data_NonEmpty.functorNonEmpty(functorList);
  var showList = function (dictShow) {
      return new Data_Show.Show(function (v) {
          if (v instanceof Nil) {
              return "Nil";
          };
          return "(" + (Data_Foldable.intercalate(foldableList)(Data_Monoid.monoidString)(" : ")(Data_Functor.map(functorList)(Data_Show.show(dictShow))(v)) + " : Nil)");
      });
  };
  var showNonEmptyList = function (dictShow) {
      return new Data_Show.Show(function (v) {
          return "(NonEmptyList " + (Data_Show.show(Data_NonEmpty.showNonEmpty(dictShow)(showList(dictShow)))(v) + ")");
      });
  };
  var traversableList = new Data_Traversable.Traversable(function () {
      return foldableList;
  }, function () {
      return functorList;
  }, function (dictApplicative) {
      return Data_Traversable.traverse(traversableList)(dictApplicative)(Control_Category.id(Control_Category.categoryFn));
  }, function (dictApplicative) {
      return function (f) {
          return function ($134) {
              return Data_Functor.map((dictApplicative["__superclass_Control.Apply.Apply_0"]())["__superclass_Data.Functor.Functor_0"]())(Data_Foldable.foldl(foldableList)(Data_Function.flip(Cons.create))(Nil.value))(Data_Foldable.foldl(foldableList)(function (acc) {
                  return function ($135) {
                      return Control_Apply.lift2(dictApplicative["__superclass_Control.Apply.Apply_0"]())(Data_Function.flip(Cons.create))(acc)(f($135));
                  };
              })(Control_Applicative.pure(dictApplicative)(Nil.value))($134));
          };
      };
  });
  var eqList = function (dictEq) {
      return new Data_Eq.Eq(function (xs) {
          return function (ys) {
              var go = function (__copy_v) {
                  return function (__copy_v1) {
                      return function (__copy_v2) {
                          var v = __copy_v;
                          var v1 = __copy_v1;
                          var v2 = __copy_v2;
                          tco: while (true) {
                              if (!v2) {
                                  return false;
                              };
                              if (v instanceof Nil && v1 instanceof Nil) {
                                  return v2;
                              };
                              if (v instanceof Cons && v1 instanceof Cons) {
                                  var __tco_v = v.value1;
                                  var __tco_v1 = v1.value1;
                                  var __tco_v2 = v2 && Data_Eq.eq(dictEq)(v1.value0)(v.value0);
                                  v = __tco_v;
                                  v1 = __tco_v1;
                                  v2 = __tco_v2;
                                  continue tco;
                              };
                              return false;
                          };
                      };
                  };
              };
              return go(xs)(ys)(true);
          };
      });
  };
  var ordList = function (dictOrd) {
      return new Data_Ord.Ord(function () {
          return eqList(dictOrd["__superclass_Data.Eq.Eq_0"]());
      }, function (xs) {
          return function (ys) {
              var go = function (__copy_v) {
                  return function (__copy_v1) {
                      var v = __copy_v;
                      var v1 = __copy_v1;
                      tco: while (true) {
                          if (v instanceof Nil && v1 instanceof Nil) {
                              return Data_Ordering.EQ.value;
                          };
                          if (v instanceof Nil) {
                              return Data_Ordering.LT.value;
                          };
                          if (v1 instanceof Nil) {
                              return Data_Ordering.GT.value;
                          };
                          if (v instanceof Cons && v1 instanceof Cons) {
                              var $104 = Data_Ord.compare(dictOrd)(v.value0)(v1.value0);
                              if ($104 instanceof Data_Ordering.EQ) {
                                  var __tco_v = v.value1;
                                  var __tco_v1 = v1.value1;
                                  v = __tco_v;
                                  v1 = __tco_v1;
                                  continue tco;
                              };
                              return $104;
                          };
                          throw new Error("Failed pattern match at Data.List.Types line 42, column 3 - line 50, column 23: " + [ v.constructor.name, v1.constructor.name ]);
                      };
                  };
              };
              return go(xs)(ys);
          };
      });
  }; 
  var applyList = new Control_Apply.Apply(function () {
      return functorList;
  }, function (v) {
      return function (v1) {
          if (v instanceof Nil) {
              return Nil.value;
          };
          if (v instanceof Cons) {
              return Data_Semigroup.append(semigroupList)(Data_Functor.map(functorList)(v.value0)(v1))(Control_Apply.apply(applyList)(v.value1)(v1));
          };
          throw new Error("Failed pattern match at Data.List.Types line 85, column 3 - line 85, column 20: " + [ v.constructor.name, v1.constructor.name ]);
      };
  });
  var applicativeList = new Control_Applicative.Applicative(function () {
      return applyList;
  }, function (a) {
      return new Cons(a, Nil.value);
  });                                              
  var altList = new Control_Alt.Alt(function () {
      return functorList;
  }, Data_Semigroup.append(semigroupList));
  var plusList = new Control_Plus.Plus(function () {
      return altList;
  }, Nil.value);
  exports["Nil"] = Nil;
  exports["Cons"] = Cons;
  exports["NonEmptyList"] = NonEmptyList;
  exports["showList"] = showList;
  exports["eqList"] = eqList;
  exports["ordList"] = ordList;
  exports["semigroupList"] = semigroupList;
  exports["functorList"] = functorList;
  exports["foldableList"] = foldableList;
  exports["traversableList"] = traversableList;
  exports["applyList"] = applyList;
  exports["applicativeList"] = applicativeList;
  exports["altList"] = altList;
  exports["plusList"] = plusList;
  exports["showNonEmptyList"] = showNonEmptyList;
  exports["functorNonEmptyList"] = functorNonEmptyList;
})(PS["Data.List.Types"] = PS["Data.List.Types"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Alt = PS["Control.Alt"];
  var Control_Alternative = PS["Control.Alternative"];
  var Control_Lazy = PS["Control.Lazy"];
  var Control_Monad_Rec_Class = PS["Control.Monad.Rec.Class"];
  var Data_Bifunctor = PS["Data.Bifunctor"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_List_Types = PS["Data.List.Types"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_NonEmpty = PS["Data.NonEmpty"];
  var Data_Traversable = PS["Data.Traversable"];
  var Data_Tuple = PS["Data.Tuple"];
  var Data_Unfoldable = PS["Data.Unfoldable"];
  var Data_Functor = PS["Data.Functor"];
  var Data_Ring = PS["Data.Ring"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Ordering = PS["Data.Ordering"];
  var Data_Boolean = PS["Data.Boolean"];
  var Data_Function = PS["Data.Function"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Semiring = PS["Data.Semiring"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Unit = PS["Data.Unit"];
  var Control_Apply = PS["Control.Apply"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Control_Category = PS["Control.Category"];                                 
  var uncons = function (v) {
      if (v instanceof Data_List_Types.Nil) {
          return Data_Maybe.Nothing.value;
      };
      if (v instanceof Data_List_Types.Cons) {
          return new Data_Maybe.Just({
              head: v.value0, 
              tail: v.value1
          });
      };
      throw new Error("Failed pattern match at Data.List line 257, column 1 - line 257, column 21: " + [ v.constructor.name ]);
  };
  var toUnfoldable = function (dictUnfoldable) {
      return Data_Unfoldable.unfoldr(dictUnfoldable)(function (xs) {
          return Data_Functor.map(Data_Maybe.functorMaybe)(function (rec) {
              return new Data_Tuple.Tuple(rec.head, rec.tail);
          })(uncons(xs));
      });
  };
  var tail = function (v) {
      if (v instanceof Data_List_Types.Nil) {
          return Data_Maybe.Nothing.value;
      };
      if (v instanceof Data_List_Types.Cons) {
          return new Data_Maybe.Just(v.value1);
      };
      throw new Error("Failed pattern match at Data.List line 238, column 1 - line 238, column 19: " + [ v.constructor.name ]);
  };
  var $$null = function (v) {
      if (v instanceof Data_List_Types.Nil) {
          return true;
      };
      return false;
  };
  var some = function (dictAlternative) {
      return function (dictLazy) {
          return function (v) {
              return Control_Apply.apply((dictAlternative["__superclass_Control.Applicative.Applicative_0"]())["__superclass_Control.Apply.Apply_0"]())(Data_Functor.map(((dictAlternative["__superclass_Control.Plus.Plus_1"]())["__superclass_Control.Alt.Alt_0"]())["__superclass_Data.Functor.Functor_0"]())(Data_List_Types.Cons.create)(v))(Control_Lazy.defer(dictLazy)(function (v1) {
                  return many(dictAlternative)(dictLazy)(v);
              }));
          };
      };
  };
  var many = function (dictAlternative) {
      return function (dictLazy) {
          return function (v) {
              return Control_Alt.alt((dictAlternative["__superclass_Control.Plus.Plus_1"]())["__superclass_Control.Alt.Alt_0"]())(some(dictAlternative)(dictLazy)(v))(Control_Applicative.pure(dictAlternative["__superclass_Control.Applicative.Applicative_0"]())(Data_List_Types.Nil.value));
          };
      };
  };
  var head = function (v) {
      if (v instanceof Data_List_Types.Nil) {
          return Data_Maybe.Nothing.value;
      };
      if (v instanceof Data_List_Types.Cons) {
          return new Data_Maybe.Just(v.value0);
      };
      throw new Error("Failed pattern match at Data.List line 223, column 1 - line 223, column 19: " + [ v.constructor.name ]);
  };
  var fromFoldable = function (dictFoldable) {
      return Data_Foldable.foldr(dictFoldable)(Data_List_Types.Cons.create)(Data_List_Types.Nil.value);
  };
  exports["fromFoldable"] = fromFoldable;
  exports["head"] = head;
  exports["many"] = many;
  exports["null"] = $$null;
  exports["some"] = some;
  exports["tail"] = tail;
  exports["toUnfoldable"] = toUnfoldable;
  exports["uncons"] = uncons;
})(PS["Data.List"] = PS["Data.List"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_List = PS["Data.List"];
  var Data_List_Types = PS["Data.List.Types"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_NonEmpty = PS["Data.NonEmpty"];
  var Data_Tuple = PS["Data.Tuple"];
  var Data_Unfoldable = PS["Data.Unfoldable"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Functor = PS["Data.Functor"];
  var Data_Semiring = PS["Data.Semiring"];
  var Data_Function = PS["Data.Function"];
  var Control_Bind = PS["Control.Bind"];
  var singleton = function ($36) {
      return Data_List_Types.NonEmptyList(Data_NonEmpty.singleton(Data_List_Types.plusList)($36));
  };
  exports["singleton"] = singleton;
})(PS["Data.List.NonEmpty"] = PS["Data.List.NonEmpty"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.Foreign"];
  var Prelude = PS["Prelude"];
  var Control_Monad_Except = PS["Control.Monad.Except"];
  var Data_Either = PS["Data.Either"];
  var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
  var Data_Int = PS["Data.Int"];
  var Data_List_NonEmpty = PS["Data.List.NonEmpty"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_String = PS["Data.String"];
  var Data_Eq = PS["Data.Eq"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Ordering = PS["Data.Ordering"];
  var Data_Show = PS["Data.Show"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
  var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
  var Data_Identity = PS["Data.Identity"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Function = PS["Data.Function"];
  var Data_Boolean = PS["Data.Boolean"];
  var ForeignError = (function () {
      function ForeignError(value0) {
          this.value0 = value0;
      };
      ForeignError.create = function (value0) {
          return new ForeignError(value0);
      };
      return ForeignError;
  })();
  var TypeMismatch = (function () {
      function TypeMismatch(value0, value1) {
          this.value0 = value0;
          this.value1 = value1;
      };
      TypeMismatch.create = function (value0) {
          return function (value1) {
              return new TypeMismatch(value0, value1);
          };
      };
      return TypeMismatch;
  })();
  var ErrorAtIndex = (function () {
      function ErrorAtIndex(value0, value1) {
          this.value0 = value0;
          this.value1 = value1;
      };
      ErrorAtIndex.create = function (value0) {
          return function (value1) {
              return new ErrorAtIndex(value0, value1);
          };
      };
      return ErrorAtIndex;
  })();
  var ErrorAtProperty = (function () {
      function ErrorAtProperty(value0, value1) {
          this.value0 = value0;
          this.value1 = value1;
      };
      ErrorAtProperty.create = function (value0) {
          return function (value1) {
              return new ErrorAtProperty(value0, value1);
          };
      };
      return ErrorAtProperty;
  })();
  var JSONError = (function () {
      function JSONError(value0) {
          this.value0 = value0;
      };
      JSONError.create = function (value0) {
          return new JSONError(value0);
      };
      return JSONError;
  })();
  var showForeignError = new Data_Show.Show(function (v) {
      if (v instanceof ForeignError) {
          return "(ForeignError " + (v.value0 + ")");
      };
      if (v instanceof ErrorAtIndex) {
          return "(ErrorAtIndex " + (Data_Show.show(Data_Show.showInt)(v.value0) + (" " + (Data_Show.show(showForeignError)(v.value1) + ")")));
      };
      if (v instanceof ErrorAtProperty) {
          return "(ErrorAtProperty " + (Data_Show.show(Data_Show.showString)(v.value0) + (" " + (Data_Show.show(showForeignError)(v.value1) + ")")));
      };
      if (v instanceof JSONError) {
          return "(JSONError " + (Data_Show.show(Data_Show.showString)(v.value0) + ")");
      };
      if (v instanceof TypeMismatch) {
          return "(TypeMismatch " + (Data_Show.show(Data_Show.showString)(v.value0) + (" " + (Data_Show.show(Data_Show.showString)(v.value1) + ")")));
      };
      throw new Error("Failed pattern match at Data.Foreign line 65, column 3 - line 66, column 3: " + [ v.constructor.name ]);
  });
  var fail = function ($112) {
      return Control_Monad_Error_Class.throwError(Control_Monad_Except_Trans.monadErrorExceptT(Data_Identity.monadIdentity))(Data_List_NonEmpty.singleton($112));
  };
  var parseJSON = function (json) {
      return $foreign.parseJSONImpl(function ($113) {
          return fail(JSONError.create($113));
      }, Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity)), json);
  };
  var readArray = function (value) {
      if ($foreign.isArray(value)) {
          return Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))($foreign.unsafeFromForeign(value));
      };
      if (Data_Boolean.otherwise) {
          return fail(new TypeMismatch("array", $foreign.tagOf(value)));
      };
      throw new Error("Failed pattern match at Data.Foreign line 149, column 1 - line 151, column 58: " + [ value.constructor.name ]);
  };
  var unsafeReadTagged = function (tag) {
      return function (value) {
          if ($foreign.tagOf(value) === tag) {
              return Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))($foreign.unsafeFromForeign(value));
          };
          if (Data_Boolean.otherwise) {
              return fail(new TypeMismatch(tag, $foreign.tagOf(value)));
          };
          throw new Error("Failed pattern match at Data.Foreign line 108, column 1 - line 110, column 54: " + [ tag.constructor.name, value.constructor.name ]);
      };
  };                                            
  var readNumber = unsafeReadTagged("Number");
  var readInt = function (value) {
      var error = Data_Either.Left.create(Data_List_NonEmpty.singleton(new TypeMismatch("Int", $foreign.tagOf(value))));
      var fromNumber = function ($114) {
          return Data_Maybe.maybe(error)(Control_Applicative.pure(Data_Either.applicativeEither))(Data_Int.fromNumber($114));
      };
      return Control_Monad_Except.mapExcept(Data_Either.either(Data_Function["const"](error))(fromNumber))(readNumber(value));
  };
  var readString = unsafeReadTagged("String");
  exports["ForeignError"] = ForeignError;
  exports["TypeMismatch"] = TypeMismatch;
  exports["ErrorAtIndex"] = ErrorAtIndex;
  exports["ErrorAtProperty"] = ErrorAtProperty;
  exports["JSONError"] = JSONError;
  exports["fail"] = fail;
  exports["parseJSON"] = parseJSON;
  exports["readArray"] = readArray;
  exports["readInt"] = readInt;
  exports["readNumber"] = readNumber;
  exports["readString"] = readString;
  exports["unsafeReadTagged"] = unsafeReadTagged;
  exports["showForeignError"] = showForeignError;
  exports["isNull"] = $foreign.isNull;
  exports["isUndefined"] = $foreign.isUndefined;
  exports["toForeign"] = $foreign.toForeign;
  exports["typeOf"] = $foreign.typeOf;
})(PS["Data.Foreign"] = PS["Data.Foreign"] || {});
(function(exports) {
  /* global exports */
  "use strict";

  // jshint maxparams: 4
  exports.unsafeReadPropImpl = function (f, s, key, value) {
    return value == null ? f : s(value[key]);
  };

  // jshint maxparams: 2
  exports.unsafeHasOwnProperty = function (prop, value) {
    return Object.prototype.hasOwnProperty.call(value, prop);
  };

  exports.unsafeHasProperty = function (prop, value) {
    return prop in value;
  };
})(PS["Data.Foreign.Index"] = PS["Data.Foreign.Index"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.Foreign.Index"];
  var Prelude = PS["Prelude"];
  var Data_Foreign = PS["Data.Foreign"];
  var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
  var Data_Function = PS["Data.Function"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
  var Data_Identity = PS["Data.Identity"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_Eq = PS["Data.Eq"];        
  var Index = function (errorAt, hasOwnProperty, hasProperty, ix) {
      this.errorAt = errorAt;
      this.hasOwnProperty = hasOwnProperty;
      this.hasProperty = hasProperty;
      this.ix = ix;
  };
  var unsafeReadProp = function (k) {
      return function (value) {
          return $foreign.unsafeReadPropImpl(Data_Foreign.fail(new Data_Foreign.TypeMismatch("object", Data_Foreign.typeOf(value))), Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity)), k, value);
      };
  };
  var prop = unsafeReadProp;
  var ix = function (dict) {
      return dict.ix;
  };                         
  var hasPropertyImpl = function (v) {
      return function (value) {
          if (Data_Foreign.isNull(value)) {
              return false;
          };
          if (Data_Foreign.isUndefined(value)) {
              return false;
          };
          if (Data_Foreign.typeOf(value) === "object" || Data_Foreign.typeOf(value) === "function") {
              return $foreign.unsafeHasProperty(v, value);
          };
          return false;
      };
  };
  var hasProperty = function (dict) {
      return dict.hasProperty;
  };
  var hasOwnPropertyImpl = function (v) {
      return function (value) {
          if (Data_Foreign.isNull(value)) {
              return false;
          };
          if (Data_Foreign.isUndefined(value)) {
              return false;
          };
          if (Data_Foreign.typeOf(value) === "object" || Data_Foreign.typeOf(value) === "function") {
              return $foreign.unsafeHasOwnProperty(v, value);
          };
          return false;
      };
  };                                                                                                                         
  var indexString = new Index(Data_Foreign.ErrorAtProperty.create, hasOwnPropertyImpl, hasPropertyImpl, Data_Function.flip(prop));
  var hasOwnProperty = function (dict) {
      return dict.hasOwnProperty;
  };
  var errorAt = function (dict) {
      return dict.errorAt;
  };
  exports["Index"] = Index;
  exports["errorAt"] = errorAt;
  exports["hasOwnProperty"] = hasOwnProperty;
  exports["hasProperty"] = hasProperty;
  exports["ix"] = ix;
  exports["prop"] = prop;
  exports["indexString"] = indexString;
})(PS["Data.Foreign.Index"] = PS["Data.Foreign.Index"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Alt = PS["Control.Alt"];
  var Control_Monad_Except = PS["Control.Monad.Except"];
  var Data_Array = PS["Data.Array"];
  var Data_Bifunctor = PS["Data.Bifunctor"];
  var Data_Either = PS["Data.Either"];
  var Data_Foreign = PS["Data.Foreign"];
  var Data_Foreign_Index = PS["Data.Foreign.Index"];
  var Data_Foreign_Null = PS["Data.Foreign.Null"];
  var Data_Foreign_NullOrUndefined = PS["Data.Foreign.NullOrUndefined"];
  var Data_Foreign_Undefined = PS["Data.Foreign.Undefined"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Traversable = PS["Data.Traversable"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Functor = PS["Data.Functor"];
  var Data_Semiring = PS["Data.Semiring"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Category = PS["Control.Category"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
  var Data_List_Types = PS["Data.List.Types"];
  var Data_Identity = PS["Data.Identity"];        
  var IsForeign = function (read) {
      this.read = read;
  };
  var stringIsForeign = new IsForeign(Data_Foreign.readString);
  var read = function (dict) {
      return dict.read;
  };
  var readWith = function (dictIsForeign) {
      return function (f) {
          return function ($23) {
              return Control_Monad_Except.mapExcept(Data_Bifunctor.lmap(Data_Either.bifunctorEither)(f))(read(dictIsForeign)($23));
          };
      };
  };
  var readProp = function (dictIsForeign) {
      return function (dictIndex) {
          return function (prop) {
              return function (value) {
                  return Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Data_Foreign_Index.ix(dictIndex)(value)(prop))(readWith(dictIsForeign)(Data_Functor.map(Data_List_Types.functorNonEmptyList)(Data_Foreign_Index.errorAt(dictIndex)(prop))));
              };
          };
      };
  };
  var intIsForeign = new IsForeign(Data_Foreign.readInt);  
  var foreignIsForeign = new IsForeign(Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity)));
  var arrayIsForeign = function (dictIsForeign) {
      return new IsForeign(function (value) {
          var readElement = function (i) {
              return function (value1) {
                  return readWith(dictIsForeign)(Data_Functor.map(Data_List_Types.functorNonEmptyList)(Data_Foreign.ErrorAtIndex.create(i)))(value1);
              };
          };
          var readElements = function (arr) {
              return Data_Traversable.sequence(Data_Traversable.traversableArray)(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))(Data_Array.zipWith(readElement)(Data_Array.range(0)(Data_Array.length(arr)))(arr));
          };
          return Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Data_Foreign.readArray(value))(readElements);
      });
  };
  exports["IsForeign"] = IsForeign;
  exports["read"] = read;
  exports["readProp"] = readProp;
  exports["readWith"] = readWith;
  exports["foreignIsForeign"] = foreignIsForeign;
  exports["stringIsForeign"] = stringIsForeign;
  exports["intIsForeign"] = intIsForeign;
  exports["arrayIsForeign"] = arrayIsForeign;
})(PS["Data.Foreign.Class"] = PS["Data.Foreign.Class"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_List = PS["Data.List"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Monoid = PS["Data.Monoid"];
  var Data_Traversable = PS["Data.Traversable"];
  var Data_Tuple = PS["Data.Tuple"];
  var Data_Unfoldable = PS["Data.Unfoldable"];
  var Partial_Unsafe = PS["Partial.Unsafe"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Show = PS["Data.Show"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Category = PS["Control.Category"];
  var Data_List_Types = PS["Data.List.Types"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Ordering = PS["Data.Ordering"];
  var Data_Function = PS["Data.Function"];
  var Data_Semiring = PS["Data.Semiring"];        
  var Leaf = (function () {
      function Leaf() {

      };
      Leaf.value = new Leaf();
      return Leaf;
  })();
  var Two = (function () {
      function Two(value0, value1, value2, value3) {
          this.value0 = value0;
          this.value1 = value1;
          this.value2 = value2;
          this.value3 = value3;
      };
      Two.create = function (value0) {
          return function (value1) {
              return function (value2) {
                  return function (value3) {
                      return new Two(value0, value1, value2, value3);
                  };
              };
          };
      };
      return Two;
  })();
  var Three = (function () {
      function Three(value0, value1, value2, value3, value4, value5, value6) {
          this.value0 = value0;
          this.value1 = value1;
          this.value2 = value2;
          this.value3 = value3;
          this.value4 = value4;
          this.value5 = value5;
          this.value6 = value6;
      };
      Three.create = function (value0) {
          return function (value1) {
              return function (value2) {
                  return function (value3) {
                      return function (value4) {
                          return function (value5) {
                              return function (value6) {
                                  return new Three(value0, value1, value2, value3, value4, value5, value6);
                              };
                          };
                      };
                  };
              };
          };
      };
      return Three;
  })();
  var TwoLeft = (function () {
      function TwoLeft(value0, value1, value2) {
          this.value0 = value0;
          this.value1 = value1;
          this.value2 = value2;
      };
      TwoLeft.create = function (value0) {
          return function (value1) {
              return function (value2) {
                  return new TwoLeft(value0, value1, value2);
              };
          };
      };
      return TwoLeft;
  })();
  var TwoRight = (function () {
      function TwoRight(value0, value1, value2) {
          this.value0 = value0;
          this.value1 = value1;
          this.value2 = value2;
      };
      TwoRight.create = function (value0) {
          return function (value1) {
              return function (value2) {
                  return new TwoRight(value0, value1, value2);
              };
          };
      };
      return TwoRight;
  })();
  var ThreeLeft = (function () {
      function ThreeLeft(value0, value1, value2, value3, value4, value5) {
          this.value0 = value0;
          this.value1 = value1;
          this.value2 = value2;
          this.value3 = value3;
          this.value4 = value4;
          this.value5 = value5;
      };
      ThreeLeft.create = function (value0) {
          return function (value1) {
              return function (value2) {
                  return function (value3) {
                      return function (value4) {
                          return function (value5) {
                              return new ThreeLeft(value0, value1, value2, value3, value4, value5);
                          };
                      };
                  };
              };
          };
      };
      return ThreeLeft;
  })();
  var ThreeMiddle = (function () {
      function ThreeMiddle(value0, value1, value2, value3, value4, value5) {
          this.value0 = value0;
          this.value1 = value1;
          this.value2 = value2;
          this.value3 = value3;
          this.value4 = value4;
          this.value5 = value5;
      };
      ThreeMiddle.create = function (value0) {
          return function (value1) {
              return function (value2) {
                  return function (value3) {
                      return function (value4) {
                          return function (value5) {
                              return new ThreeMiddle(value0, value1, value2, value3, value4, value5);
                          };
                      };
                  };
              };
          };
      };
      return ThreeMiddle;
  })();
  var ThreeRight = (function () {
      function ThreeRight(value0, value1, value2, value3, value4, value5) {
          this.value0 = value0;
          this.value1 = value1;
          this.value2 = value2;
          this.value3 = value3;
          this.value4 = value4;
          this.value5 = value5;
      };
      ThreeRight.create = function (value0) {
          return function (value1) {
              return function (value2) {
                  return function (value3) {
                      return function (value4) {
                          return function (value5) {
                              return new ThreeRight(value0, value1, value2, value3, value4, value5);
                          };
                      };
                  };
              };
          };
      };
      return ThreeRight;
  })();
  var KickUp = (function () {
      function KickUp(value0, value1, value2, value3) {
          this.value0 = value0;
          this.value1 = value1;
          this.value2 = value2;
          this.value3 = value3;
      };
      KickUp.create = function (value0) {
          return function (value1) {
              return function (value2) {
                  return function (value3) {
                      return new KickUp(value0, value1, value2, value3);
                  };
              };
          };
      };
      return KickUp;
  })();
  var toList = function (v) {
      if (v instanceof Leaf) {
          return Data_List_Types.Nil.value;
      };
      if (v instanceof Two) {
          return Data_Semigroup.append(Data_List_Types.semigroupList)(toList(v.value0))(new Data_List_Types.Cons(new Data_Tuple.Tuple(v.value1, v.value2), toList(v.value3)));
      };
      if (v instanceof Three) {
          return Data_Semigroup.append(Data_List_Types.semigroupList)(toList(v.value0))(Data_Semigroup.append(Data_List_Types.semigroupList)(new Data_List_Types.Cons(new Data_Tuple.Tuple(v.value1, v.value2), toList(v.value3)))(new Data_List_Types.Cons(new Data_Tuple.Tuple(v.value4, v.value5), toList(v.value6))));
      };
      throw new Error("Failed pattern match at Data.Map line 370, column 1 - line 370, column 18: " + [ v.constructor.name ]);
  };
  var singleton = function (k) {
      return function (v) {
          return new Two(Leaf.value, k, v, Leaf.value);
      };
  };
  var showMap = function (dictShow) {
      return function (dictShow1) {
          return new Data_Show.Show(function (m) {
              return "(fromList " + (Data_Show.show(Data_List_Types.showList(Data_Tuple.showTuple(dictShow)(dictShow1)))(toList(m)) + ")");
          });
      };
  };
  var lookup = function (dictOrd) {
      return Partial_Unsafe.unsafePartial(function (dictPartial) {
          return function (k) {
              return function (tree) {
                  if (tree instanceof Leaf) {
                      return Data_Maybe.Nothing.value;
                  };
                  var comp = Data_Ord.compare(dictOrd);
                  var __unused = function (dictPartial1) {
                      return function ($dollar38) {
                          return $dollar38;
                      };
                  };
                  return __unused(dictPartial)((function () {
                      if (tree instanceof Two) {
                          var $163 = comp(k)(tree.value1);
                          if ($163 instanceof Data_Ordering.EQ) {
                              return new Data_Maybe.Just(tree.value2);
                          };
                          if ($163 instanceof Data_Ordering.LT) {
                              return lookup(dictOrd)(k)(tree.value0);
                          };
                          return lookup(dictOrd)(k)(tree.value3);
                      };
                      if (tree instanceof Three) {
                          var $168 = comp(k)(tree.value1);
                          if ($168 instanceof Data_Ordering.EQ) {
                              return new Data_Maybe.Just(tree.value2);
                          };
                          var $170 = comp(k)(tree.value4);
                          if ($170 instanceof Data_Ordering.EQ) {
                              return new Data_Maybe.Just(tree.value5);
                          };
                          if ($168 instanceof Data_Ordering.LT) {
                              return lookup(dictOrd)(k)(tree.value0);
                          };
                          if ($170 instanceof Data_Ordering.GT) {
                              return lookup(dictOrd)(k)(tree.value6);
                          };
                          return lookup(dictOrd)(k)(tree.value3);
                      };
                      throw new Error("Failed pattern match at Data.Map line 133, column 10 - line 147, column 39: " + [ tree.constructor.name ]);
                  })());
              };
          };
      });
  };
  var keys = function (v) {
      if (v instanceof Leaf) {
          return Data_List_Types.Nil.value;
      };
      if (v instanceof Two) {
          return Data_Semigroup.append(Data_List_Types.semigroupList)(keys(v.value0))(Data_Semigroup.append(Data_List_Types.semigroupList)(Control_Applicative.pure(Data_List_Types.applicativeList)(v.value1))(keys(v.value3)));
      };
      if (v instanceof Three) {
          return Data_Semigroup.append(Data_List_Types.semigroupList)(keys(v.value0))(Data_Semigroup.append(Data_List_Types.semigroupList)(Control_Applicative.pure(Data_List_Types.applicativeList)(v.value1))(Data_Semigroup.append(Data_List_Types.semigroupList)(keys(v.value3))(Data_Semigroup.append(Data_List_Types.semigroupList)(Control_Applicative.pure(Data_List_Types.applicativeList)(v.value4))(keys(v.value6)))));
      };
      throw new Error("Failed pattern match at Data.Map line 385, column 1 - line 385, column 16: " + [ v.constructor.name ]);
  };
  var functorMap = new Data_Functor.Functor(function (v) {
      return function (v1) {
          if (v1 instanceof Leaf) {
              return Leaf.value;
          };
          if (v1 instanceof Two) {
              return new Two(Data_Functor.map(functorMap)(v)(v1.value0), v1.value1, v(v1.value2), Data_Functor.map(functorMap)(v)(v1.value3));
          };
          if (v1 instanceof Three) {
              return new Three(Data_Functor.map(functorMap)(v)(v1.value0), v1.value1, v(v1.value2), Data_Functor.map(functorMap)(v)(v1.value3), v1.value4, v(v1.value5), Data_Functor.map(functorMap)(v)(v1.value6));
          };
          throw new Error("Failed pattern match at Data.Map line 71, column 3 - line 71, column 20: " + [ v.constructor.name, v1.constructor.name ]);
      };
  });
  var fromZipper = function (__copy_dictOrd) {
      return function (__copy_v) {
          return function (__copy_tree) {
              var dictOrd = __copy_dictOrd;
              var v = __copy_v;
              var tree = __copy_tree;
              tco: while (true) {
                  if (v instanceof Data_List_Types.Nil) {
                      return tree;
                  };
                  if (v instanceof Data_List_Types.Cons) {
                      if (v.value0 instanceof TwoLeft) {
                          var __tco_dictOrd = dictOrd;
                          var __tco_v = v.value1;
                          var __tco_tree = new Two(tree, v.value0.value0, v.value0.value1, v.value0.value2);
                          dictOrd = __tco_dictOrd;
                          v = __tco_v;
                          tree = __tco_tree;
                          continue tco;
                      };
                      if (v.value0 instanceof TwoRight) {
                          var __tco_dictOrd = dictOrd;
                          var __tco_v = v.value1;
                          var __tco_tree = new Two(v.value0.value0, v.value0.value1, v.value0.value2, tree);
                          dictOrd = __tco_dictOrd;
                          v = __tco_v;
                          tree = __tco_tree;
                          continue tco;
                      };
                      if (v.value0 instanceof ThreeLeft) {
                          var __tco_dictOrd = dictOrd;
                          var __tco_v = v.value1;
                          var __tco_tree = new Three(tree, v.value0.value0, v.value0.value1, v.value0.value2, v.value0.value3, v.value0.value4, v.value0.value5);
                          dictOrd = __tco_dictOrd;
                          v = __tco_v;
                          tree = __tco_tree;
                          continue tco;
                      };
                      if (v.value0 instanceof ThreeMiddle) {
                          var __tco_dictOrd = dictOrd;
                          var __tco_v = v.value1;
                          var __tco_tree = new Three(v.value0.value0, v.value0.value1, v.value0.value2, tree, v.value0.value3, v.value0.value4, v.value0.value5);
                          dictOrd = __tco_dictOrd;
                          v = __tco_v;
                          tree = __tco_tree;
                          continue tco;
                      };
                      if (v.value0 instanceof ThreeRight) {
                          var __tco_dictOrd = dictOrd;
                          var __tco_v = v.value1;
                          var __tco_tree = new Three(v.value0.value0, v.value0.value1, v.value0.value2, v.value0.value3, v.value0.value4, v.value0.value5, tree);
                          dictOrd = __tco_dictOrd;
                          v = __tco_v;
                          tree = __tco_tree;
                          continue tco;
                      };
                      throw new Error("Failed pattern match at Data.Map line 224, column 3 - line 229, column 88: " + [ v.value0.constructor.name ]);
                  };
                  throw new Error("Failed pattern match at Data.Map line 222, column 1 - line 222, column 27: " + [ v.constructor.name, tree.constructor.name ]);
              };
          };
      };
  };
  var insert = function (dictOrd) {
      var up = function (__copy_v) {
          return function (__copy_v1) {
              var v = __copy_v;
              var v1 = __copy_v1;
              tco: while (true) {
                  if (v instanceof Data_List_Types.Nil) {
                      return new Two(v1.value0, v1.value1, v1.value2, v1.value3);
                  };
                  if (v instanceof Data_List_Types.Cons) {
                      if (v.value0 instanceof TwoLeft) {
                          return fromZipper(dictOrd)(v.value1)(new Three(v1.value0, v1.value1, v1.value2, v1.value3, v.value0.value0, v.value0.value1, v.value0.value2));
                      };
                      if (v.value0 instanceof TwoRight) {
                          return fromZipper(dictOrd)(v.value1)(new Three(v.value0.value0, v.value0.value1, v.value0.value2, v1.value0, v1.value1, v1.value2, v1.value3));
                      };
                      if (v.value0 instanceof ThreeLeft) {
                          var __tco_v = v.value1;
                          var __tco_v1 = new KickUp(new Two(v1.value0, v1.value1, v1.value2, v1.value3), v.value0.value0, v.value0.value1, new Two(v.value0.value2, v.value0.value3, v.value0.value4, v.value0.value5));
                          v = __tco_v;
                          v1 = __tco_v1;
                          continue tco;
                      };
                      if (v.value0 instanceof ThreeMiddle) {
                          var __tco_v = v.value1;
                          var __tco_v1 = new KickUp(new Two(v.value0.value0, v.value0.value1, v.value0.value2, v1.value0), v1.value1, v1.value2, new Two(v1.value3, v.value0.value3, v.value0.value4, v.value0.value5));
                          v = __tco_v;
                          v1 = __tco_v1;
                          continue tco;
                      };
                      if (v.value0 instanceof ThreeRight) {
                          var __tco_v = v.value1;
                          var __tco_v1 = new KickUp(new Two(v.value0.value0, v.value0.value1, v.value0.value2, v.value0.value3), v.value0.value4, v.value0.value5, new Two(v1.value0, v1.value1, v1.value2, v1.value3));
                          v = __tco_v;
                          v1 = __tco_v1;
                          continue tco;
                      };
                      throw new Error("Failed pattern match at Data.Map line 260, column 5 - line 265, column 104: " + [ v.value0.constructor.name, v1.constructor.name ]);
                  };
                  throw new Error("Failed pattern match at Data.Map line 258, column 3 - line 258, column 54: " + [ v.constructor.name, v1.constructor.name ]);
              };
          };
      };
      var comp = Data_Ord.compare(dictOrd);
      var down = function (__copy_ctx) {
          return function (__copy_k) {
              return function (__copy_v) {
                  return function (__copy_v1) {
                      var ctx = __copy_ctx;
                      var k = __copy_k;
                      var v = __copy_v;
                      var v1 = __copy_v1;
                      tco: while (true) {
                          if (v1 instanceof Leaf) {
                              return up(ctx)(new KickUp(Leaf.value, k, v, Leaf.value));
                          };
                          if (v1 instanceof Two) {
                              var $291 = comp(k)(v1.value1);
                              if ($291 instanceof Data_Ordering.EQ) {
                                  return fromZipper(dictOrd)(ctx)(new Two(v1.value0, k, v, v1.value3));
                              };
                              if ($291 instanceof Data_Ordering.LT) {
                                  var __tco_ctx = new Data_List_Types.Cons(new TwoLeft(v1.value1, v1.value2, v1.value3), ctx);
                                  var __tco_k = k;
                                  var __tco_v = v;
                                  var __tco_v1 = v1.value0;
                                  ctx = __tco_ctx;
                                  k = __tco_k;
                                  v = __tco_v;
                                  v1 = __tco_v1;
                                  continue tco;
                              };
                              var __tco_ctx = new Data_List_Types.Cons(new TwoRight(v1.value0, v1.value1, v1.value2), ctx);
                              var __tco_k = k;
                              var __tco_v = v;
                              var __tco_v1 = v1.value3;
                              ctx = __tco_ctx;
                              k = __tco_k;
                              v = __tco_v;
                              v1 = __tco_v1;
                              continue tco;
                          };
                          if (v1 instanceof Three) {
                              var $296 = comp(k)(v1.value1);
                              if ($296 instanceof Data_Ordering.EQ) {
                                  return fromZipper(dictOrd)(ctx)(new Three(v1.value0, k, v, v1.value3, v1.value4, v1.value5, v1.value6));
                              };
                              var $298 = comp(k)(v1.value4);
                              if ($298 instanceof Data_Ordering.EQ) {
                                  return fromZipper(dictOrd)(ctx)(new Three(v1.value0, v1.value1, v1.value2, v1.value3, k, v, v1.value6));
                              };
                              if ($296 instanceof Data_Ordering.LT) {
                                  var __tco_ctx = new Data_List_Types.Cons(new ThreeLeft(v1.value1, v1.value2, v1.value3, v1.value4, v1.value5, v1.value6), ctx);
                                  var __tco_k = k;
                                  var __tco_v = v;
                                  var __tco_v1 = v1.value0;
                                  ctx = __tco_ctx;
                                  k = __tco_k;
                                  v = __tco_v;
                                  v1 = __tco_v1;
                                  continue tco;
                              };
                              if ($296 instanceof Data_Ordering.GT && $298 instanceof Data_Ordering.LT) {
                                  var __tco_ctx = new Data_List_Types.Cons(new ThreeMiddle(v1.value0, v1.value1, v1.value2, v1.value4, v1.value5, v1.value6), ctx);
                                  var __tco_k = k;
                                  var __tco_v = v;
                                  var __tco_v1 = v1.value3;
                                  ctx = __tco_ctx;
                                  k = __tco_k;
                                  v = __tco_v;
                                  v1 = __tco_v1;
                                  continue tco;
                              };
                              var __tco_ctx = new Data_List_Types.Cons(new ThreeRight(v1.value0, v1.value1, v1.value2, v1.value3, v1.value4, v1.value5), ctx);
                              var __tco_k = k;
                              var __tco_v = v;
                              var __tco_v1 = v1.value6;
                              ctx = __tco_ctx;
                              k = __tco_k;
                              v = __tco_v;
                              v1 = __tco_v1;
                              continue tco;
                          };
                          throw new Error("Failed pattern match at Data.Map line 241, column 3 - line 241, column 52: " + [ ctx.constructor.name, k.constructor.name, v.constructor.name, v1.constructor.name ]);
                      };
                  };
              };
          };
      };
      return down(Data_List_Types.Nil.value);
  };
  var pop = function (dictOrd) {
      var up = Partial_Unsafe.unsafePartial(function (dictPartial) {
          return function (ctxs) {
              return function (tree) {
                  if (ctxs instanceof Data_List_Types.Nil) {
                      return tree;
                  };
                  if (ctxs instanceof Data_List_Types.Cons) {
                      var __unused = function (dictPartial1) {
                          return function ($dollar48) {
                              return $dollar48;
                          };
                      };
                      return __unused(dictPartial)((function () {
                          if (ctxs.value0 instanceof TwoLeft && (ctxs.value0.value2 instanceof Leaf && tree instanceof Leaf)) {
                              return fromZipper(dictOrd)(ctxs.value1)(new Two(Leaf.value, ctxs.value0.value0, ctxs.value0.value1, Leaf.value));
                          };
                          if (ctxs.value0 instanceof TwoRight && (ctxs.value0.value0 instanceof Leaf && tree instanceof Leaf)) {
                              return fromZipper(dictOrd)(ctxs.value1)(new Two(Leaf.value, ctxs.value0.value1, ctxs.value0.value2, Leaf.value));
                          };
                          if (ctxs.value0 instanceof TwoLeft && ctxs.value0.value2 instanceof Two) {
                              return up(ctxs.value1)(new Three(tree, ctxs.value0.value0, ctxs.value0.value1, ctxs.value0.value2.value0, ctxs.value0.value2.value1, ctxs.value0.value2.value2, ctxs.value0.value2.value3));
                          };
                          if (ctxs.value0 instanceof TwoRight && ctxs.value0.value0 instanceof Two) {
                              return up(ctxs.value1)(new Three(ctxs.value0.value0.value0, ctxs.value0.value0.value1, ctxs.value0.value0.value2, ctxs.value0.value0.value3, ctxs.value0.value1, ctxs.value0.value2, tree));
                          };
                          if (ctxs.value0 instanceof TwoLeft && ctxs.value0.value2 instanceof Three) {
                              return fromZipper(dictOrd)(ctxs.value1)(new Two(new Two(tree, ctxs.value0.value0, ctxs.value0.value1, ctxs.value0.value2.value0), ctxs.value0.value2.value1, ctxs.value0.value2.value2, new Two(ctxs.value0.value2.value3, ctxs.value0.value2.value4, ctxs.value0.value2.value5, ctxs.value0.value2.value6)));
                          };
                          if (ctxs.value0 instanceof TwoRight && ctxs.value0.value0 instanceof Three) {
                              return fromZipper(dictOrd)(ctxs.value1)(new Two(new Two(ctxs.value0.value0.value0, ctxs.value0.value0.value1, ctxs.value0.value0.value2, ctxs.value0.value0.value3), ctxs.value0.value0.value4, ctxs.value0.value0.value5, new Two(ctxs.value0.value0.value6, ctxs.value0.value1, ctxs.value0.value2, tree)));
                          };
                          if (ctxs.value0 instanceof ThreeLeft && (ctxs.value0.value2 instanceof Leaf && (ctxs.value0.value5 instanceof Leaf && tree instanceof Leaf))) {
                              return fromZipper(dictOrd)(ctxs.value1)(new Three(Leaf.value, ctxs.value0.value0, ctxs.value0.value1, Leaf.value, ctxs.value0.value3, ctxs.value0.value4, Leaf.value));
                          };
                          if (ctxs.value0 instanceof ThreeMiddle && (ctxs.value0.value0 instanceof Leaf && (ctxs.value0.value5 instanceof Leaf && tree instanceof Leaf))) {
                              return fromZipper(dictOrd)(ctxs.value1)(new Three(Leaf.value, ctxs.value0.value1, ctxs.value0.value2, Leaf.value, ctxs.value0.value3, ctxs.value0.value4, Leaf.value));
                          };
                          if (ctxs.value0 instanceof ThreeRight && (ctxs.value0.value0 instanceof Leaf && (ctxs.value0.value3 instanceof Leaf && tree instanceof Leaf))) {
                              return fromZipper(dictOrd)(ctxs.value1)(new Three(Leaf.value, ctxs.value0.value1, ctxs.value0.value2, Leaf.value, ctxs.value0.value4, ctxs.value0.value5, Leaf.value));
                          };
                          if (ctxs.value0 instanceof ThreeLeft && ctxs.value0.value2 instanceof Two) {
                              return fromZipper(dictOrd)(ctxs.value1)(new Two(new Three(tree, ctxs.value0.value0, ctxs.value0.value1, ctxs.value0.value2.value0, ctxs.value0.value2.value1, ctxs.value0.value2.value2, ctxs.value0.value2.value3), ctxs.value0.value3, ctxs.value0.value4, ctxs.value0.value5));
                          };
                          if (ctxs.value0 instanceof ThreeMiddle && ctxs.value0.value0 instanceof Two) {
                              return fromZipper(dictOrd)(ctxs.value1)(new Two(new Three(ctxs.value0.value0.value0, ctxs.value0.value0.value1, ctxs.value0.value0.value2, ctxs.value0.value0.value3, ctxs.value0.value1, ctxs.value0.value2, tree), ctxs.value0.value3, ctxs.value0.value4, ctxs.value0.value5));
                          };
                          if (ctxs.value0 instanceof ThreeMiddle && ctxs.value0.value5 instanceof Two) {
                              return fromZipper(dictOrd)(ctxs.value1)(new Two(ctxs.value0.value0, ctxs.value0.value1, ctxs.value0.value2, new Three(tree, ctxs.value0.value3, ctxs.value0.value4, ctxs.value0.value5.value0, ctxs.value0.value5.value1, ctxs.value0.value5.value2, ctxs.value0.value5.value3)));
                          };
                          if (ctxs.value0 instanceof ThreeRight && ctxs.value0.value3 instanceof Two) {
                              return fromZipper(dictOrd)(ctxs.value1)(new Two(ctxs.value0.value0, ctxs.value0.value1, ctxs.value0.value2, new Three(ctxs.value0.value3.value0, ctxs.value0.value3.value1, ctxs.value0.value3.value2, ctxs.value0.value3.value3, ctxs.value0.value4, ctxs.value0.value5, tree)));
                          };
                          if (ctxs.value0 instanceof ThreeLeft && ctxs.value0.value2 instanceof Three) {
                              return fromZipper(dictOrd)(ctxs.value1)(new Three(new Two(tree, ctxs.value0.value0, ctxs.value0.value1, ctxs.value0.value2.value0), ctxs.value0.value2.value1, ctxs.value0.value2.value2, new Two(ctxs.value0.value2.value3, ctxs.value0.value2.value4, ctxs.value0.value2.value5, ctxs.value0.value2.value6), ctxs.value0.value3, ctxs.value0.value4, ctxs.value0.value5));
                          };
                          if (ctxs.value0 instanceof ThreeMiddle && ctxs.value0.value0 instanceof Three) {
                              return fromZipper(dictOrd)(ctxs.value1)(new Three(new Two(ctxs.value0.value0.value0, ctxs.value0.value0.value1, ctxs.value0.value0.value2, ctxs.value0.value0.value3), ctxs.value0.value0.value4, ctxs.value0.value0.value5, new Two(ctxs.value0.value0.value6, ctxs.value0.value1, ctxs.value0.value2, tree), ctxs.value0.value3, ctxs.value0.value4, ctxs.value0.value5));
                          };
                          if (ctxs.value0 instanceof ThreeMiddle && ctxs.value0.value5 instanceof Three) {
                              return fromZipper(dictOrd)(ctxs.value1)(new Three(ctxs.value0.value0, ctxs.value0.value1, ctxs.value0.value2, new Two(tree, ctxs.value0.value3, ctxs.value0.value4, ctxs.value0.value5.value0), ctxs.value0.value5.value1, ctxs.value0.value5.value2, new Two(ctxs.value0.value5.value3, ctxs.value0.value5.value4, ctxs.value0.value5.value5, ctxs.value0.value5.value6)));
                          };
                          if (ctxs.value0 instanceof ThreeRight && ctxs.value0.value3 instanceof Three) {
                              return fromZipper(dictOrd)(ctxs.value1)(new Three(ctxs.value0.value0, ctxs.value0.value1, ctxs.value0.value2, new Two(ctxs.value0.value3.value0, ctxs.value0.value3.value1, ctxs.value0.value3.value2, ctxs.value0.value3.value3), ctxs.value0.value3.value4, ctxs.value0.value3.value5, new Two(ctxs.value0.value3.value6, ctxs.value0.value4, ctxs.value0.value5, tree)));
                          };
                          throw new Error("Failed pattern match at Data.Map line 310, column 9 - line 327, column 136: " + [ ctxs.value0.constructor.name, tree.constructor.name ]);
                      })());
                  };
                  throw new Error("Failed pattern match at Data.Map line 307, column 5 - line 327, column 136: " + [ ctxs.constructor.name ]);
              };
          };
      });
      var removeMaxNode = Partial_Unsafe.unsafePartial(function (dictPartial) {
          return function (ctx) {
              return function (m) {
                  var __unused = function (dictPartial1) {
                      return function ($dollar50) {
                          return $dollar50;
                      };
                  };
                  return __unused(dictPartial)((function () {
                      if (m instanceof Two && (m.value0 instanceof Leaf && m.value3 instanceof Leaf)) {
                          return up(ctx)(Leaf.value);
                      };
                      if (m instanceof Two) {
                          return removeMaxNode(new Data_List_Types.Cons(new TwoRight(m.value0, m.value1, m.value2), ctx))(m.value3);
                      };
                      if (m instanceof Three && (m.value0 instanceof Leaf && (m.value3 instanceof Leaf && m.value6 instanceof Leaf))) {
                          return up(new Data_List_Types.Cons(new TwoRight(Leaf.value, m.value1, m.value2), ctx))(Leaf.value);
                      };
                      if (m instanceof Three) {
                          return removeMaxNode(new Data_List_Types.Cons(new ThreeRight(m.value0, m.value1, m.value2, m.value3, m.value4, m.value5), ctx))(m.value6);
                      };
                      throw new Error("Failed pattern match at Data.Map line 339, column 5 - line 343, column 107: " + [ m.constructor.name ]);
                  })());
              };
          };
      });
      var maxNode = Partial_Unsafe.unsafePartial(function (dictPartial) {
          return function (m) {
              var __unused = function (dictPartial1) {
                  return function ($dollar52) {
                      return $dollar52;
                  };
              };
              return __unused(dictPartial)((function () {
                  if (m instanceof Two && m.value3 instanceof Leaf) {
                      return {
                          key: m.value1, 
                          value: m.value2
                      };
                  };
                  if (m instanceof Two) {
                      return maxNode(m.value3);
                  };
                  if (m instanceof Three && m.value6 instanceof Leaf) {
                      return {
                          key: m.value4, 
                          value: m.value5
                      };
                  };
                  if (m instanceof Three) {
                      return maxNode(m.value6);
                  };
                  throw new Error("Failed pattern match at Data.Map line 330, column 33 - line 334, column 45: " + [ m.constructor.name ]);
              })());
          };
      });
      var comp = Data_Ord.compare(dictOrd);
      var down = Partial_Unsafe.unsafePartial(function (dictPartial) {
          return function (ctx) {
              return function (k) {
                  return function (m) {
                      if (m instanceof Leaf) {
                          return Data_Maybe.Nothing.value;
                      };
                      if (m instanceof Two) {
                          var $509 = comp(k)(m.value1);
                          if (m.value3 instanceof Leaf && $509 instanceof Data_Ordering.EQ) {
                              return new Data_Maybe.Just(new Data_Tuple.Tuple(m.value2, up(ctx)(Leaf.value)));
                          };
                          if ($509 instanceof Data_Ordering.EQ) {
                              var max = maxNode(m.value0);
                              return new Data_Maybe.Just(new Data_Tuple.Tuple(m.value2, removeMaxNode(new Data_List_Types.Cons(new TwoLeft(max.key, max.value, m.value3), ctx))(m.value0)));
                          };
                          if ($509 instanceof Data_Ordering.LT) {
                              return down(new Data_List_Types.Cons(new TwoLeft(m.value1, m.value2, m.value3), ctx))(k)(m.value0);
                          };
                          return down(new Data_List_Types.Cons(new TwoRight(m.value0, m.value1, m.value2), ctx))(k)(m.value3);
                      };
                      if (m instanceof Three) {
                          var leaves = (function () {
                              if (m.value0 instanceof Leaf && (m.value3 instanceof Leaf && m.value6 instanceof Leaf)) {
                                  return true;
                              };
                              return false;
                          })();
                          var $518 = comp(k)(m.value1);
                          var $519 = comp(k)(m.value4);
                          if (leaves && $518 instanceof Data_Ordering.EQ) {
                              return new Data_Maybe.Just(new Data_Tuple.Tuple(m.value2, fromZipper(dictOrd)(ctx)(new Two(Leaf.value, m.value4, m.value5, Leaf.value))));
                          };
                          if (leaves && $519 instanceof Data_Ordering.EQ) {
                              return new Data_Maybe.Just(new Data_Tuple.Tuple(m.value5, fromZipper(dictOrd)(ctx)(new Two(Leaf.value, m.value1, m.value2, Leaf.value))));
                          };
                          if ($518 instanceof Data_Ordering.EQ) {
                              var max = maxNode(m.value0);
                              return new Data_Maybe.Just(new Data_Tuple.Tuple(m.value2, removeMaxNode(new Data_List_Types.Cons(new ThreeLeft(max.key, max.value, m.value3, m.value4, m.value5, m.value6), ctx))(m.value0)));
                          };
                          if ($519 instanceof Data_Ordering.EQ) {
                              var max = maxNode(m.value3);
                              return new Data_Maybe.Just(new Data_Tuple.Tuple(m.value5, removeMaxNode(new Data_List_Types.Cons(new ThreeMiddle(m.value0, m.value1, m.value2, max.key, max.value, m.value6), ctx))(m.value3)));
                          };
                          if ($518 instanceof Data_Ordering.LT) {
                              return down(new Data_List_Types.Cons(new ThreeLeft(m.value1, m.value2, m.value3, m.value4, m.value5, m.value6), ctx))(k)(m.value0);
                          };
                          if ($518 instanceof Data_Ordering.GT && $519 instanceof Data_Ordering.LT) {
                              return down(new Data_List_Types.Cons(new ThreeMiddle(m.value0, m.value1, m.value2, m.value4, m.value5, m.value6), ctx))(k)(m.value3);
                          };
                          return down(new Data_List_Types.Cons(new ThreeRight(m.value0, m.value1, m.value2, m.value3, m.value4, m.value5), ctx))(k)(m.value6);
                      };
                      throw new Error("Failed pattern match at Data.Map line 280, column 36 - line 303, column 82: " + [ m.constructor.name ]);
                  };
              };
          };
      });
      return down(Data_List_Types.Nil.value);
  };
  var empty = Leaf.value;
  var $$delete = function (dictOrd) {
      return function (k) {
          return function (m) {
              return Data_Maybe.maybe(m)(Data_Tuple.snd)(pop(dictOrd)(k)(m));
          };
      };
  };
  var alter = function (dictOrd) {
      return function (f) {
          return function (k) {
              return function (m) {
                  var $596 = f(lookup(dictOrd)(k)(m));
                  if ($596 instanceof Data_Maybe.Nothing) {
                      return $$delete(dictOrd)(k)(m);
                  };
                  if ($596 instanceof Data_Maybe.Just) {
                      return insert(dictOrd)(k)($596.value0)(m);
                  };
                  throw new Error("Failed pattern match at Data.Map line 348, column 15 - line 350, column 25: " + [ $596.constructor.name ]);
              };
          };
      };
  };
  var unionWith = function (dictOrd) {
      return function (f) {
          return function (m1) {
              return function (m2) {
                  var go = function (m) {
                      return function (v) {
                          return alter(dictOrd)(function ($621) {
                              return Data_Maybe.Just.create(Data_Maybe.maybe(v.value1)(f(v.value1))($621));
                          })(v.value0)(m);
                      };
                  };
                  return Data_Foldable.foldl(Data_List_Types.foldableList)(go)(m2)(toList(m1));
              };
          };
      };
  };
  var union = function (dictOrd) {
      return unionWith(dictOrd)(Data_Function["const"]);
  };
  var unions = function (dictOrd) {
      return function (dictFoldable) {
          return Data_Foldable.foldl(dictFoldable)(union(dictOrd))(empty);
      };
  };
  exports["alter"] = alter;
  exports["delete"] = $$delete;
  exports["empty"] = empty;
  exports["insert"] = insert;
  exports["keys"] = keys;
  exports["lookup"] = lookup;
  exports["pop"] = pop;
  exports["singleton"] = singleton;
  exports["toList"] = toList;
  exports["union"] = union;
  exports["unionWith"] = unionWith;
  exports["unions"] = unions;
  exports["showMap"] = showMap;
  exports["functorMap"] = functorMap;
})(PS["Data.Map"] = PS["Data.Map"] || {});
(function(exports) {
    "use strict";

  exports["null"] = null;

  exports.nullable = function (a, r, f) {
    return a == null ? r : f(a);
  };

  exports.notNull = function (x) {
    return x;
  };
})(PS["Data.Nullable"] = PS["Data.Nullable"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.Nullable"];
  var Prelude = PS["Prelude"];
  var Data_Function = PS["Data.Function"];
  var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Show = PS["Data.Show"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Ord = PS["Data.Ord"];        
  var toNullable = Data_Maybe.maybe($foreign["null"])($foreign.notNull);
  var toMaybe = function (n) {
      return $foreign.nullable(n, Data_Maybe.Nothing.value, Data_Maybe.Just.create);
  };
  exports["toMaybe"] = toMaybe;
  exports["toNullable"] = toNullable;
})(PS["Data.Nullable"] = PS["Data.Nullable"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Functor_Contravariant = PS["Data.Functor.Contravariant"];
  var Data_Newtype = PS["Data.Newtype"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Control_Category = PS["Control.Category"];        
  var Op = function (x) {
      return x;
  }; 
  var newtypeOp = new Data_Newtype.Newtype(function (n) {
      return n;
  }, Op);
  exports["Op"] = Op;
  exports["newtypeOp"] = newtypeOp;
})(PS["Data.Op"] = PS["Data.Op"] || {});
(function(exports) {
  /* global exports */
  "use strict";

  exports._copyEff = function (m) {
    return function () {
      var r = {};
      for (var k in m) {
        if (m.hasOwnProperty(k)) {
          r[k] = m[k];
        }
      }
      return r;
    };
  };

  exports.empty = {};

  exports.runST = function (f) {
    return f;
  };

  // jshint maxparams: 4
  exports._lookup = function (no, yes, k, m) {
    return k in m ? yes(m[k]) : no;
  };

  function _collect(f) {
    return function (m) {
      var r = [];
      for (var k in m) {
        if (m.hasOwnProperty(k)) {
          r.push(f(k)(m[k]));
        }
      }
      return r;
    };
  }

  exports._collect = _collect;

  exports.keys = Object.keys || _collect(function (k) {
    return function () { return k; };
  });
})(PS["Data.StrMap"] = PS["Data.StrMap"] || {});
(function(exports) {
  /* global exports */
  "use strict";

  // module Data.StrMap.ST

  exports["new"] = function () {
    return {};
  };

  exports.poke = function (m) {
    return function (k) {
      return function (v) {
        return function () {
          m[k] = v;
          return m;
        };
      };
    };
  };

  exports["delete"] = function (m) {
    return function (k) {
      return function () {
        delete m[k];
        return m;
      };
    };
  };
})(PS["Data.StrMap.ST"] = PS["Data.StrMap.ST"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.StrMap.ST"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Control_Monad_ST = PS["Control.Monad.ST"];
  var Data_Maybe = PS["Data.Maybe"];
  exports["delete"] = $foreign["delete"];
  exports["new"] = $foreign["new"];
  exports["poke"] = $foreign.poke;
})(PS["Data.StrMap.ST"] = PS["Data.StrMap.ST"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Data.StrMap"];
  var Prelude = PS["Prelude"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Control_Monad_ST = PS["Control.Monad.ST"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
  var Data_List = PS["Data.List"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Monoid = PS["Data.Monoid"];
  var Data_StrMap_ST = PS["Data.StrMap.ST"];
  var Data_Traversable = PS["Data.Traversable"];
  var Data_Tuple = PS["Data.Tuple"];
  var Data_Unfoldable = PS["Data.Unfoldable"];
  var Data_Functor = PS["Data.Functor"];
  var Data_Function = PS["Data.Function"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Category = PS["Control.Category"];
  var Data_Eq = PS["Data.Eq"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_Show = PS["Data.Show"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_List_Types = PS["Data.List.Types"];
  var Control_Bind = PS["Control.Bind"];
  var thawST = $foreign._copyEff;
  var pureST = function (f) {
      return Control_Monad_Eff.runPure($foreign.runST(f));
  };
  var mutate = function (f) {
      return function (m) {
          return pureST(function __do() {
              var v = thawST(m)();
              f(v)();
              return v;
          });
      };
  };
  var lookup = Data_Function_Uncurried.runFn4($foreign._lookup)(Data_Maybe.Nothing.value)(Data_Maybe.Just.create);
  var insert = function (k) {
      return function (v) {
          return mutate(function (s) {
              return Data_StrMap_ST.poke(s)(k)(v);
          });
      };
  };
  var fromFoldable = function (dictFoldable) {
      return function (l) {
          return pureST(function __do() {
              var v = Data_StrMap_ST["new"]();
              Data_Foldable.for_(Control_Monad_Eff.applicativeEff)(dictFoldable)(l)(function (v1) {
                  return Data_StrMap_ST.poke(v)(v1.value0)(v1.value1);
              })();
              return v;
          });
      };
  };
  var $$delete = function (k) {
      return mutate(function (s) {
          return Data_StrMap_ST["delete"](s)(k);
      });
  };
  var alter = function (f) {
      return function (k) {
          return function (m) {
              var $37 = f(lookup(k)(m));
              if ($37 instanceof Data_Maybe.Nothing) {
                  return $$delete(k)(m);
              };
              if ($37 instanceof Data_Maybe.Just) {
                  return insert(k)($37.value0)(m);
              };
              throw new Error("Failed pattern match at Data.StrMap line 186, column 15 - line 188, column 25: " + [ $37.constructor.name ]);
          };
      };
  };
  exports["alter"] = alter;
  exports["fromFoldable"] = fromFoldable;
  exports["insert"] = insert;
  exports["lookup"] = lookup;
  exports["pureST"] = pureST;
  exports["thawST"] = thawST;
  exports["empty"] = $foreign.empty;
  exports["keys"] = $foreign.keys;
})(PS["Data.StrMap"] = PS["Data.StrMap"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Foreign = PS["Data.Foreign"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Monoid = PS["Data.Monoid"];
  var Data_Newtype = PS["Data.Newtype"];
  var Data_Op = PS["Data.Op"];
  var Data_StrMap = PS["Data.StrMap"];
  var Data_Tuple = PS["Data.Tuple"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Foldable = PS["Data.Foldable"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Function = PS["Data.Function"];
  var semigroupOptions = new Data_Semigroup.Semigroup(function (v) {
      return function (v1) {
          return Data_Semigroup.append(Data_Semigroup.semigroupArray)(v)(v1);
      };
  });
  var options = function (v) {
      return Data_Foreign.toForeign(Data_StrMap.fromFoldable(Data_Foldable.foldableArray)(v));
  };          
  var monoidOptions = new Data_Monoid.Monoid(function () {
      return semigroupOptions;
  }, [  ]);
  var defaultToOptions = function (k) {
      return function (v) {
          return [ new Data_Tuple.Tuple(k, Data_Foreign.toForeign(v)) ];
      };
  };
  var opt = function ($12) {
      return Data_Op.Op(defaultToOptions($12));
  };
  var assoc = Data_Newtype.unwrap(Data_Op.newtypeOp);
  exports["assoc"] = assoc;
  exports["defaultToOptions"] = defaultToOptions;
  exports["opt"] = opt;
  exports["options"] = options;
  exports["semigroupOptions"] = semigroupOptions;
  exports["monoidOptions"] = monoidOptions;
})(PS["Data.Options"] = PS["Data.Options"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Show = PS["Data.Show"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Ordering = PS["Data.Ordering"];        
  var SIGABRT = (function () {
      function SIGABRT() {

      };
      SIGABRT.value = new SIGABRT();
      return SIGABRT;
  })();
  var SIGALRM = (function () {
      function SIGALRM() {

      };
      SIGALRM.value = new SIGALRM();
      return SIGALRM;
  })();
  var SIGBUS = (function () {
      function SIGBUS() {

      };
      SIGBUS.value = new SIGBUS();
      return SIGBUS;
  })();
  var SIGCHLD = (function () {
      function SIGCHLD() {

      };
      SIGCHLD.value = new SIGCHLD();
      return SIGCHLD;
  })();
  var SIGCLD = (function () {
      function SIGCLD() {

      };
      SIGCLD.value = new SIGCLD();
      return SIGCLD;
  })();
  var SIGCONT = (function () {
      function SIGCONT() {

      };
      SIGCONT.value = new SIGCONT();
      return SIGCONT;
  })();
  var SIGEMT = (function () {
      function SIGEMT() {

      };
      SIGEMT.value = new SIGEMT();
      return SIGEMT;
  })();
  var SIGFPE = (function () {
      function SIGFPE() {

      };
      SIGFPE.value = new SIGFPE();
      return SIGFPE;
  })();
  var SIGHUP = (function () {
      function SIGHUP() {

      };
      SIGHUP.value = new SIGHUP();
      return SIGHUP;
  })();
  var SIGILL = (function () {
      function SIGILL() {

      };
      SIGILL.value = new SIGILL();
      return SIGILL;
  })();
  var SIGINFO = (function () {
      function SIGINFO() {

      };
      SIGINFO.value = new SIGINFO();
      return SIGINFO;
  })();
  var SIGINT = (function () {
      function SIGINT() {

      };
      SIGINT.value = new SIGINT();
      return SIGINT;
  })();
  var SIGIO = (function () {
      function SIGIO() {

      };
      SIGIO.value = new SIGIO();
      return SIGIO;
  })();
  var SIGIOT = (function () {
      function SIGIOT() {

      };
      SIGIOT.value = new SIGIOT();
      return SIGIOT;
  })();
  var SIGKILL = (function () {
      function SIGKILL() {

      };
      SIGKILL.value = new SIGKILL();
      return SIGKILL;
  })();
  var SIGLOST = (function () {
      function SIGLOST() {

      };
      SIGLOST.value = new SIGLOST();
      return SIGLOST;
  })();
  var SIGPIPE = (function () {
      function SIGPIPE() {

      };
      SIGPIPE.value = new SIGPIPE();
      return SIGPIPE;
  })();
  var SIGPOLL = (function () {
      function SIGPOLL() {

      };
      SIGPOLL.value = new SIGPOLL();
      return SIGPOLL;
  })();
  var SIGPROF = (function () {
      function SIGPROF() {

      };
      SIGPROF.value = new SIGPROF();
      return SIGPROF;
  })();
  var SIGPWR = (function () {
      function SIGPWR() {

      };
      SIGPWR.value = new SIGPWR();
      return SIGPWR;
  })();
  var SIGQUIT = (function () {
      function SIGQUIT() {

      };
      SIGQUIT.value = new SIGQUIT();
      return SIGQUIT;
  })();
  var SIGSEGV = (function () {
      function SIGSEGV() {

      };
      SIGSEGV.value = new SIGSEGV();
      return SIGSEGV;
  })();
  var SIGSTKFLT = (function () {
      function SIGSTKFLT() {

      };
      SIGSTKFLT.value = new SIGSTKFLT();
      return SIGSTKFLT;
  })();
  var SIGSTOP = (function () {
      function SIGSTOP() {

      };
      SIGSTOP.value = new SIGSTOP();
      return SIGSTOP;
  })();
  var SIGSYS = (function () {
      function SIGSYS() {

      };
      SIGSYS.value = new SIGSYS();
      return SIGSYS;
  })();
  var SIGTERM = (function () {
      function SIGTERM() {

      };
      SIGTERM.value = new SIGTERM();
      return SIGTERM;
  })();
  var SIGTRAP = (function () {
      function SIGTRAP() {

      };
      SIGTRAP.value = new SIGTRAP();
      return SIGTRAP;
  })();
  var SIGTSTP = (function () {
      function SIGTSTP() {

      };
      SIGTSTP.value = new SIGTSTP();
      return SIGTSTP;
  })();
  var SIGTTIN = (function () {
      function SIGTTIN() {

      };
      SIGTTIN.value = new SIGTTIN();
      return SIGTTIN;
  })();
  var SIGTTOU = (function () {
      function SIGTTOU() {

      };
      SIGTTOU.value = new SIGTTOU();
      return SIGTTOU;
  })();
  var SIGUNUSED = (function () {
      function SIGUNUSED() {

      };
      SIGUNUSED.value = new SIGUNUSED();
      return SIGUNUSED;
  })();
  var SIGURG = (function () {
      function SIGURG() {

      };
      SIGURG.value = new SIGURG();
      return SIGURG;
  })();
  var SIGUSR1 = (function () {
      function SIGUSR1() {

      };
      SIGUSR1.value = new SIGUSR1();
      return SIGUSR1;
  })();
  var SIGUSR2 = (function () {
      function SIGUSR2() {

      };
      SIGUSR2.value = new SIGUSR2();
      return SIGUSR2;
  })();
  var SIGVTALRM = (function () {
      function SIGVTALRM() {

      };
      SIGVTALRM.value = new SIGVTALRM();
      return SIGVTALRM;
  })();
  var SIGWINCH = (function () {
      function SIGWINCH() {

      };
      SIGWINCH.value = new SIGWINCH();
      return SIGWINCH;
  })();
  var SIGXCPU = (function () {
      function SIGXCPU() {

      };
      SIGXCPU.value = new SIGXCPU();
      return SIGXCPU;
  })();
  var SIGXFSZ = (function () {
      function SIGXFSZ() {

      };
      SIGXFSZ.value = new SIGXFSZ();
      return SIGXFSZ;
  })();
  var toString = function (s) {
      if (s instanceof SIGABRT) {
          return "SIGABRT";
      };
      if (s instanceof SIGALRM) {
          return "SIGALRM";
      };
      if (s instanceof SIGBUS) {
          return "SIGBUS";
      };
      if (s instanceof SIGCHLD) {
          return "SIGCHLD";
      };
      if (s instanceof SIGCLD) {
          return "SIGCLD";
      };
      if (s instanceof SIGCONT) {
          return "SIGCONT";
      };
      if (s instanceof SIGEMT) {
          return "SIGEMT";
      };
      if (s instanceof SIGFPE) {
          return "SIGFPE";
      };
      if (s instanceof SIGHUP) {
          return "SIGHUP";
      };
      if (s instanceof SIGILL) {
          return "SIGILL";
      };
      if (s instanceof SIGINFO) {
          return "SIGINFO";
      };
      if (s instanceof SIGINT) {
          return "SIGINT";
      };
      if (s instanceof SIGIO) {
          return "SIGIO";
      };
      if (s instanceof SIGIOT) {
          return "SIGIOT";
      };
      if (s instanceof SIGKILL) {
          return "SIGKILL";
      };
      if (s instanceof SIGLOST) {
          return "SIGLOST";
      };
      if (s instanceof SIGPIPE) {
          return "SIGPIPE";
      };
      if (s instanceof SIGPOLL) {
          return "SIGPOLL";
      };
      if (s instanceof SIGPROF) {
          return "SIGPROF";
      };
      if (s instanceof SIGPWR) {
          return "SIGPWR";
      };
      if (s instanceof SIGQUIT) {
          return "SIGQUIT";
      };
      if (s instanceof SIGSEGV) {
          return "SIGSEGV";
      };
      if (s instanceof SIGSTKFLT) {
          return "SIGSTKFLT";
      };
      if (s instanceof SIGSTOP) {
          return "SIGSTOP";
      };
      if (s instanceof SIGSYS) {
          return "SIGSYS";
      };
      if (s instanceof SIGTERM) {
          return "SIGTERM";
      };
      if (s instanceof SIGTRAP) {
          return "SIGTRAP";
      };
      if (s instanceof SIGTSTP) {
          return "SIGTSTP";
      };
      if (s instanceof SIGTTIN) {
          return "SIGTTIN";
      };
      if (s instanceof SIGTTOU) {
          return "SIGTTOU";
      };
      if (s instanceof SIGUNUSED) {
          return "SIGUNUSED";
      };
      if (s instanceof SIGURG) {
          return "SIGURG";
      };
      if (s instanceof SIGUSR1) {
          return "SIGUSR1";
      };
      if (s instanceof SIGUSR2) {
          return "SIGUSR2";
      };
      if (s instanceof SIGVTALRM) {
          return "SIGVTALRM";
      };
      if (s instanceof SIGWINCH) {
          return "SIGWINCH";
      };
      if (s instanceof SIGXCPU) {
          return "SIGXCPU";
      };
      if (s instanceof SIGXFSZ) {
          return "SIGXFSZ";
      };
      throw new Error("Failed pattern match at Data.Posix.Signal line 48, column 14 - line 88, column 1: " + [ s.constructor.name ]);
  };
  var showSignal = new Data_Show.Show(toString);
  var fromString = function (s) {
      if (s === "SIGABRT") {
          return new Data_Maybe.Just(SIGABRT.value);
      };
      if (s === "SIGALRM") {
          return new Data_Maybe.Just(SIGALRM.value);
      };
      if (s === "SIGBUS") {
          return new Data_Maybe.Just(SIGBUS.value);
      };
      if (s === "SIGCHLD") {
          return new Data_Maybe.Just(SIGCHLD.value);
      };
      if (s === "SIGCLD") {
          return new Data_Maybe.Just(SIGCLD.value);
      };
      if (s === "SIGCONT") {
          return new Data_Maybe.Just(SIGCONT.value);
      };
      if (s === "SIGEMT") {
          return new Data_Maybe.Just(SIGEMT.value);
      };
      if (s === "SIGFPE") {
          return new Data_Maybe.Just(SIGFPE.value);
      };
      if (s === "SIGHUP") {
          return new Data_Maybe.Just(SIGHUP.value);
      };
      if (s === "SIGILL") {
          return new Data_Maybe.Just(SIGILL.value);
      };
      if (s === "SIGINFO") {
          return new Data_Maybe.Just(SIGINFO.value);
      };
      if (s === "SIGINT") {
          return new Data_Maybe.Just(SIGINT.value);
      };
      if (s === "SIGIO") {
          return new Data_Maybe.Just(SIGIO.value);
      };
      if (s === "SIGIOT") {
          return new Data_Maybe.Just(SIGIOT.value);
      };
      if (s === "SIGKILL") {
          return new Data_Maybe.Just(SIGKILL.value);
      };
      if (s === "SIGLOST") {
          return new Data_Maybe.Just(SIGLOST.value);
      };
      if (s === "SIGPIPE") {
          return new Data_Maybe.Just(SIGPIPE.value);
      };
      if (s === "SIGPOLL") {
          return new Data_Maybe.Just(SIGPOLL.value);
      };
      if (s === "SIGPROF") {
          return new Data_Maybe.Just(SIGPROF.value);
      };
      if (s === "SIGPWR") {
          return new Data_Maybe.Just(SIGPWR.value);
      };
      if (s === "SIGQUIT") {
          return new Data_Maybe.Just(SIGQUIT.value);
      };
      if (s === "SIGSEGV") {
          return new Data_Maybe.Just(SIGSEGV.value);
      };
      if (s === "SIGSTKFLT") {
          return new Data_Maybe.Just(SIGSTKFLT.value);
      };
      if (s === "SIGSTOP") {
          return new Data_Maybe.Just(SIGSTOP.value);
      };
      if (s === "SIGSYS") {
          return new Data_Maybe.Just(SIGSYS.value);
      };
      if (s === "SIGTERM") {
          return new Data_Maybe.Just(SIGTERM.value);
      };
      if (s === "SIGTRAP") {
          return new Data_Maybe.Just(SIGTRAP.value);
      };
      if (s === "SIGTSTP") {
          return new Data_Maybe.Just(SIGTSTP.value);
      };
      if (s === "SIGTTIN") {
          return new Data_Maybe.Just(SIGTTIN.value);
      };
      if (s === "SIGTTOU") {
          return new Data_Maybe.Just(SIGTTOU.value);
      };
      if (s === "SIGUNUSED") {
          return new Data_Maybe.Just(SIGUNUSED.value);
      };
      if (s === "SIGURG") {
          return new Data_Maybe.Just(SIGURG.value);
      };
      if (s === "SIGUSR1") {
          return new Data_Maybe.Just(SIGUSR1.value);
      };
      if (s === "SIGUSR2") {
          return new Data_Maybe.Just(SIGUSR2.value);
      };
      if (s === "SIGVTALRM") {
          return new Data_Maybe.Just(SIGVTALRM.value);
      };
      if (s === "SIGWINCH") {
          return new Data_Maybe.Just(SIGWINCH.value);
      };
      if (s === "SIGXCPU") {
          return new Data_Maybe.Just(SIGXCPU.value);
      };
      if (s === "SIGXFSZ") {
          return new Data_Maybe.Just(SIGXFSZ.value);
      };
      return Data_Maybe.Nothing.value;
  };
  exports["SIGABRT"] = SIGABRT;
  exports["SIGALRM"] = SIGALRM;
  exports["SIGBUS"] = SIGBUS;
  exports["SIGCHLD"] = SIGCHLD;
  exports["SIGCLD"] = SIGCLD;
  exports["SIGCONT"] = SIGCONT;
  exports["SIGEMT"] = SIGEMT;
  exports["SIGFPE"] = SIGFPE;
  exports["SIGHUP"] = SIGHUP;
  exports["SIGILL"] = SIGILL;
  exports["SIGINFO"] = SIGINFO;
  exports["SIGINT"] = SIGINT;
  exports["SIGIO"] = SIGIO;
  exports["SIGIOT"] = SIGIOT;
  exports["SIGKILL"] = SIGKILL;
  exports["SIGLOST"] = SIGLOST;
  exports["SIGPIPE"] = SIGPIPE;
  exports["SIGPOLL"] = SIGPOLL;
  exports["SIGPROF"] = SIGPROF;
  exports["SIGPWR"] = SIGPWR;
  exports["SIGQUIT"] = SIGQUIT;
  exports["SIGSEGV"] = SIGSEGV;
  exports["SIGSTKFLT"] = SIGSTKFLT;
  exports["SIGSTOP"] = SIGSTOP;
  exports["SIGSYS"] = SIGSYS;
  exports["SIGTERM"] = SIGTERM;
  exports["SIGTRAP"] = SIGTRAP;
  exports["SIGTSTP"] = SIGTSTP;
  exports["SIGTTIN"] = SIGTTIN;
  exports["SIGTTOU"] = SIGTTOU;
  exports["SIGUNUSED"] = SIGUNUSED;
  exports["SIGURG"] = SIGURG;
  exports["SIGUSR1"] = SIGUSR1;
  exports["SIGUSR2"] = SIGUSR2;
  exports["SIGVTALRM"] = SIGVTALRM;
  exports["SIGWINCH"] = SIGWINCH;
  exports["SIGXCPU"] = SIGXCPU;
  exports["SIGXFSZ"] = SIGXFSZ;
  exports["fromString"] = fromString;
  exports["toString"] = toString;
  exports["showSignal"] = showSignal;
})(PS["Data.Posix.Signal"] = PS["Data.Posix.Signal"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Control_Monad_Rec_Class = PS["Control.Monad.Rec.Class"];
  var Control_Monad_ST = PS["Control.Monad.ST"];
  var Data_Array = PS["Data.Array"];
  var Data_Array_ST = PS["Data.Array.ST"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_List = PS["Data.List"];
  var Data_Map = PS["Data.Map"];
  var Data_Monoid = PS["Data.Monoid"];
  var Data_Unfoldable = PS["Data.Unfoldable"];
  var Partial_Unsafe = PS["Partial.Unsafe"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Show = PS["Data.Show"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Ord = PS["Data.Ord"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Unit = PS["Data.Unit"];
  var Data_List_Types = PS["Data.List.Types"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_Ordering = PS["Data.Ordering"];
  var Control_Bind = PS["Control.Bind"];
  var Data_Function = PS["Data.Function"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Semiring = PS["Data.Semiring"];        
  var $$Set = (function () {
      function $$Set(value0) {
          this.value0 = value0;
      };
      $$Set.create = function (value0) {
          return new $$Set(value0);
      };
      return $$Set;
  })();
  var union = function (dictOrd) {
      return function (v) {
          return function (v1) {
              return new $$Set(Data_Map.union(dictOrd)(v.value0)(v1.value0));
          };
      };
  };
  var toList = function (v) {
      return Data_Map.keys(v.value0);
  };
  var toUnfoldable = function (dictUnfoldable) {
      return function ($59) {
          return Data_List.toUnfoldable(dictUnfoldable)(toList($59));
      };
  };
  var singleton = function (a) {
      return new $$Set(Data_Map.singleton(a)(Data_Unit.unit));
  };
  var insert = function (dictOrd) {
      return function (a) {
          return function (v) {
              return new $$Set(Data_Map.insert(dictOrd)(a)(Data_Unit.unit)(v.value0));
          };
      };
  };
  var empty = new $$Set(Data_Map.empty);
  var fromFoldable = function (dictFoldable) {
      return function (dictOrd) {
          return Data_Foldable.foldl(dictFoldable)(function (m) {
              return function (a) {
                  return insert(dictOrd)(a)(m);
              };
          })(empty);
      };
  };
  var unions = function (dictFoldable) {
      return function (dictOrd) {
          return Data_Foldable.foldl(dictFoldable)(union(dictOrd))(empty);
      };
  };
  exports["empty"] = empty;
  exports["fromFoldable"] = fromFoldable;
  exports["insert"] = insert;
  exports["singleton"] = singleton;
  exports["toUnfoldable"] = toUnfoldable;
  exports["union"] = union;
  exports["unions"] = unions;
})(PS["Data.Set"] = PS["Data.Set"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Newtype = PS["Data.Newtype"];
  var Data_String = PS["Data.String"];
  var Data_Show = PS["Data.Show"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Eq = PS["Data.Eq"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Ordering = PS["Data.Ordering"];
  var Data_Semiring = PS["Data.Semiring"];
  var Data_Ring = PS["Data.Ring"];
  var Data_EuclideanRing = PS["Data.EuclideanRing"];
  var showPosition = new Data_Show.Show(function (v) {
      return "Position { line: " + (Data_Show.show(Data_Show.showInt)(v.line) + (", column: " + (Data_Show.show(Data_Show.showInt)(v.column) + " }")));
  });
  var initialPos = {
      line: 1, 
      column: 1
  };
  exports["initialPos"] = initialPos;
  exports["showPosition"] = showPosition;
})(PS["Text.Parsing.Parser.Pos"] = PS["Text.Parsing.Parser.Pos"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Alt = PS["Control.Alt"];
  var Control_Lazy = PS["Control.Lazy"];
  var Control_Monad_Except = PS["Control.Monad.Except"];
  var Control_Monad_Rec_Class = PS["Control.Monad.Rec.Class"];
  var Control_Monad_State = PS["Control.Monad.State"];
  var Control_Monad_Trans_Class = PS["Control.Monad.Trans.Class"];
  var Control_MonadPlus = PS["Control.MonadPlus"];
  var Data_Either = PS["Data.Either"];
  var Data_Identity = PS["Data.Identity"];
  var Data_Newtype = PS["Data.Newtype"];
  var Data_Tuple = PS["Data.Tuple"];
  var Text_Parsing_Parser_Pos = PS["Text.Parsing.Parser.Pos"];
  var Data_Show = PS["Data.Show"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Eq = PS["Data.Eq"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Ordering = PS["Data.Ordering"];
  var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad = PS["Control.Monad"];
  var Control_Monad_State_Class = PS["Control.Monad.State.Class"];
  var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
  var Control_Monad_State_Trans = PS["Control.Monad.State.Trans"];
  var Control_Plus = PS["Control.Plus"];
  var Control_Alternative = PS["Control.Alternative"];
  var Control_MonadZero = PS["Control.MonadZero"];        
  var ParseState = (function () {
      function ParseState(value0, value1, value2) {
          this.value0 = value0;
          this.value1 = value1;
          this.value2 = value2;
      };
      ParseState.create = function (value0) {
          return function (value1) {
              return function (value2) {
                  return new ParseState(value0, value1, value2);
              };
          };
      };
      return ParseState;
  })();
  var ParseError = (function () {
      function ParseError(value0, value1) {
          this.value0 = value0;
          this.value1 = value1;
      };
      ParseError.create = function (value0) {
          return function (value1) {
              return new ParseError(value0, value1);
          };
      };
      return ParseError;
  })();
  var ParserT = function (x) {
      return x;
  };
  var showParseError = new Data_Show.Show(function (v) {
      return "(ParseError " + (Data_Show.show(Data_Show.showString)(v.value0) + (Data_Show.show(Text_Parsing_Parser_Pos.showPosition)(v.value1) + ")"));
  });
  var parseErrorMessage = function (v) {
      return v.value0;
  };
  var newtypeParserT = new Data_Newtype.Newtype(function (n) {
      return n;
  }, ParserT);
  var runParserT = function (dictMonad) {
      return function (s) {
          return function (p) {
              var initialState = new ParseState(s, Text_Parsing_Parser_Pos.initialPos, false);
              return Control_Monad_State_Trans.evalStateT(((dictMonad["__superclass_Control.Bind.Bind_1"]())["__superclass_Control.Apply.Apply_0"]())["__superclass_Data.Functor.Functor_0"]())(Control_Monad_Except_Trans.runExceptT(Data_Newtype.unwrap(newtypeParserT)(p)))(initialState);
          };
      };
  };
  var runParser = function (s) {
      return function ($83) {
          return Data_Newtype.unwrap(Data_Identity.newtypeIdentity)(runParserT(Data_Identity.monadIdentity)(s)($83));
      };
  };
  var monadTransParserT = new Control_Monad_Trans_Class.MonadTrans(function (dictMonad) {
      return function ($84) {
          return ParserT(Control_Monad_Trans_Class.lift(Control_Monad_Except_Trans.monadTransExceptT)(Control_Monad_State_Trans.monadStateT(dictMonad))(Control_Monad_Trans_Class.lift(Control_Monad_State_Trans.monadTransStateT)(dictMonad)($84)));
      };
  });
  var monadStateParserT = function (dictMonad) {
      return Control_Monad_Except_Trans.monadStateExceptT(Control_Monad_State_Trans.monadStateStateT(dictMonad));
  };
  var monadParserT = function (dictMonad) {
      return Control_Monad_Except_Trans.monadExceptT(Control_Monad_State_Trans.monadStateT(dictMonad));
  };
  var monadErrorParserT = function (dictMonad) {
      return Control_Monad_Except_Trans.monadErrorExceptT(Control_Monad_State_Trans.monadStateT(dictMonad));
  };
  var lazyParserT = new Control_Lazy.Lazy(function (f) {
      return Control_Lazy.defer(Control_Monad_State_Trans.lazyStateT)(function ($85) {
          return Control_Monad_Except_Trans.runExceptT(Data_Newtype.unwrap(newtypeParserT)(f($85)));
      });
  });
  var functorParserT = function (dictFunctor) {
      return Control_Monad_Except_Trans.functorExceptT(Control_Monad_State_Trans.functorStateT(dictFunctor));
  };
  var bindParserT = function (dictMonad) {
      return Control_Monad_Except_Trans.bindExceptT(Control_Monad_State_Trans.monadStateT(dictMonad));
  };
  var fail = function (dictMonad) {
      return function (message) {
          return Control_Bind.bind(bindParserT(dictMonad))(Control_Monad_State_Class.gets(monadStateParserT(dictMonad))(function (v) {
              return v.value1;
          }))(function (v) {
              return Control_Monad_Error_Class.throwError(monadErrorParserT(dictMonad))(new ParseError(message, v));
          });
      };
  };
  var applyParserT = function (dictMonad) {
      return Control_Monad_Except_Trans.applyExceptT(Control_Monad_State_Trans.monadStateT(dictMonad));
  };
  var applicativeParserT = function (dictMonad) {
      return Control_Monad_Except_Trans.applicativeExceptT(Control_Monad_State_Trans.monadStateT(dictMonad));
  };
  var altParserT = function (dictMonad) {
      return new Control_Alt.Alt(function () {
          return functorParserT(((dictMonad["__superclass_Control.Bind.Bind_1"]())["__superclass_Control.Apply.Apply_0"]())["__superclass_Data.Functor.Functor_0"]());
      }, function (p1) {
          return function (p2) {
              return ParserT(Control_Monad_Except_Trans.ExceptT(Control_Monad_State_Trans.StateT(function (v) {
                  return Control_Bind.bind(dictMonad["__superclass_Control.Bind.Bind_1"]())(Control_Monad_State_Trans.runStateT(Control_Monad_Except_Trans.runExceptT(Data_Newtype.unwrap(newtypeParserT)(p1)))(new ParseState(v.value0, v.value1, false)))(function (v1) {
                      if (v1.value0 instanceof Data_Either.Left && !v1.value1.value2) {
                          return Control_Monad_State_Trans.runStateT(Control_Monad_Except_Trans.runExceptT(Data_Newtype.unwrap(newtypeParserT)(p2)))(v);
                      };
                      return Control_Applicative.pure(dictMonad["__superclass_Control.Applicative.Applicative_0"]())(new Data_Tuple.Tuple(v1.value0, v1.value1));
                  });
              })));
          };
      });
  };
  var plusParserT = function (dictMonad) {
      return new Control_Plus.Plus(function () {
          return altParserT(dictMonad);
      }, fail(dictMonad)("No alternative"));
  };
  var alternativeParserT = function (dictMonad) {
      return new Control_Alternative.Alternative(function () {
          return applicativeParserT(dictMonad);
      }, function () {
          return plusParserT(dictMonad);
      });
  };
  var monadZeroParserT = function (dictMonad) {
      return new Control_MonadZero.MonadZero(function () {
          return alternativeParserT(dictMonad);
      }, function () {
          return monadParserT(dictMonad);
      });
  };
  exports["ParseState"] = ParseState;
  exports["ParserT"] = ParserT;
  exports["fail"] = fail;
  exports["parseErrorMessage"] = parseErrorMessage;
  exports["runParser"] = runParser;
  exports["runParserT"] = runParserT;
  exports["showParseError"] = showParseError;
  exports["newtypeParserT"] = newtypeParserT;
  exports["lazyParserT"] = lazyParserT;
  exports["functorParserT"] = functorParserT;
  exports["applyParserT"] = applyParserT;
  exports["applicativeParserT"] = applicativeParserT;
  exports["bindParserT"] = bindParserT;
  exports["monadParserT"] = monadParserT;
  exports["monadStateParserT"] = monadStateParserT;
  exports["monadErrorParserT"] = monadErrorParserT;
  exports["altParserT"] = altParserT;
  exports["plusParserT"] = plusParserT;
  exports["alternativeParserT"] = alternativeParserT;
  exports["monadZeroParserT"] = monadZeroParserT;
  exports["monadTransParserT"] = monadTransParserT;
})(PS["Text.Parsing.Parser"] = PS["Text.Parsing.Parser"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Monad_Except = PS["Control.Monad.Except"];
  var Control_Monad_State = PS["Control.Monad.State"];
  var Control_Plus = PS["Control.Plus"];
  var Data_Either = PS["Data.Either"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_List = PS["Data.List"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Newtype = PS["Data.Newtype"];
  var Data_Tuple = PS["Data.Tuple"];
  var Text_Parsing_Parser = PS["Text.Parsing.Parser"];
  var Control_Alt = PS["Control.Alt"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
  var Control_Monad_State_Trans = PS["Control.Monad.State.Trans"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Unit = PS["Data.Unit"];
  var Data_List_Types = PS["Data.List.Types"];
  var Data_Function = PS["Data.Function"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Apply = PS["Control.Apply"];        
  var withErrorMessage = function (dictMonad) {
      return function (p) {
          return function (msg) {
              return Control_Alt.alt(Text_Parsing_Parser.altParserT(dictMonad))(p)(Text_Parsing_Parser.fail(dictMonad)("Expected " + msg));
          };
      };
  };
  var $$try = function (dictMonad) {
      return function (p) {
          return Text_Parsing_Parser.ParserT(Control_Monad_Except_Trans.ExceptT(Control_Monad_State_Trans.StateT(function (v) {
              return Control_Bind.bind(dictMonad["__superclass_Control.Bind.Bind_1"]())(Control_Monad_State_Trans.runStateT(Control_Monad_Except_Trans.runExceptT(Data_Newtype.unwrap(Text_Parsing_Parser.newtypeParserT)(p)))(v))(function (v1) {
                  if (v1.value0 instanceof Data_Either.Left) {
                      return Control_Applicative.pure(dictMonad["__superclass_Control.Applicative.Applicative_0"]())(new Data_Tuple.Tuple(v1.value0, new Text_Parsing_Parser.ParseState(v1.value1.value0, v1.value1.value1, v.value2)));
                  };
                  return Control_Applicative.pure(dictMonad["__superclass_Control.Applicative.Applicative_0"]())(new Data_Tuple.Tuple(v1.value0, v1.value1));
              });
          })));
      };
  };
  var sepBy1 = function (dictMonad) {
      return function (p) {
          return function (sep) {
              return Control_Bind.bind(Text_Parsing_Parser.bindParserT(dictMonad))(p)(function (v) {
                  return Control_Bind.bind(Text_Parsing_Parser.bindParserT(dictMonad))(Data_List.many(Text_Parsing_Parser.alternativeParserT(dictMonad))(Text_Parsing_Parser.lazyParserT)(Control_Bind.bind(Text_Parsing_Parser.bindParserT(dictMonad))(sep)(function () {
                      return p;
                  })))(function (v1) {
                      return Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(dictMonad))(new Data_List_Types.Cons(v, v1));
                  });
              });
          };
      };
  };
  var sepBy = function (dictMonad) {
      return function (p) {
          return function (sep) {
              return Control_Alt.alt(Text_Parsing_Parser.altParserT(dictMonad))(sepBy1(dictMonad)(p)(sep))(Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(dictMonad))(Data_List_Types.Nil.value));
          };
      };
  };
  var option = function (dictMonad) {
      return function (a) {
          return function (p) {
              return Control_Alt.alt(Text_Parsing_Parser.altParserT(dictMonad))(p)(Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(dictMonad))(a));
          };
      };
  };
  var optionMaybe = function (dictMonad) {
      return function (p) {
          return option(dictMonad)(Data_Maybe.Nothing.value)(Data_Functor.map(Text_Parsing_Parser.functorParserT(((dictMonad["__superclass_Control.Bind.Bind_1"]())["__superclass_Control.Apply.Apply_0"]())["__superclass_Data.Functor.Functor_0"]()))(Data_Maybe.Just.create)(p));
      };
  };
  exports["option"] = option;
  exports["optionMaybe"] = optionMaybe;
  exports["sepBy"] = sepBy;
  exports["sepBy1"] = sepBy1;
  exports["try"] = $$try;
  exports["withErrorMessage"] = withErrorMessage;
})(PS["Text.Parsing.Parser.Combinators"] = PS["Text.Parsing.Parser.Combinators"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Data_Array = PS["Data.Array"];
  var Data_Char_Unicode = PS["Data.Char.Unicode"];
  var Data_List = PS["Data.List"];
  var Control_Lazy = PS["Control.Lazy"];
  var Control_Monad_State = PS["Control.Monad.State"];
  var Control_MonadPlus = PS["Control.MonadPlus"];
  var Data_Char = PS["Data.Char"];
  var Data_Either = PS["Data.Either"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Identity = PS["Data.Identity"];
  var Data_Int = PS["Data.Int"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_String = PS["Data.String"];
  var Data_Tuple = PS["Data.Tuple"];
  var $$Math = PS["Math"];
  var Text_Parsing_Parser = PS["Text.Parsing.Parser"];
  var Text_Parsing_Parser_Combinators = PS["Text.Parsing.Parser.Combinators"];
  var Text_Parsing_Parser_Pos = PS["Text.Parsing.Parser.Pos"];
  var Text_Parsing_Parser_String = PS["Text.Parsing.Parser.String"];
  var Prelude = PS["Prelude"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad_State_Class = PS["Control.Monad.State.Class"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Function = PS["Data.Function"];
  var Control_MonadZero = PS["Control.MonadZero"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Boolean = PS["Data.Boolean"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Apply = PS["Control.Apply"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Ordering = PS["Data.Ordering"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Control_Alt = PS["Control.Alt"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_Ring = PS["Data.Ring"];
  var Control_Category = PS["Control.Category"];
  var Data_Semiring = PS["Data.Semiring"];
  var Data_Show = PS["Data.Show"];
  var Data_EuclideanRing = PS["Data.EuclideanRing"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Unit = PS["Data.Unit"];
  var Data_List_Types = PS["Data.List.Types"];
  var Data_Unfoldable = PS["Data.Unfoldable"];
  var token = function (dictMonad) {
      return function (tokpos) {
          return Control_Bind.bind(Text_Parsing_Parser.bindParserT(dictMonad))(Control_Monad_State_Class.gets(Text_Parsing_Parser.monadStateParserT(dictMonad))(function (v) {
              return v.value0;
          }))(function (v) {
              var $72 = Data_List.uncons(v);
              if ($72 instanceof Data_Maybe.Nothing) {
                  return Text_Parsing_Parser.fail(dictMonad)("Unexpected EOF");
              };
              if ($72 instanceof Data_Maybe.Just) {
                  return Control_Bind.bind(Text_Parsing_Parser.bindParserT(dictMonad))(Control_Monad_State_Class.modify(Text_Parsing_Parser.monadStateParserT(dictMonad))(function (v1) {
                      return new Text_Parsing_Parser.ParseState($72.value0.tail, tokpos($72.value0.head), true);
                  }))(function () {
                      return Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(dictMonad))($72.value0.head);
                  });
              };
              throw new Error("Failed pattern match at Text.Parsing.Parser.Token line 51, column 3 - line 56, column 16: " + [ $72.constructor.name ]);
          });
      };
  };
  var when = function (dictMonad) {
      return function (tokpos) {
          return function (f) {
              return Text_Parsing_Parser_Combinators["try"](dictMonad)(Control_Bind.bind(Text_Parsing_Parser.bindParserT(dictMonad))(token(dictMonad)(tokpos))(function (v) {
                  return Control_Bind.bind(Text_Parsing_Parser.bindParserT(dictMonad))(Control_MonadZero.guard(Text_Parsing_Parser.monadZeroParserT(dictMonad))(f(v)))(function () {
                      return Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(dictMonad))(v);
                  });
              }));
          };
      };
  };
  var match = function (dictMonad) {
      return function (dictEq) {
          return function (tokpos) {
              return function (tok) {
                  return when(dictMonad)(tokpos)(function (v) {
                      return Data_Eq.eq(dictEq)(v)(tok);
                  });
              };
          };
      };
  };
  exports["match"] = match;
  exports["token"] = token;
  exports["when"] = when;
})(PS["Text.Parsing.Parser.Token"] = PS["Text.Parsing.Parser.Token"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Int = PS["Data.Int"];
  var Data_Char = PS["Data.Char"];
  var Data_String = PS["Data.String"];
  var Data_List = PS["Data.List"];
  var Data_Maybe = PS["Data.Maybe"];
  var Control_Monad = PS["Control.Monad"];
  var Control_Monad_State_Class = PS["Control.Monad.State.Class"];
  var Text_Parsing_Parser = PS["Text.Parsing.Parser"];
  var Text_Parsing_Parser_Token = PS["Text.Parsing.Parser.Token"];
  var Text_Parsing_Parser_Pos = PS["Text.Parsing.Parser.Pos"];
  var Partial_Unsafe = PS["Partial.Unsafe"];
  var Data_Function = PS["Data.Function"];
  var Data_Identity = PS["Data.Identity"];
  var Data_Eq = PS["Data.Eq"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_Unfoldable = PS["Data.Unfoldable"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Applicative = PS["Control.Applicative"];        
  var lieAboutPos = Data_Function["const"](Text_Parsing_Parser_Pos.initialPos);
  var match$prime = Text_Parsing_Parser_Token.match(Data_Identity.monadIdentity)(Data_Eq.eqChar)(lieAboutPos);
  var when$prime = Text_Parsing_Parser_Token.when(Data_Identity.monadIdentity)(lieAboutPos);
  var isDigit = function (c) {
      return "0" <= c && c <= "9";
  };
  var nonNegativeInt = (function () {
      var fromDigits = function (digits) {
          return Partial_Unsafe.unsafePartial(function (dictPartial) {
              return Data_Maybe.fromJust(dictPartial)(Data_Int.fromString(Data_String.fromCharArray(Data_List.toUnfoldable(Data_Unfoldable.unfoldableArray)(digits))));
          });
      };
      return Data_Functor.map(Text_Parsing_Parser.functorParserT(Data_Identity.functorIdentity))(fromDigits)(Data_List.some(Text_Parsing_Parser.alternativeParserT(Data_Identity.monadIdentity))(Text_Parsing_Parser.lazyParserT)(Text_Parsing_Parser_Token.when(Data_Identity.monadIdentity)(lieAboutPos)(isDigit)));
  })();
  var isAsciiAlpha = function (ch) {
      return Data_Ord.between(Data_Ord.ordChar)("a")("z")(Data_Char.toLower(ch));
  };
  var eof = Control_Bind.bind(Text_Parsing_Parser.bindParserT(Data_Identity.monadIdentity))(Control_Monad_State_Class.gets(Text_Parsing_Parser.monadStateParserT(Data_Identity.monadIdentity))(function (v) {
      return v.value0;
  }))(function (v) {
      return Control_Applicative.unless(Text_Parsing_Parser.applicativeParserT(Data_Identity.monadIdentity))(Data_List["null"](v))(Text_Parsing_Parser.fail(Data_Identity.monadIdentity)("expected eof"));
  });
  exports["eof"] = eof;
  exports["isAsciiAlpha"] = isAsciiAlpha;
  exports["isDigit"] = isDigit;
  exports["lieAboutPos"] = lieAboutPos;
  exports["match'"] = match$prime;
  exports["nonNegativeInt"] = nonNegativeInt;
  exports["when'"] = when$prime;
})(PS["Data.Version.Internal"] = PS["Data.Version.Internal"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Either = PS["Data.Either"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Int = PS["Data.Int"];
  var Data_String = PS["Data.String"];
  var Data_List = PS["Data.List"];
  var Data_Function = PS["Data.Function"];
  var Data_Foldable = PS["Data.Foldable"];
  var Control_Alt = PS["Control.Alt"];
  var Control_Apply = PS["Control.Apply"];
  var Text_Parsing_Parser = PS["Text.Parsing.Parser"];
  var Text_Parsing_Parser_Combinators = PS["Text.Parsing.Parser.Combinators"];
  var Data_Version_Internal = PS["Data.Version.Internal"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Ordering = PS["Data.Ordering"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Show = PS["Data.Show"];
  var Data_List_Types = PS["Data.List.Types"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Functor = PS["Data.Functor"];
  var Data_Unfoldable = PS["Data.Unfoldable"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_Semiring = PS["Data.Semiring"];
  var Control_Bind = PS["Control.Bind"];
  var Data_Identity = PS["Data.Identity"];
  var Control_Applicative = PS["Control.Applicative"];        
  var IInt = (function () {
      function IInt(value0) {
          this.value0 = value0;
      };
      IInt.create = function (value0) {
          return new IInt(value0);
      };
      return IInt;
  })();
  var IStr = (function () {
      function IStr(value0) {
          this.value0 = value0;
      };
      IStr.create = function (value0) {
          return new IStr(value0);
      };
      return IStr;
  })();
  var Version = (function () {
      function Version(value0, value1, value2, value3, value4) {
          this.value0 = value0;
          this.value1 = value1;
          this.value2 = value2;
          this.value3 = value3;
          this.value4 = value4;
      };
      Version.create = function (value0) {
          return function (value1) {
              return function (value2) {
                  return function (value3) {
                      return function (value4) {
                          return new Version(value0, value1, value2, value3, value4);
                      };
                  };
              };
          };
      };
      return Version;
  })();
  var showIdentifier = function (i) {
      if (i instanceof IInt) {
          return Data_Show.show(Data_Show.showInt)(i.value0);
      };
      if (i instanceof IStr) {
          return i.value0;
      };
      throw new Error("Failed pattern match at Data.Version line 126, column 20 - line 128, column 14: " + [ i.constructor.name ]);
  };
  var runVersion = function (f) {
      return function (v) {
          return f(v.value0)(v.value1)(v.value2)(v.value3)(v.value4);
      };
  };
  var showVersion = (function () {
      var sep = function (v) {
          return function (v1) {
              if (v1 instanceof Data_List_Types.Nil) {
                  return "";
              };
              return (function (v2) {
                  return v + v2;
              })(Data_String.joinWith(".")(Data_Functor.map(Data_Functor.functorArray)(showIdentifier)(Data_List.toUnfoldable(Data_Unfoldable.unfoldableArray)(v1))));
          };
      };
      var go = function (maj) {
          return function (min) {
              return function (pat) {
                  return function (pre) {
                      return function (build) {
                          return Data_String.joinWith(".")(Data_Functor.map(Data_Functor.functorArray)(Data_Show.show(Data_Show.showInt))([ maj, min, pat ])) + (sep("-")(pre) + sep("+")(build));
                      };
                  };
              };
          };
      };
      return runVersion(go);
  })();
  var preRelease = function (v) {
      return v.value3;
  };
  var patch = function (v) {
      return v.value2;
  };
  var nonneg = function (x) {
      var $49 = x < 0;
      if ($49) {
          return 0;
      };
      if (!$49) {
          return x;
      };
      throw new Error("Failed pattern match at Data.Version line 169, column 12 - line 169, column 34: " + [ $49.constructor.name ]);
  };
  var numeric = function ($104) {
      return IInt.create(nonneg($104));
  };
  var version = function (ma) {
      return function (mi) {
          return function (pa) {
              return function (pre) {
                  return function (meta) {
                      return new Version(nonneg(ma), nonneg(mi), nonneg(pa), pre, meta);
                  };
              };
          };
      };
  };
  var minor = function (v) {
      return v.value1;
  };
  var major = function (v) {
      return v.value0;
  };
  var ordIdentifier = new Data_Ord.Ord(function () {
      return eqIdentifier;
  }, function (v) {
      return function (v1) {
          if (v instanceof IInt && v1 instanceof IStr) {
              return Data_Ordering.LT.value;
          };
          if (v instanceof IStr && v1 instanceof IInt) {
              return Data_Ordering.GT.value;
          };
          if (v instanceof IInt && v1 instanceof IInt) {
              return Data_Ord.compare(Data_Ord.ordInt)(v.value0)(v1.value0);
          };
          if (v instanceof IStr && v1 instanceof IStr) {
              return Data_Ord.compare(Data_Ord.ordString)(v.value0)(v1.value0);
          };
          throw new Error("Failed pattern match at Data.Version line 204, column 3 - line 204, column 33: " + [ v.constructor.name, v1.constructor.name ]);
      };
  });
  var eqIdentifier = new Data_Eq.Eq(function (i1) {
      return function (i2) {
          return Data_Eq.eq(Data_Ordering.eqOrdering)(Data_Ord.compare(ordIdentifier)(i1)(i2))(Data_Ordering.EQ.value);
      };
  });
  var comparePre = function (v) {
      return function (v1) {
          if (v instanceof Data_List_Types.Nil && v1 instanceof Data_List_Types.Nil) {
              return Data_Ordering.EQ.value;
          };
          if (v instanceof Data_List_Types.Nil) {
              return Data_Ordering.GT.value;
          };
          if (v1 instanceof Data_List_Types.Nil) {
              return Data_Ordering.LT.value;
          };
          if (v instanceof Data_List_Types.Cons && v1 instanceof Data_List_Types.Cons) {
              var helper = function (v2) {
                  return function (v3) {
                      if (v2 instanceof Data_List_Types.Nil && v3 instanceof Data_List_Types.Nil) {
                          return Data_Ordering.EQ.value;
                      };
                      if (v2 instanceof Data_List_Types.Nil) {
                          return Data_Ordering.LT.value;
                      };
                      if (v3 instanceof Data_List_Types.Nil) {
                          return Data_Ordering.GT.value;
                      };
                      if (v2 instanceof Data_List_Types.Cons && v3 instanceof Data_List_Types.Cons) {
                          return Data_Semigroup.append(Data_Ordering.semigroupOrdering)(Data_Ord.compare(ordIdentifier)(v2.value0)(v3.value0))(helper(v2.value1)(v3.value1));
                      };
                      throw new Error("Failed pattern match at Data.Version line 177, column 1 - line 177, column 24: " + [ v2.constructor.name, v3.constructor.name ]);
                  };
              };
              return Data_Semigroup.append(Data_Ordering.semigroupOrdering)(Data_Ord.compare(ordIdentifier)(v.value0)(v1.value0))(helper(v.value1)(v1.value1));
          };
          throw new Error("Failed pattern match at Data.Version line 177, column 1 - line 177, column 24: " + [ v.constructor.name, v1.constructor.name ]);
      };
  };
  var ordVersion = new Data_Ord.Ord(function () {
      return eqVersion;
  }, function (v1) {
      return function (v2) {
          var comparePre$prime = Data_Function.on(comparePre)(preRelease);
          var compareNormal = Data_Function.on(Data_Ord.compare(Data_Ord.ordArray(Data_Ord.ordInt)))(runVersion(function (ma) {
              return function (mi) {
                  return function (pa) {
                      return function (v) {
                          return function (v3) {
                              return [ ma, mi, pa ];
                          };
                      };
                  };
              };
          }));
          return Data_Semigroup.append(Data_Ordering.semigroupOrdering)(compareNormal(v1)(v2))(comparePre$prime(v1)(v2));
      };
  });
  var eqVersion = new Data_Eq.Eq(function (v1) {
      return function (v2) {
          return Data_Eq.eq(Data_Ordering.eqOrdering)(Data_Ord.compare(ordVersion)(v1)(v2))(Data_Ordering.EQ.value);
      };
  });
  var bumpPatch = function (v) {
      return version(major(v))(minor(v))(patch(v) + 1 | 0)(Data_List_Types.Nil.value)(Data_List_Types.Nil.value);
  };
  var bumpMinor = function (v) {
      return version(major(v))(minor(v) + 1 | 0)(0)(Data_List_Types.Nil.value)(Data_List_Types.Nil.value);
  };
  var bumpMajor = function (v) {
      return version(major(v) + 1 | 0)(0)(0)(Data_List_Types.Nil.value)(Data_List_Types.Nil.value);
  };
  var acceptableIdentifier = function (ch) {
      return Data_Version_Internal.isDigit(ch) || (Data_Version_Internal.isAsciiAlpha(ch) || ch === "-");
  };
  var textual = function (str) {
      var startsWith = function (str1) {
          return function ($106) {
              return Data_Maybe.isJust(Data_String.stripPrefix(str1)($106));
          };
      };
      var ok = function (x) {
          return Data_Foldable.all(Data_Foldable.foldableArray)(Data_HeytingAlgebra.heytingAlgebraBoolean)(function (v) {
              return v(x);
          })([ function ($107) {
              return !Data_Maybe.isJust(Data_Int.fromString($107));
          }, function ($108) {
              return !startsWith("0")($108);
          }, function ($109) {
              return Data_Foldable.all(Data_Foldable.foldableArray)(Data_HeytingAlgebra.heytingAlgebraBoolean)(acceptableIdentifier)(Data_String.toCharArray($109));
          } ]);
      };
      var $92 = ok(str);
      if ($92) {
          return new Data_Maybe.Just(new IStr(str));
      };
      if (!$92) {
          return Data_Maybe.Nothing.value;
      };
      throw new Error("Failed pattern match at Data.Version line 113, column 3 - line 113, column 46: " + [ $92.constructor.name ]);
  };
  var versionParser = (function () {
      var textIdent = Control_Bind.bind(Text_Parsing_Parser.bindParserT(Data_Identity.monadIdentity))(Data_List.some(Text_Parsing_Parser.alternativeParserT(Data_Identity.monadIdentity))(Text_Parsing_Parser.lazyParserT)(Data_Version_Internal["when'"](acceptableIdentifier)))(function (v) {
          var str = Data_String.fromCharArray(Data_List.toUnfoldable(Data_Unfoldable.unfoldableArray)(v));
          var $94 = textual(str);
          if ($94 instanceof Data_Maybe.Just) {
              return Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(Data_Identity.monadIdentity))($94.value0);
          };
          if ($94 instanceof Data_Maybe.Nothing) {
              return Text_Parsing_Parser.fail(Data_Identity.monadIdentity)("invalid identifier: " + str);
          };
          throw new Error("Failed pattern match at Data.Version line 152, column 5 - line 154, column 54: " + [ $94.constructor.name ]);
      });
      var intIdent = Data_Functor.map(Text_Parsing_Parser.functorParserT(Data_Identity.functorIdentity))(numeric)(Data_Version_Internal.nonNegativeInt);
      var identifier = Control_Alt.alt(Text_Parsing_Parser.altParserT(Data_Identity.monadIdentity))(intIdent)(textIdent);
      var identifiers = Text_Parsing_Parser_Combinators.sepBy(Data_Identity.monadIdentity)(identifier)(Data_Version_Internal["match'"]("."));
      return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Data_Identity.monadIdentity))(Data_Version_Internal.nonNegativeInt)(function (v) {
          return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Data_Identity.monadIdentity))(Data_Version_Internal["match'"]("."))(function () {
              return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Data_Identity.monadIdentity))(Data_Version_Internal.nonNegativeInt)(function (v1) {
                  return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Data_Identity.monadIdentity))(Data_Version_Internal["match'"]("."))(function () {
                      return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Data_Identity.monadIdentity))(Data_Version_Internal.nonNegativeInt)(function (v2) {
                          return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Data_Identity.monadIdentity))(Text_Parsing_Parser_Combinators.option(Data_Identity.monadIdentity)(Data_List_Types.Nil.value)(Control_Apply.applySecond(Text_Parsing_Parser.applyParserT(Data_Identity.monadIdentity))(Data_Version_Internal["match'"]("-"))(identifiers)))(function (v3) {
                              return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Data_Identity.monadIdentity))(Text_Parsing_Parser_Combinators.option(Data_Identity.monadIdentity)(Data_List_Types.Nil.value)(Control_Apply.applySecond(Text_Parsing_Parser.applyParserT(Data_Identity.monadIdentity))(Data_Version_Internal["match'"]("+"))(identifiers)))(function (v4) {
                                  return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Data_Identity.monadIdentity))(Data_Version_Internal.eof)(function () {
                                      return Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(Data_Identity.monadIdentity))(new Version(v, v1, v2, v3, v4));
                                  });
                              });
                          });
                      });
                  });
              });
          });
      });
  })();
  var parseVersion = function ($110) {
      return Data_Function.flip(Text_Parsing_Parser.runParser)(versionParser)(Data_List.fromFoldable(Data_Foldable.foldableArray)(Data_String.toCharArray($110)));
  };
  exports["bumpMajor"] = bumpMajor;
  exports["bumpMinor"] = bumpMinor;
  exports["bumpPatch"] = bumpPatch;
  exports["major"] = major;
  exports["minor"] = minor;
  exports["numeric"] = numeric;
  exports["parseVersion"] = parseVersion;
  exports["preRelease"] = preRelease;
  exports["runVersion"] = runVersion;
  exports["showVersion"] = showVersion;
  exports["textual"] = textual;
  exports["version"] = version;
  exports["versionParser"] = versionParser;
  exports["eqVersion"] = eqVersion;
  exports["ordVersion"] = ordVersion;
  exports["eqIdentifier"] = eqIdentifier;
  exports["ordIdentifier"] = ordIdentifier;
})(PS["Data.Version"] = PS["Data.Version"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Apply = PS["Control.Apply"];
  var Data_Either = PS["Data.Either"];
  var Data_List = PS["Data.List"];
  var Data_String = PS["Data.String"];
  var Text_Parsing_Parser = PS["Text.Parsing.Parser"];
  var Text_Parsing_Parser_Combinators = PS["Text.Parsing.Parser.Combinators"];
  var Data_Version_Internal = PS["Data.Version.Internal"];
  var Data_Eq = PS["Data.Eq"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Show = PS["Data.Show"];
  var Data_Identity = PS["Data.Identity"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Unfoldable = PS["Data.Unfoldable"];
  var Control_Bind = PS["Control.Bind"];
  var Data_List_Types = PS["Data.List.Types"];
  var Data_Function = PS["Data.Function"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Ordering = PS["Data.Ordering"];        
  var Version = (function () {
      function Version(value0, value1) {
          this.value0 = value0;
          this.value1 = value1;
      };
      Version.create = function (value0) {
          return function (value1) {
              return new Version(value0, value1);
          };
      };
      return Version;
  })();
  var versionParser = (function () {
      var someAlphaNums = Data_List.some(Text_Parsing_Parser.alternativeParserT(Data_Identity.monadIdentity))(Text_Parsing_Parser.lazyParserT)(Data_Version_Internal["when'"](function (c) {
          return Data_Version_Internal.isAsciiAlpha(c) || Data_Version_Internal.isDigit(c);
      }));
      var identifier = Data_Functor.map(Text_Parsing_Parser.functorParserT(Data_Identity.functorIdentity))(function ($32) {
          return Data_String.fromCharArray(Data_List.toUnfoldable(Data_Unfoldable.unfoldableArray)($32));
      })(someAlphaNums);
      var hyphen = Data_Version_Internal["match'"]("-");
      return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Data_Identity.monadIdentity))(Text_Parsing_Parser_Combinators.sepBy(Data_Identity.monadIdentity)(Data_Version_Internal.nonNegativeInt)(Data_Version_Internal["match'"](".")))(function (v) {
          return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Data_Identity.monadIdentity))(Text_Parsing_Parser_Combinators.option(Data_Identity.monadIdentity)(Data_List_Types.Nil.value)(Control_Apply.applySecond(Text_Parsing_Parser.applyParserT(Data_Identity.monadIdentity))(hyphen)(Text_Parsing_Parser_Combinators.sepBy(Data_Identity.monadIdentity)(identifier)(hyphen))))(function (v1) {
              return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Data_Identity.monadIdentity))(Data_Version_Internal.eof)(function () {
                  return Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(Data_Identity.monadIdentity))(new Version(v, v1));
              });
          });
      });
  })();
  var showVersion = function (v) {
      var prefix = function (v1) {
          return function (v2) {
              if (v2 === "") {
                  return "";
              };
              return v1 + v2;
          };
      };
      var f = function ($33) {
          return Data_String.joinWith(".")(Data_List.toUnfoldable(Data_Unfoldable.unfoldableArray)(Data_Functor.map(Data_List_Types.functorList)(Data_Show.show(Data_Show.showInt))($33)));
      };
      return f(v.value0) + prefix("-")(Data_String.joinWith("-")(Data_List.toUnfoldable(Data_Unfoldable.unfoldableArray)(v.value1)));
  };
  var parseVersion = function ($34) {
      return Data_Function.flip(Text_Parsing_Parser.runParser)(versionParser)(Data_List.fromFoldable(Data_Foldable.foldableArray)(Data_String.toCharArray($34)));
  };
  var eqVersion = new Data_Eq.Eq(function (v) {
      return function (v1) {
          return Data_Eq.eq(Data_List_Types.eqList(Data_Eq.eqInt))(v.value0)(v1.value0) && Data_Eq.eq(Data_List_Types.eqList(Data_Eq.eqString))(v.value1)(v1.value1);
      };
  });
  var ordVersion = new Data_Ord.Ord(function () {
      return eqVersion;
  }, function (v) {
      return function (v1) {
          return Data_Semigroup.append(Data_Ordering.semigroupOrdering)(Data_Ord.compare(Data_List_Types.ordList(Data_Ord.ordInt))(v.value0)(v1.value0))(Data_Ord.compare(Data_List_Types.ordList(Data_Ord.ordString))(v.value1)(v1.value1));
      };
  });
  exports["Version"] = Version;
  exports["parseVersion"] = parseVersion;
  exports["showVersion"] = showVersion;
  exports["versionParser"] = versionParser;
  exports["eqVersion"] = eqVersion;
  exports["ordVersion"] = ordVersion;
})(PS["Data.Version.Haskell"] = PS["Data.Version.Haskell"] || {});
(function(exports) {
  // module Main

  "use strict";

  exports.logStack = function logStack(err) {
    return function() {
      console.log(err.stack);
    };
  };
})(PS["Main"] = PS["Main"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Node.Encoding"];
  var Prelude = PS["Prelude"];
  var Data_Show = PS["Data.Show"];        
  var ASCII = (function () {
      function ASCII() {

      };
      ASCII.value = new ASCII();
      return ASCII;
  })();
  var UTF8 = (function () {
      function UTF8() {

      };
      UTF8.value = new UTF8();
      return UTF8;
  })();
  var UTF16LE = (function () {
      function UTF16LE() {

      };
      UTF16LE.value = new UTF16LE();
      return UTF16LE;
  })();
  var UCS2 = (function () {
      function UCS2() {

      };
      UCS2.value = new UCS2();
      return UCS2;
  })();
  var Base64 = (function () {
      function Base64() {

      };
      Base64.value = new Base64();
      return Base64;
  })();
  var Latin1 = (function () {
      function Latin1() {

      };
      Latin1.value = new Latin1();
      return Latin1;
  })();
  var Binary = (function () {
      function Binary() {

      };
      Binary.value = new Binary();
      return Binary;
  })();
  var Hex = (function () {
      function Hex() {

      };
      Hex.value = new Hex();
      return Hex;
  })();
  var showEncoding = new Data_Show.Show(function (v) {
      if (v instanceof ASCII) {
          return "ASCII";
      };
      if (v instanceof UTF8) {
          return "UTF8";
      };
      if (v instanceof UTF16LE) {
          return "UTF16LE";
      };
      if (v instanceof UCS2) {
          return "UCS2";
      };
      if (v instanceof Base64) {
          return "Base64";
      };
      if (v instanceof Latin1) {
          return "Latin1";
      };
      if (v instanceof Binary) {
          return "Binary";
      };
      if (v instanceof Hex) {
          return "Hex";
      };
      throw new Error("Failed pattern match at Node.Encoding line 20, column 3 - line 21, column 3: " + [ v.constructor.name ]);
  });
  var encodingToNode = function (v) {
      if (v instanceof ASCII) {
          return "ascii";
      };
      if (v instanceof UTF8) {
          return "utf8";
      };
      if (v instanceof UTF16LE) {
          return "utf16le";
      };
      if (v instanceof UCS2) {
          return "ucs2";
      };
      if (v instanceof Base64) {
          return "base64";
      };
      if (v instanceof Latin1) {
          return "latin1";
      };
      if (v instanceof Binary) {
          return "binary";
      };
      if (v instanceof Hex) {
          return "hex";
      };
      throw new Error("Failed pattern match at Node.Encoding line 32, column 1 - line 33, column 1: " + [ v.constructor.name ]);
  };
  exports["ASCII"] = ASCII;
  exports["UTF8"] = UTF8;
  exports["UTF16LE"] = UTF16LE;
  exports["UCS2"] = UCS2;
  exports["Base64"] = Base64;
  exports["Latin1"] = Latin1;
  exports["Binary"] = Binary;
  exports["Hex"] = Hex;
  exports["encodingToNode"] = encodingToNode;
  exports["showEncoding"] = showEncoding;
})(PS["Node.Encoding"] = PS["Node.Encoding"] || {});
(function(exports) {
  /* global exports */
  /* global Buffer */
  /* global require */
  "use strict";

  exports.fromStringImpl = function (str) {
    return function (encoding) {
      return function() {
        return new Buffer(str, encoding);
      };
    };
  };

  exports.toStringImpl = function (enc) {
    return function (buff) {
      return function() {
        return buff.toString(enc);
      };
    };
  };

  exports.size = function (buff) {
    return function() {
      return buff.length;
    };
  };
})(PS["Node.Buffer"] = PS["Node.Buffer"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Node.Buffer"];
  var Prelude = PS["Prelude"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Data_Maybe = PS["Data.Maybe"];
  var Node_Encoding = PS["Node.Encoding"];
  var Data_Show = PS["Data.Show"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var toString = function ($3) {
      return $foreign.toStringImpl(Node_Encoding.encodingToNode($3));
  };                                                                                           
  var fromString = function (str) {
      return function ($7) {
          return $foreign.fromStringImpl(str)(Node_Encoding.encodingToNode($7));
      };
  };
  exports["fromString"] = fromString;
  exports["toString"] = toString;
  exports["size"] = $foreign.size;
})(PS["Node.Buffer"] = PS["Node.Buffer"] || {});
(function(exports) {
    "use strict";                                

  exports.statsMethod = function (m, s) {
    return s[m]();
  };
})(PS["Node.FS.Stats"] = PS["Node.FS.Stats"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Node.FS.Stats"];
  var Prelude = PS["Prelude"];
  var Data_DateTime = PS["Data.DateTime"];
  var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
  var Data_JSDate = PS["Data.JSDate"];
  var Data_Maybe = PS["Data.Maybe"];
  var Partial_Unsafe = PS["Partial.Unsafe"];
  var Data_Show = PS["Data.Show"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Function = PS["Data.Function"];        
  var Stats = (function () {
      function Stats(value0) {
          this.value0 = value0;
      };
      Stats.create = function (value0) {
          return new Stats(value0);
      };
      return Stats;
  })();
  var isFile = function (v) {
      return $foreign.statsMethod("isFile", v.value0);
  };
  var isDirectory = function (v) {
      return $foreign.statsMethod("isDirectory", v.value0);
  };
  exports["Stats"] = Stats;
  exports["isDirectory"] = isDirectory;
  exports["isFile"] = isFile;
})(PS["Node.FS.Stats"] = PS["Node.FS.Stats"] || {});
(function(exports) {
    "use strict";
  var path =require("path"); 

  exports.normalize = path.normalize;

  exports.concat = function (segments) {
    return path.join.apply(this, segments);
  };

  exports.resolve = function (from) {
    return function (to) {
      return path.resolve.apply(this, from.concat([to]));
    };
  };

  exports.dirname = function (p) {
    return path.normalize(path.dirname(p));
  };

  exports.basename = path.basename;

  exports.delimiter = path.delimiter;

  exports.parse = path.parse;
})(PS["Node.Path"] = PS["Node.Path"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Node.Path"];
  exports["basename"] = $foreign.basename;
  exports["concat"] = $foreign.concat;
  exports["delimiter"] = $foreign.delimiter;
  exports["dirname"] = $foreign.dirname;
  exports["parse"] = $foreign.parse;
  exports["resolve"] = $foreign.resolve;
})(PS["Node.Path"] = PS["Node.Path"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Char = PS["Data.Char"];
  var Data_Int = PS["Data.Int"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_String = PS["Data.String"];
  var Global = PS["Global"];
  var Partial_Unsafe = PS["Partial.Unsafe"];
  var Data_Eq = PS["Data.Eq"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Show = PS["Data.Show"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Semiring = PS["Data.Semiring"];
  var Data_Function = PS["Data.Function"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Boolean = PS["Data.Boolean"];
  var Control_Apply = PS["Control.Apply"];
  var write = {
      r: false, 
      w: true, 
      x: false
  };
  var semiringPerm = new Data_Semiring.Semiring(function (v) {
      return function (v1) {
          return {
              r: v.r || v1.r, 
              w: v.w || v1.w, 
              x: v.x || v1.x
          };
      };
  }, function (v) {
      return function (v1) {
          return {
              r: v.r && v1.r, 
              w: v.w && v1.w, 
              x: v.x && v1.x
          };
      };
  }, {
      r: true, 
      w: true, 
      x: true
  }, {
      r: false, 
      w: false, 
      x: false
  });
  var read = {
      r: true, 
      w: false, 
      x: false
  };
  var permToInt = function (v) {
      return ((function () {
          if (v.r) {
              return 4;
          };
          if (!v.r) {
              return 0;
          };
          throw new Error("Failed pattern match at Node.FS.Perms line 158, column 8 - line 158, column 26: " + [ v.r.constructor.name ]);
      })() + (function () {
          if (v.w) {
              return 2;
          };
          if (!v.w) {
              return 0;
          };
          throw new Error("Failed pattern match at Node.FS.Perms line 159, column 8 - line 159, column 26: " + [ v.w.constructor.name ]);
      })() | 0) + (function () {
          if (v.x) {
              return 1;
          };
          if (!v.x) {
              return 0;
          };
          throw new Error("Failed pattern match at Node.FS.Perms line 160, column 8 - line 160, column 26: " + [ v.x.constructor.name ]);
      })() | 0;
  };
  var permToString = function ($96) {
      return Data_Show.show(Data_Show.showInt)(permToInt($96));
  };
  var permsToString = function (v) {
      return "0" + (permToString(v.u) + (permToString(v.g) + permToString(v.o)));
  }; 
  var none = Data_Semiring.zero(semiringPerm);
  var mkPerms = function (u) {
      return function (g) {
          return function (o) {
              return {
                  u: u, 
                  g: g, 
                  o: o
              };
          };
      };
  }; 
  var all = Data_Semiring.one(semiringPerm);
  exports["all"] = all;
  exports["mkPerms"] = mkPerms;
  exports["none"] = none;
  exports["permsToString"] = permsToString;
  exports["read"] = read;
  exports["write"] = write;
  exports["semiringPerm"] = semiringPerm;
})(PS["Node.FS.Perms"] = PS["Node.FS.Perms"] || {});
(function(exports) {
    "use strict";

  exports.unsafeRequireFS = require("fs");
})(PS["Node.FS.Internal"] = PS["Node.FS.Internal"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Node.FS.Internal"];
  var Prelude = PS["Prelude"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Unsafe_Coerce = PS["Unsafe.Coerce"];        
  var mkEff = Unsafe_Coerce.unsafeCoerce;
  exports["mkEff"] = mkEff;
  exports["unsafeRequireFS"] = $foreign.unsafeRequireFS;
})(PS["Node.FS.Internal"] = PS["Node.FS.Internal"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Data_DateTime = PS["Data.DateTime"];
  var Data_Time_Duration = PS["Data.Time.Duration"];
  var Data_DateTime_Instant = PS["Data.DateTime.Instant"];
  var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
  var Data_Nullable = PS["Data.Nullable"];
  var Data_Int = PS["Data.Int"];
  var Data_Maybe = PS["Data.Maybe"];
  var Node_Buffer = PS["Node.Buffer"];
  var Node_Encoding = PS["Node.Encoding"];
  var Node_FS = PS["Node.FS"];
  var Node_FS_Stats = PS["Node.FS.Stats"];
  var Node_Path = PS["Node.Path"];
  var Node_FS_Perms = PS["Node.FS.Perms"];
  var Node_FS_Internal = PS["Node.FS.Internal"];
  var Data_Function = PS["Data.Function"];
  var Data_Show = PS["Data.Show"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_EuclideanRing = PS["Data.EuclideanRing"];
  var Control_Bind = PS["Control.Bind"];        
  var fs = Node_FS_Internal.unsafeRequireFS;
  var readTextFile = function (encoding) {
      return function (file) {
          return Node_FS_Internal.mkEff(function (v) {
              return fs.readFileSync(file, {
                  encoding: Data_Show.show(Node_Encoding.showEncoding)(encoding)
              });
          });
      };
  };
  exports["readTextFile"] = readTextFile;
})(PS["Node.FS.Sync"] = PS["Node.FS.Sync"] || {});
(function(exports) {
    "use strict";

  exports.process = process;

  exports.onSignalImpl = function (signal) {
    return function (callback) {
      return function () {
        process.on(signal, callback);
      };
    };
  };

  exports.chdir = function (dir) {
    return function () {
      process.chdir(dir);
    };
  };

  exports.setEnv = function (var_) {
    return function (val) {
      return function () {
        process.env[var_] = val;
      };
    };
  };

  exports.exit = function (code) {
    return function () {
      process.exit(code);
    };
  };
})(PS["Node.Process"] = PS["Node.Process"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Show = PS["Data.Show"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Ordering = PS["Data.Ordering"];        
  var Darwin = (function () {
      function Darwin() {

      };
      Darwin.value = new Darwin();
      return Darwin;
  })();
  var FreeBSD = (function () {
      function FreeBSD() {

      };
      FreeBSD.value = new FreeBSD();
      return FreeBSD;
  })();
  var Linux = (function () {
      function Linux() {

      };
      Linux.value = new Linux();
      return Linux;
  })();
  var SunOS = (function () {
      function SunOS() {

      };
      SunOS.value = new SunOS();
      return SunOS;
  })();
  var Win32 = (function () {
      function Win32() {

      };
      Win32.value = new Win32();
      return Win32;
  })();
  var fromString = function (v) {
      if (v === "darwin") {
          return new Data_Maybe.Just(Darwin.value);
      };
      if (v === "freebsd") {
          return new Data_Maybe.Just(FreeBSD.value);
      };
      if (v === "linux") {
          return new Data_Maybe.Just(Linux.value);
      };
      if (v === "sunos") {
          return new Data_Maybe.Just(SunOS.value);
      };
      if (v === "win32") {
          return new Data_Maybe.Just(Win32.value);
      };
      return Data_Maybe.Nothing.value;
  };
  var eqPlatform = new Data_Eq.Eq(function (x) {
      return function (y) {
          if (x instanceof Darwin && y instanceof Darwin) {
              return true;
          };
          if (x instanceof FreeBSD && y instanceof FreeBSD) {
              return true;
          };
          if (x instanceof Linux && y instanceof Linux) {
              return true;
          };
          if (x instanceof SunOS && y instanceof SunOS) {
              return true;
          };
          if (x instanceof Win32 && y instanceof Win32) {
              return true;
          };
          return false;
      };
  });
  exports["Darwin"] = Darwin;
  exports["FreeBSD"] = FreeBSD;
  exports["Linux"] = Linux;
  exports["SunOS"] = SunOS;
  exports["Win32"] = Win32;
  exports["fromString"] = fromString;
  exports["eqPlatform"] = eqPlatform;
})(PS["Node.Platform"] = PS["Node.Platform"] || {});
(function(exports) {
    "use strict";

  exports.onError = function (s) {
    return function (f) {
      return function () {
        s.on("error", function (e) {
          f(e)();
        });
      };
    };
  };

  exports.write = function (w) {
    return function (chunk) {
      return function (done) {
        return function () {
          return w.write(chunk, null, done);
        };
      };
    };
  };

  exports.writeStringImpl = function (w) {
    return function (enc) {
      return function (s) {
        return function (done) {
          return function () {
            return w.write(s, enc, done);
          };
        };
      };
    };
  };

  exports.end = function (w) {
    return function (done) {
      return function () {
        w.end(null, null, function () {
          done();
        });
      };
    };
  };
})(PS["Node.Stream"] = PS["Node.Stream"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Node.Stream"];
  var Prelude = PS["Prelude"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Control_Monad_Eff_Unsafe = PS["Control.Monad.Eff.Unsafe"];
  var Data_Either = PS["Data.Either"];
  var Data_Maybe = PS["Data.Maybe"];
  var Node_Buffer = PS["Node.Buffer"];
  var Node_Encoding = PS["Node.Encoding"];
  var Data_Show = PS["Data.Show"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Functor = PS["Data.Functor"];
  var Data_Function = PS["Data.Function"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];        
  var writeString = function (w) {
      return function (enc) {
          return $foreign.writeStringImpl(w)(Data_Show.show(Node_Encoding.showEncoding)(enc));
      };
  };
  exports["writeString"] = writeString;
  exports["end"] = $foreign.end;
  exports["onError"] = $foreign.onError;
  exports["write"] = $foreign.write;
})(PS["Node.Stream"] = PS["Node.Stream"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Node.Process"];
  var Prelude = PS["Prelude"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Control_Monad_Eff_Console = PS["Control.Monad.Eff.Console"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Posix = PS["Data.Posix"];
  var Data_Posix_Signal = PS["Data.Posix.Signal"];
  var Data_StrMap = PS["Data.StrMap"];
  var Node_Platform = PS["Node.Platform"];
  var Node_Stream = PS["Node.Stream"];
  var Partial_Unsafe = PS["Partial.Unsafe"];
  var Unsafe_Coerce = PS["Unsafe.Coerce"];
  var Data_Function = PS["Data.Function"];
  var Data_Functor = PS["Data.Functor"];        
  var version = $foreign.process.version;         
  var stdout = $foreign.process.stdout;
  var stdin = $foreign.process.stdin;             
  var stderr = $foreign.process.stderr;
  var platform = Partial_Unsafe.unsafePartial(function (dictPartial) {
      return Data_Maybe.fromJust(dictPartial)(Node_Platform.fromString($foreign.process.platform));
  });                            
  var onSignal = function (sig) {
      return $foreign.onSignalImpl(Data_Posix_Signal.toString(sig));
  };
  var mkEff = Unsafe_Coerce.unsafeCoerce;
  var getEnv = mkEff(function (v) {
      return $foreign.process.env;
  });
  var lookupEnv = function (k) {
      return Data_Functor.map(Control_Monad_Eff.functorEff)(Data_StrMap.lookup(k))(getEnv);
  }; 
  var cwd = $foreign.process.cwd;
  var argv = mkEff(function (v) {
      return $foreign.process.argv;
  });
  exports["argv"] = argv;
  exports["cwd"] = cwd;
  exports["getEnv"] = getEnv;
  exports["lookupEnv"] = lookupEnv;
  exports["onSignal"] = onSignal;
  exports["platform"] = platform;
  exports["stderr"] = stderr;
  exports["stdin"] = stdin;
  exports["stdout"] = stdout;
  exports["version"] = version;
  exports["chdir"] = $foreign.chdir;
  exports["exit"] = $foreign.exit;
  exports["setEnv"] = $foreign.setEnv;
})(PS["Node.Process"] = PS["Node.Process"] || {});
(function(exports) {
  // module Pulp.System.FFI

  "use strict";

  exports["runNode'"] = function runNode$prime(error, success, fn) {
    return function() {
      fn(function(err, val) {
        if (err) { error(err)(); } else { success(val)(); }
      });
    };
  };

  exports.unsafeInspect = function unsafeInspect(obj) {
    return require('util').inspect(obj);
  };
})(PS["Pulp.System.FFI"] = PS["Pulp.System.FFI"] || {});
(function(exports) {
    "use strict";

  /* eslint-env node*/

  exports.unsafeFromNullable = function unsafeFromNullable (msg) {
    return function (x) {
      if (x === null) throw new Error(msg);
      return x;
    };
  };

  exports.spawnImpl = function spawnImpl (command) {
    return function (args) {
      return function (opts) {
        return function () {
          return require("child_process").spawn(command, args, opts);
        };
      };
    };
  };

  exports.fork = function fork (cmd) {
    return function (args) {
      return function () {
        return require("child_process").fork(cmd, args);
      };
    };
  };

  exports.mkOnExit = function mkOnExit (mkChildExit) {
    return function onExit (cp) {
      return function (cb) {
        return function () {
          cp.on("exit", function (code, signal) {
            cb(mkChildExit(code)(signal))();
          });
        };
      };
    };
  };

  exports.onError = function onError (cp) {
    return function (cb) {
      return function () {
        cp.on("error", function (err) {
          cb(err)();
        });
      };
    };
  };

  exports.undefined = undefined;
  exports.process = process;
})(PS["Node.ChildProcess"] = PS["Node.ChildProcess"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Node.ChildProcess"];
  var Prelude = PS["Prelude"];
  var Control_Alt = PS["Control.Alt"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Control_Monad_Eff_Exception_Unsafe = PS["Control.Monad.Eff.Exception.Unsafe"];
  var Data_Foreign = PS["Data.Foreign"];
  var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Nullable = PS["Data.Nullable"];
  var Data_Posix = PS["Data.Posix"];
  var Data_Posix_Signal = PS["Data.Posix.Signal"];
  var Data_StrMap = PS["Data.StrMap"];
  var Node_Buffer = PS["Node.Buffer"];
  var Node_FS = PS["Node.FS"];
  var Node_Stream = PS["Node.Stream"];
  var Unsafe_Coerce = PS["Unsafe.Coerce"];
  var Data_Show = PS["Data.Show"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Control_Bind = PS["Control.Bind"];        
  var Pipe = (function () {
      function Pipe() {

      };
      Pipe.value = new Pipe();
      return Pipe;
  })();
  var Ignore = (function () {
      function Ignore() {

      };
      Ignore.value = new Ignore();
      return Ignore;
  })();
  var ShareStream = (function () {
      function ShareStream(value0) {
          this.value0 = value0;
      };
      ShareStream.create = function (value0) {
          return new ShareStream(value0);
      };
      return ShareStream;
  })();
  var ShareFD = (function () {
      function ShareFD(value0) {
          this.value0 = value0;
      };
      ShareFD.create = function (value0) {
          return new ShareFD(value0);
      };
      return ShareFD;
  })();
  var Normally = (function () {
      function Normally(value0) {
          this.value0 = value0;
      };
      Normally.create = function (value0) {
          return new Normally(value0);
      };
      return Normally;
  })();
  var BySignal = (function () {
      function BySignal(value0) {
          this.value0 = value0;
      };
      BySignal.create = function (value0) {
          return new BySignal(value0);
      };
      return BySignal;
  })();
  var toStandardError = Unsafe_Coerce.unsafeCoerce;
  var toActualStdIOBehaviour = function (b) {
      if (b instanceof Pipe) {
          return Unsafe_Coerce.unsafeCoerce("pipe");
      };
      if (b instanceof Ignore) {
          return Unsafe_Coerce.unsafeCoerce("ignore");
      };
      if (b instanceof ShareFD) {
          return Unsafe_Coerce.unsafeCoerce(b.value0);
      };
      if (b instanceof ShareStream) {
          return Unsafe_Coerce.unsafeCoerce(b.value0);
      };
      throw new Error("Failed pattern match at Node.ChildProcess line 382, column 28 - line 386, column 33: " + [ b.constructor.name ]);
  };
  var toActualStdIOOptions = Data_Functor.map(Data_Functor.functorArray)(function ($31) {
      return Data_Nullable.toNullable(Data_Functor.map(Data_Maybe.functorMaybe)(toActualStdIOBehaviour)($31));
  });
  var spawn = function (cmd) {
      return function (args) {
          return function (opts) {
              var convertOpts = function (opts1) {
                  return {
                      cwd: Data_Maybe.fromMaybe($foreign["undefined"])(opts1.cwd), 
                      stdio: toActualStdIOOptions(opts1.stdio), 
                      env: Data_Nullable.toNullable(opts1.env), 
                      detached: opts1.detached, 
                      uid: Data_Maybe.fromMaybe($foreign["undefined"])(opts1.uid), 
                      gid: Data_Maybe.fromMaybe($foreign["undefined"])(opts1.gid)
                  };
              };
              return $foreign.spawnImpl(cmd)(args)(convertOpts(opts));
          };
      };
  }; 
  var runChildProcess = function (v) {
      return v;
  };
  var pipe = Data_Functor.map(Data_Functor.functorArray)(Data_Maybe.Just.create)([ Pipe.value, Pipe.value, Pipe.value ]);
  var pid = function ($32) {
      return (function (v) {
          return v.pid;
      })(runChildProcess($32));
  };                                                                                     
  var mkExit = function (code) {
      return function (signal) {
          var fromSignal = Control_Bind.composeKleisli(Data_Maybe.bindMaybe)(Data_Nullable.toMaybe)(function ($33) {
              return Data_Functor.map(Data_Maybe.functorMaybe)(BySignal.create)(Data_Posix_Signal.fromString($33));
          });
          var fromCode = function ($34) {
              return Data_Functor.map(Data_Maybe.functorMaybe)(Normally.create)(Data_Nullable.toMaybe($34));
          };
          var $20 = Control_Alt.alt(Data_Maybe.altMaybe)(fromCode(code))(fromSignal(signal));
          if ($20 instanceof Data_Maybe.Just) {
              return $20.value0;
          };
          if ($20 instanceof Data_Maybe.Nothing) {
              return Control_Monad_Eff_Exception_Unsafe.unsafeThrow("Node.ChildProcess.mkExit: Invalid arguments");
          };
          throw new Error("Failed pattern match at Node.ChildProcess line 152, column 3 - line 155, column 3: " + [ $20.constructor.name ]);
      };
  };                                       
  var onExit = $foreign.mkOnExit(mkExit);
  var mkEff = Unsafe_Coerce.unsafeCoerce;
  var missingStream = function (str) {
      return "Node.ChildProcess: stream not available: " + (str + ("\nThis is probably " + ("because you passed something other than Pipe to the stdio option when " + "you spawned it.")));
  };
  var stderr = function ($35) {
      return $foreign.unsafeFromNullable(missingStream("stderr"))((function (v) {
          return v.stderr;
      })(runChildProcess($35)));
  };
  var stdin = function ($36) {
      return $foreign.unsafeFromNullable(missingStream("stdin"))((function (v) {
          return v.stdin;
      })(runChildProcess($36)));
  };
  var stdout = function ($37) {
      return $foreign.unsafeFromNullable(missingStream("stdout"))((function (v) {
          return v.stdout;
      })(runChildProcess($37)));
  };
  var kill = function (sig) {
      return function (v) {
          return mkEff(function (v1) {
              return v.kill(Data_Posix_Signal.toString(sig));
          });
      };
  };
  var inherit = Data_Functor.map(Data_Functor.functorArray)(Data_Maybe.Just.create)([ new ShareStream($foreign.process.stdin), new ShareStream($foreign.process.stdout), new ShareStream($foreign.process.stderr) ]);
  var defaultSpawnOptions = {
      cwd: Data_Maybe.Nothing.value, 
      stdio: pipe, 
      env: Data_Maybe.Nothing.value, 
      detached: false, 
      uid: Data_Maybe.Nothing.value, 
      gid: Data_Maybe.Nothing.value
  };
  exports["Normally"] = Normally;
  exports["BySignal"] = BySignal;
  exports["Pipe"] = Pipe;
  exports["Ignore"] = Ignore;
  exports["ShareStream"] = ShareStream;
  exports["ShareFD"] = ShareFD;
  exports["defaultSpawnOptions"] = defaultSpawnOptions;
  exports["inherit"] = inherit;
  exports["kill"] = kill;
  exports["onExit"] = onExit;
  exports["pid"] = pid;
  exports["pipe"] = pipe;
  exports["spawn"] = spawn;
  exports["stderr"] = stderr;
  exports["stdin"] = stdin;
  exports["stdout"] = stdout;
  exports["toStandardError"] = toStandardError;
  exports["fork"] = $foreign.fork;
  exports["onError"] = $foreign.onError;
})(PS["Node.ChildProcess"] = PS["Node.ChildProcess"] || {});
(function(exports) {
    "use strict";
  var http =require("http"); 

  exports.createServer = function (handleRequest) {
    return function () {
      return http.createServer(function (req, res) {
        handleRequest(req)(res)();
      });
    };
  };

  exports.listenImpl = function (server) {
    return function (port) {
      return function (hostname) {
        return function (backlog) {
          return function (done) {
            return function () {
              if (backlog !== null) {
                server.listen(port, hostname, backlog, done);
              } else {
                server.listen(port, hostname, done);
              }
            };
          };
        };
      };
    };
  };

  exports.setStatusCode = function (res) {
    return function (code) {
      return function () {
        res.statusCode = code;
      };
    };
  };

  exports.setStatusMessage = function (res) {
    return function (message) {
      return function () {
        res.statusMessage = message;
      };
    };
  };
})(PS["Node.HTTP"] = PS["Node.HTTP"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Node.HTTP"];
  var Prelude = PS["Prelude"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Nullable = PS["Data.Nullable"];
  var Data_StrMap = PS["Data.StrMap"];
  var Node_Stream = PS["Node.Stream"];
  var Unsafe_Coerce = PS["Unsafe.Coerce"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];        
  var responseAsStream = Unsafe_Coerce.unsafeCoerce;
  var requestURL = function ($4) {
      return (function (v) {
          return v.url;
      })(Unsafe_Coerce.unsafeCoerce($4));
  };                                               
  var listen = function (server) {
      return function (opts) {
          return function (done) {
              return $foreign.listenImpl(server)(opts.port)(opts.hostname)(Data_Nullable.toNullable(opts.backlog))(done);
          };
      };
  };
  exports["listen"] = listen;
  exports["requestURL"] = requestURL;
  exports["responseAsStream"] = responseAsStream;
  exports["createServer"] = $foreign.createServer;
  exports["setStatusCode"] = $foreign.setStatusCode;
  exports["setStatusMessage"] = $foreign.setStatusMessage;
})(PS["Node.HTTP"] = PS["Node.HTTP"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Pulp.System.FFI"];
  var Prelude = PS["Prelude"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Control_Monad_Aff_AVar = PS["Control.Monad.Aff.AVar"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Control_Monad_Eff_Console = PS["Control.Monad.Eff.Console"];
  var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
  var Unsafe_Coerce = PS["Unsafe.Coerce"];
  var Node_FS = PS["Node.FS"];
  var Node_ChildProcess = PS["Node.ChildProcess"];
  var Node_Buffer = PS["Node.Buffer"];
  var Node_Process = PS["Node.Process"];
  var Node_ReadLine = PS["Node.ReadLine"];
  var Node_HTTP = PS["Node.HTTP"];        
  var unsafeToEffN = Unsafe_Coerce.unsafeCoerce;
  var runNode = function (fn) {
      return Control_Monad_Aff.makeAff(function (err) {
          return function (win) {
              return $foreign["runNode'"](err, win, fn);
          };
      });
  };
  exports["runNode"] = runNode;
  exports["unsafeToEffN"] = unsafeToEffN;
  exports["unsafeInspect"] = $foreign.unsafeInspect;
})(PS["Pulp.System.FFI"] = PS["Pulp.System.FFI"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Data_Map = PS["Data.Map"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_List = PS["Data.List"];
  var Data_Foreign = PS["Data.Foreign"];
  var Text_Parsing_Parser = PS["Text.Parsing.Parser"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var runAction = function (v) {
      return v;
  };
  var option = function (name) {
      return function (match) {
          return function (parser) {
              return function (desc) {
                  return {
                      name: name, 
                      match: match, 
                      parser: parser, 
                      desc: desc, 
                      defaultValue: Data_Maybe.Nothing.value
                  };
              };
          };
      };
  };
  var optionDefault = function (n) {
      return function (m) {
          return function (p) {
              return function (d) {
                  return function (defaultValue) {
                      var $4 = option(n)(m)(p)(d);
                      var $2 = {};
                      for (var $3 in $4) {
                          if ($4.hasOwnProperty($3)) {
                              $2[$3] = $4[$3];
                          };
                      };
                      $2.defaultValue = new Data_Maybe.Just(Data_Foreign.toForeign(defaultValue));
                      return $2;
                  };
              };
          };
      };
  };
  var command = function (name) {
      return function (desc) {
          return function (passthroughDesc) {
              return function (action) {
                  return function (options) {
                      return {
                          name: name, 
                          desc: desc, 
                          passthroughDesc: passthroughDesc, 
                          options: options, 
                          action: action, 
                          "arguments": [  ]
                      };
                  };
              };
          };
      };
  };
  var commandWithArgs = function (name) {
      return function (desc) {
          return function (passthroughDesc) {
              return function (action) {
                  return function (options) {
                      return function (args) {
                          var $7 = command(name)(desc)(passthroughDesc)(action)(options);
                          var $5 = {};
                          for (var $6 in $7) {
                              if ($7.hasOwnProperty($6)) {
                                  $5[$6] = $7[$6];
                              };
                          };
                          $5["arguments"] = args;
                          return $5;
                      };
                  };
              };
          };
      };
  };
  var argument = function (name) {
      return function (parser) {
          return function (desc) {
              return function (required) {
                  return {
                      name: name, 
                      parser: parser, 
                      desc: desc, 
                      required: required
                  };
              };
          };
      };
  };
  exports["argument"] = argument;
  exports["command"] = command;
  exports["commandWithArgs"] = commandWithArgs;
  exports["option"] = option;
  exports["optionDefault"] = optionDefault;
  exports["runAction"] = runAction;
})(PS["Pulp.Args"] = PS["Pulp.Args"] || {});
(function(exports) {
  // Generated by psc version 0.10.2

  /**
 *  | Functions for getting data back out of an `Options` value.
 */  
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Either = PS["Data.Either"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_String = PS["Data.String"];
  var Data_Foreign = PS["Data.Foreign"];
  var Data_Foreign_Class = PS["Data.Foreign.Class"];
  var Data_Map = PS["Data.Map"];
  var Control_Monad_Except = PS["Control.Monad.Except"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Pulp_Args = PS["Pulp.Args"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Function = PS["Data.Function"];
  var Data_Show = PS["Data.Show"];
  var Data_List_Types = PS["Data.List.Types"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Bind = PS["Control.Bind"];        
  var internalError = function (msg) {
      return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("Internal error in Pulp.Args.Get: " + (msg + ("\n" + "This is a bug. Please report it.\n"))));
  };
  var readForeign = function (dictIsForeign) {
      return function (name) {
          return function (thing) {
              var $4 = Control_Monad_Except.runExcept(Data_Foreign_Class.read(dictIsForeign)(thing));
              if ($4 instanceof Data_Either.Left) {
                  return internalError(Data_String.joinWith("\n")([ "Failed to read option: " + name, "The value was: " + Pulp_System_FFI.unsafeInspect(thing), "Data.Foreign.read failed: " + Data_Show.show(Data_List_Types.showNonEmptyList(Data_Foreign.showForeignError))($4.value0) ]));
              };
              if ($4 instanceof Data_Either.Right) {
                  return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)($4.value0);
              };
              throw new Error("Failed pattern match at Pulp.Args.Get line 72, column 3 - line 80, column 13: " + [ $4.constructor.name ]);
          };
      };
  };

  /**
 *  | Get an option out of the `Options` value. If the option has no default and
 *  | was not specified at the command line, the result will be `Nothing`. For
 *  | options which do have defaults, you probably want the primed version
 *  | instead, `getOption'`.
 */  
  var getOption = function (dictIsForeign) {
      return function (name) {
          return function (opts) {
              var $7 = Data_Map.lookup(Data_Ord.ordString)(name)(opts);
              if ($7 instanceof Data_Maybe.Just && $7.value0 instanceof Data_Maybe.Just) {
                  return Data_Functor.map(Control_Monad_Aff.functorAff)(Data_Maybe.Just.create)(readForeign(dictIsForeign)(name)($7.value0.value0));
              };
              if ($7 instanceof Data_Maybe.Just && $7.value0 instanceof Data_Maybe.Nothing) {
                  var msg = "Tried to read a flag as an option: " + name;
                  return internalError(msg);
              };
              if ($7 instanceof Data_Maybe.Nothing) {
                  return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(Data_Maybe.Nothing.value);
              };
              throw new Error("Failed pattern match at Pulp.Args.Get line 29, column 3 - line 36, column 19: " + [ $7.constructor.name ]);
          };
      };
  };

  /**
 *  | Get an option which was declared with a default value, and therefore
 *  | should always have a value.
 */  
  var getOption$prime = function (dictIsForeign) {
      return function (name) {
          return function (opts) {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(getOption(dictIsForeign)(name)(opts))(function (v) {
                  if (v instanceof Data_Maybe.Just) {
                      return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(v.value0);
                  };
                  if (v instanceof Data_Maybe.Nothing) {
                      var msg = "Missing default value for option: " + name;
                      return internalError(msg);
                  };
                  throw new Error("Failed pattern match at Pulp.Args.Get line 43, column 3 - line 48, column 27: " + [ v.constructor.name ]);
              });
          };
      };
  };

  /**
 *  | True if a given option exists in the `Options` map, false otherwise.
 */  
  var hasOption = function (name) {
      return function (opts) {
          var opt = getOption(Data_Foreign_Class.foreignIsForeign)(name)(opts);
          return Data_Functor.map(Control_Monad_Aff.functorAff)(Data_Maybe.isJust)(opt);
      };
  };

  /**
 *  | Get a flag out of the `Options` value. If it was specified at the command
 *  | line, the result is `true`, otherwise, `false`.
 */  
  var getFlag = function (name) {
      return function (opts) {
          var $14 = Data_Map.lookup(Data_Ord.ordString)(name)(opts);
          if ($14 instanceof Data_Maybe.Just && $14.value0 instanceof Data_Maybe.Just) {
              var msg = "Tried to read an option as a flag: " + name;
              return internalError(msg);
          };
          if ($14 instanceof Data_Maybe.Just && $14.value0 instanceof Data_Maybe.Nothing) {
              return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(true);
          };
          if ($14 instanceof Data_Maybe.Nothing) {
              return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(false);
          };
          throw new Error("Failed pattern match at Pulp.Args.Get line 54, column 3 - line 61, column 17: " + [ $14.constructor.name ]);
      };
  };
  exports["getFlag"] = getFlag;
  exports["getOption"] = getOption;
  exports["getOption'"] = getOption$prime;
  exports["hasOption"] = hasOption;
})(PS["Pulp.Args.Get"] = PS["Pulp.Args.Get"] || {});
(function(exports) {
  // module Pulp.Args.Help
  "use strict";

  exports.pad = function pad(n) {
    return new Array(n + 1).join(" ");
  };

  exports.wrap = function wrap(s) {
    return function(indent) {
      return function() {
        var cols = process.stdout.columns;
        return cols ? require("wordwrap")(indent, cols)(s).slice(indent) : s;
      };
    };
  };
})(PS["Pulp.Args.Help"] = PS["Pulp.Args.Help"] || {});
(function(exports) {
    "use strict";

  exports.handleCallbackImpl = function (left, right, f) {
    return function (err, value) {
      if (err) {
        f(left(err))();
      } else {
        f(right(value))();
      }
    };
  };
})(PS["Node.FS.Async"] = PS["Node.FS.Async"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Node.FS.Async"];
  var Prelude = PS["Prelude"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Control_Monad_Eff_Unsafe = PS["Control.Monad.Eff.Unsafe"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Data_DateTime = PS["Data.DateTime"];
  var Data_Time_Duration = PS["Data.Time.Duration"];
  var Data_DateTime_Instant = PS["Data.DateTime.Instant"];
  var Data_Either = PS["Data.Either"];
  var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Nullable = PS["Data.Nullable"];
  var Node_Buffer = PS["Node.Buffer"];
  var Data_Int = PS["Data.Int"];
  var Node_Encoding = PS["Node.Encoding"];
  var Node_FS = PS["Node.FS"];
  var Node_FS_Stats = PS["Node.FS.Stats"];
  var Node_Path = PS["Node.Path"];
  var Node_FS_Perms = PS["Node.FS.Perms"];
  var Node_FS_Internal = PS["Node.FS.Internal"];
  var Data_Function = PS["Data.Function"];
  var Data_Show = PS["Data.Show"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Functor = PS["Data.Functor"];
  var Data_EuclideanRing = PS["Data.EuclideanRing"];
  var Control_Bind = PS["Control.Bind"];        
  var handleCallback = function (cb) {
      return $foreign.handleCallbackImpl(Data_Either.Left.create, Data_Either.Right.create, cb);
  };
  var fs = Node_FS_Internal.unsafeRequireFS;
  var mkdir$prime = function (file) {
      return function (perms) {
          return function (cb) {
              return Node_FS_Internal.mkEff(function (v) {
                  return fs.mkdir(file, Node_FS_Perms.permsToString(perms), handleCallback(cb));
              });
          };
      };
  };
  var mkdir = Data_Function.flip(mkdir$prime)(Node_FS_Perms.mkPerms(Node_FS_Perms.all)(Node_FS_Perms.all)(Node_FS_Perms.all));
  var readFile = function (file) {
      return function (cb) {
          return Node_FS_Internal.mkEff(function (v) {
              return fs.readFile(file, {}, handleCallback(cb));
          });
      };
  };
  var readTextFile = function (encoding) {
      return function (file) {
          return function (cb) {
              return Node_FS_Internal.mkEff(function (v) {
                  return fs.readFile(file, {
                      encoding: Data_Show.show(Node_Encoding.showEncoding)(encoding)
                  }, handleCallback(cb));
              });
          };
      };
  };
  var stat = function (file) {
      return function (cb) {
          return Node_FS_Internal.mkEff(function (v) {
              return fs.stat(file, handleCallback(function ($58) {
                  return cb(Data_Functor.map(Data_Either.functorEither)(Node_FS_Stats.Stats.create)($58));
              }));
          });
      };
  };
  var unlink = function (file) {
      return function (cb) {
          return Node_FS_Internal.mkEff(function (v) {
              return fs.unlink(file, handleCallback(cb));
          });
      };
  };
  var writeFile = function (file) {
      return function (buff) {
          return function (cb) {
              return Node_FS_Internal.mkEff(function (v) {
                  return fs.writeFile(file, buff, {}, handleCallback(cb));
              });
          };
      };
  };
  var writeTextFile = function (encoding) {
      return function (file) {
          return function (buff) {
              return function (cb) {
                  return Node_FS_Internal.mkEff(function (v) {
                      return fs.writeFile(file, buff, {
                          encoding: Data_Show.show(Node_Encoding.showEncoding)(encoding)
                      }, handleCallback(cb));
                  });
              };
          };
      };
  };
  var fdWrite = function (fd) {
      return function (buff) {
          return function (off) {
              return function (len) {
                  return function (pos) {
                      return function (cb) {
                          return Node_FS_Internal.mkEff(function (v) {
                              return fs.write(fd, buff, off, len, Data_Nullable.toNullable(pos), handleCallback(cb));
                          });
                      };
                  };
              };
          };
      };
  };
  var fdClose = function (fd) {
      return function (cb) {
          return Node_FS_Internal.mkEff(function (v) {
              return fs.close(fd, handleCallback(cb));
          });
      };
  };
  var fdAppend = function (fd) {
      return function (buff) {
          return function (cb) {
              return function __do() {
                  var v = Node_Buffer.size(buff)();
                  return fdWrite(fd)(buff)(0)(v)(Data_Maybe.Nothing.value)(cb)();
              };
          };
      };
  };
  var exists = function (file) {
      return function (cb) {
          return Node_FS_Internal.mkEff(function (v) {
              return fs.exists(file, function (b) {
                  return Control_Monad_Eff.runPure(Control_Monad_Eff_Unsafe.unsafeCoerceEff(cb(b)));
              });
          });
      };
  };
  var chmod = function (file) {
      return function (perms) {
          return function (cb) {
              return Node_FS_Internal.mkEff(function (v) {
                  return fs.chmod(file, Node_FS_Perms.permsToString(perms), handleCallback(cb));
              });
          };
      };
  };
  exports["chmod"] = chmod;
  exports["exists"] = exists;
  exports["fdAppend"] = fdAppend;
  exports["fdClose"] = fdClose;
  exports["fdWrite"] = fdWrite;
  exports["mkdir"] = mkdir;
  exports["readFile"] = readFile;
  exports["readTextFile"] = readTextFile;
  exports["stat"] = stat;
  exports["unlink"] = unlink;
  exports["writeFile"] = writeFile;
  exports["writeTextFile"] = writeTextFile;
})(PS["Node.FS.Async"] = PS["Node.FS.Async"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Data_DateTime = PS["Data.DateTime"];
  var Data_Either = PS["Data.Either"];
  var Data_Maybe = PS["Data.Maybe"];
  var Node_Buffer = PS["Node.Buffer"];
  var Node_Encoding = PS["Node.Encoding"];
  var Node_FS = PS["Node.FS"];
  var Node_FS_Async = PS["Node.FS.Async"];
  var Node_FS_Perms = PS["Node.FS.Perms"];
  var Node_FS_Stats = PS["Node.FS.Stats"];
  var Node_Path = PS["Node.Path"];
  var Data_Function = PS["Data.Function"];        
  var toAff = function (p) {
      return Control_Monad_Aff.makeAff(function (e) {
          return function (a) {
              return p(Data_Either.either(e)(a));
          };
      });
  };
  var toAff1 = function (f) {
      return function (a) {
          return toAff(f(a));
      };
  };
  var unlink = toAff1(Node_FS_Async.unlink);
  var toAff2 = function (f) {
      return function (a) {
          return function (b) {
              return toAff(f(a)(b));
          };
      };
  };                                              
  var toAff3 = function (f) {
      return function (a) {
          return function (b) {
              return function (c) {
                  return toAff(f(a)(b)(c));
              };
          };
      };
  };                                        
  var writeTextFile = toAff3(Node_FS_Async.writeTextFile);
  var stat = toAff1(Node_FS_Async.stat);      
  var readTextFile = toAff2(Node_FS_Async.readTextFile);
  var mkdir = toAff1(Node_FS_Async.mkdir);  
  var fdClose = toAff1(Node_FS_Async.fdClose);
  var fdAppend = toAff2(Node_FS_Async.fdAppend);
  var exists = function (file) {
      return Control_Monad_Aff.makeAff(function (v) {
          return function (a) {
              return Node_FS_Async.exists(file)(a);
          };
      });
  };                                      
  var chmod = toAff2(Node_FS_Async.chmod);
  exports["chmod"] = chmod;
  exports["exists"] = exists;
  exports["fdAppend"] = fdAppend;
  exports["fdClose"] = fdClose;
  exports["mkdir"] = mkdir;
  exports["readTextFile"] = readTextFile;
  exports["stat"] = stat;
  exports["unlink"] = unlink;
  exports["writeTextFile"] = writeTextFile;
})(PS["Node.FS.Aff"] = PS["Node.FS.Aff"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Control_Monad_Trans_Class = PS["Control.Monad.Trans.Class"];
  var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
  var Control_Monad_State_Class = PS["Control.Monad.State.Class"];
  var Control_Alt = PS["Control.Alt"];
  var Data_Array = PS["Data.Array"];
  var Data_Either = PS["Data.Either"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Traversable = PS["Data.Traversable"];
  var Data_List = PS["Data.List"];
  var Data_String = PS["Data.String"];
  var Data_Map = PS["Data.Map"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Tuple = PS["Data.Tuple"];
  var Data_Foreign = PS["Data.Foreign"];
  var Text_Parsing_Parser = PS["Text.Parsing.Parser"];
  var Text_Parsing_Parser_Combinators = PS["Text.Parsing.Parser.Combinators"];
  var Text_Parsing_Parser_Token = PS["Text.Parsing.Parser.Token"];
  var Text_Parsing_Parser_Pos = PS["Text.Parsing.Parser.Pos"];
  var Pulp_Args = PS["Pulp.Args"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Data_Function = PS["Data.Function"];
  var Data_Eq = PS["Data.Eq"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Show = PS["Data.Show"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Unfoldable = PS["Data.Unfoldable"];
  var Control_Apply = PS["Control.Apply"];
  var Data_Ord = PS["Data.Ord"];        

  /**
 *  | A version of Text.Parsing.Parser.Token.when which lies about the position,
 *  | since we don't care about it here.
 */  
  var when = function (dictMonad) {
      return Text_Parsing_Parser_Token.when(dictMonad)(Data_Function["const"](Text_Parsing_Parser_Pos.initialPos));
  };

  /**
 *  | A version of Text.Parsing.Parser.Token.token which lies about the position,
 *  | since we don't care about it here.
 */  
  var token = function (dictMonad) {
      return Text_Parsing_Parser_Token.token(dictMonad)(Data_Function["const"](Text_Parsing_Parser_Pos.initialPos));
  };
  var matchOpt = function (o) {
      return function (key) {
          return Data_Foldable.elem(Data_Foldable.foldableArray)(Data_Eq.eqString)(key)(o.match);
      };
  };

  /**
 *  halt err = ParserT $ \s ->
 *    pure { consumed: true, input: s, result: Left (strMsg err) }
 */  
  var matchNamed = function (dictEq) {
      return function (o) {
          return function (key) {
              return Data_Eq.eq(dictEq)(o.name)(key);
          };
      };
  };

  /**
 *  | A version of Text.Parsing.Parser.Token.match which lies about the position,
 *  | since we don't care about it here.
 */  
  var match = function (dictMonad) {
      return function (dictEq) {
          return Text_Parsing_Parser_Token.match(dictMonad)(dictEq)(Data_Function["const"](Text_Parsing_Parser_Pos.initialPos));
      };
  };
  var lookup = function (dictMonad) {
      return function (dictEq) {
          return function (dictShow) {
              return function (matches) {
                  return function (table) {
                      return Control_Bind.bind(Text_Parsing_Parser.bindParserT(dictMonad))(token(dictMonad))(function (v) {
                          var $26 = Data_Foldable.find(Data_Foldable.foldableArray)(function (i) {
                              return matches(i)(v);
                          })(table);
                          if ($26 instanceof Data_Maybe.Just) {
                              return Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(dictMonad))(new Data_Tuple.Tuple(v, $26.value0));
                          };
                          if ($26 instanceof Data_Maybe.Nothing) {
                              return Text_Parsing_Parser.fail(dictMonad)("Unknown command: " + Data_Show.show(dictShow)(v));
                          };
                          throw new Error("Failed pattern match at Pulp.Args.Parser line 59, column 3 - line 61, column 55: " + [ $26.constructor.name ]);
                      });
                  };
              };
          };
      };
  };
  var lookupCmd = lookup(Control_Monad_Aff.monadAff)(Data_Eq.eqString)(Data_Show.showString)(matchNamed(Data_Eq.eqString));
  var lookupOpt = lookup(Control_Monad_Aff.monadAff)(Data_Eq.eqString)(Data_Show.showString)(matchOpt);
  var opt = function (opts) {
      return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(lookupOpt(opts))(function (v) {
          return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(v.value1.parser.parser(v.value0))(function (v1) {
              return Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(Control_Monad_Aff.monadAff))(Data_Map.singleton(v.value1.name)(v1));
          });
      });
  };
  var halt = function (err) {
      return Control_Monad_Trans_Class.lift(Text_Parsing_Parser.monadTransParserT)(Control_Monad_Aff.monadAff)(Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error(err)));
  };
  var extractDefault = function (o) {
      if (o.defaultValue instanceof Data_Maybe.Just) {
          return Data_Map.singleton(o.name)(new Data_Maybe.Just(Data_Foreign.toForeign(o.defaultValue.value0)));
      };
      if (o.defaultValue instanceof Data_Maybe.Nothing) {
          return Data_Map.empty;
      };
      throw new Error("Failed pattern match at Pulp.Args.Parser line 94, column 3 - line 98, column 16: " + [ o.defaultValue.constructor.name ]);
  };

  /**
 *  See also https://github.com/purescript-contrib/purescript-parsing/issues/25
 */  
  var eof = function (dictMonad) {
      return function (msg) {
          return Control_Bind.bind(Text_Parsing_Parser.bindParserT(dictMonad))(Control_Monad_State_Class.get(Text_Parsing_Parser.monadStateParserT(dictMonad)))(function (v) {
              return Control_Applicative.unless(Text_Parsing_Parser.applicativeParserT(dictMonad))(Data_List["null"](v.value0))(Text_Parsing_Parser.fail(dictMonad)(msg(v.value0)));
          });
      };
  };
  var cmd = function (cmds) {
      return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(Text_Parsing_Parser_Combinators.withErrorMessage(Control_Monad_Aff.monadAff)(lookupCmd(cmds))("command"))(function (v) {
          return Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(Control_Monad_Aff.monadAff))(v.value1);
      });
  };
  var arg = function (a) {
      if (a.required) {
          return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(Control_Alt.alt(Text_Parsing_Parser.altParserT(Control_Monad_Aff.monadAff))(token(Control_Monad_Aff.monadAff))(Text_Parsing_Parser.fail(Control_Monad_Aff.monadAff)("Required argument \"" + (a.name + "\" missing."))))(function (v) {
              return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(a.parser(v))(function (v1) {
                  return Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(Control_Monad_Aff.monadAff))(Data_Map.singleton(a.name)(new Data_Maybe.Just(v1)));
              });
          });
      };
      return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(Control_Alt.alt(Text_Parsing_Parser.altParserT(Control_Monad_Aff.monadAff))(Text_Parsing_Parser_Combinators["try"](Control_Monad_Aff.monadAff)(Data_Functor.map(Text_Parsing_Parser.functorParserT(Control_Monad_Aff.functorAff))(Data_Maybe.Just.create)(Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(token(Control_Monad_Aff.monadAff))(a.parser))))(Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(Control_Monad_Aff.monadAff))(Data_Maybe.Nothing.value)))(function (v) {
          return Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(Control_Monad_Aff.monadAff))(Data_Maybe.maybe(Data_Map.empty)(function ($53) {
              return Data_Map.singleton(a.name)(Data_Maybe.Just.create($53));
          })(v));
      });
  };
  var parseArgv = function (globals) {
      return function (commands) {
        
          /**
         *  match a single "-h" or "--help"
         */  
          var unrecognised = function ($54) {
              return (function (v) {
                  return "Unrecognised arguments: " + v;
              })(Data_String.joinWith(", ")(Data_List.toUnfoldable(Data_Unfoldable.unfoldableArray)($54)));
          };
          var matchHelp = Data_Functor["void"](Text_Parsing_Parser.functorParserT(Control_Monad_Aff.functorAff))(when(Control_Monad_Aff.monadAff)(function (v) {
              return Data_Foldable.elem(Data_Foldable.foldableArray)(Data_Eq.eqString)(v)([ "-h", "--help" ]);
          }));
          var helpForCommand = function (command) {
              return Control_Apply.applySecond(Text_Parsing_Parser.applyParserT(Control_Monad_Aff.monadAff))(matchHelp)(Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(Control_Monad_Aff.monadAff))(new Data_Either.Left(command)));
          };
          var defs = Data_Functor.map(Data_Functor.functorArray)(extractDefault);
          var globalDefaults = function (opts) {
              return Data_Map.unions(Data_Ord.ordString)(Data_Foldable.foldableArray)(Data_Semigroup.append(Data_Semigroup.semigroupArray)(opts)(defs(globals)));
          };
          var normalCommand = function (globalOpts) {
              return function (command) {
                  return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(Data_Traversable.traverse(Data_Traversable.traversableArray)(Text_Parsing_Parser.applicativeParserT(Control_Monad_Aff.monadAff))(arg)(command["arguments"]))(function (v) {
                      return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(Data_Array.many(Text_Parsing_Parser.alternativeParserT(Control_Monad_Aff.monadAff))(Text_Parsing_Parser.lazyParserT)(Text_Parsing_Parser_Combinators["try"](Control_Monad_Aff.monadAff)(opt(command.options))))(function (v1) {
                          return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(Text_Parsing_Parser_Combinators.optionMaybe(Control_Monad_Aff.monadAff)(match(Control_Monad_Aff.monadAff)(Data_Eq.eqString)("--")))(function (v2) {
                              return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(Data_Maybe.maybe(Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(Control_Monad_Aff.monadAff))([  ]))(Data_Function["const"](Data_Array.many(Text_Parsing_Parser.alternativeParserT(Control_Monad_Aff.monadAff))(Text_Parsing_Parser.lazyParserT)(token(Control_Monad_Aff.monadAff))))(v2))(function (v3) {
                                  return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(eof(Control_Monad_Aff.monadAff)(unrecognised))(function () {
                                      return Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(Control_Monad_Aff.monadAff))(new Data_Either.Right({
                                          globalOpts: globalOpts, 
                                          command: command, 
                                          commandOpts: Data_Map.unions(Data_Ord.ordString)(Data_Foldable.foldableArray)(Data_Semigroup.append(Data_Semigroup.semigroupArray)(v1)(defs(command.options))), 
                                          commandArgs: Data_Map.unions(Data_Ord.ordString)(Data_Foldable.foldableArray)(v), 
                                          remainder: v3
                                      }));
                                  });
                              });
                          });
                      });
                  });
              };
          };
          return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(Data_Functor.map(Text_Parsing_Parser.functorParserT(Control_Monad_Aff.functorAff))(globalDefaults)(Data_Array.many(Text_Parsing_Parser.alternativeParserT(Control_Monad_Aff.monadAff))(Text_Parsing_Parser.lazyParserT)(Text_Parsing_Parser_Combinators["try"](Control_Monad_Aff.monadAff)(opt(globals)))))(function (v) {
              return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(cmd(commands))(function (v1) {
                  return Control_Alt.alt(Text_Parsing_Parser.altParserT(Control_Monad_Aff.monadAff))(helpForCommand(v1))(normalCommand(v)(v1));
              });
          });
      };
  };
  var parse = function (globals) {
      return function (commands) {
          return function (s) {
              return Text_Parsing_Parser.runParserT(Control_Monad_Aff.monadAff)(Data_List.fromFoldable(Data_Foldable.foldableArray)(s))(parseArgv(globals)(commands));
          };
      };
  };
  exports["arg"] = arg;
  exports["cmd"] = cmd;
  exports["eof"] = eof;
  exports["extractDefault"] = extractDefault;
  exports["halt"] = halt;
  exports["lookup"] = lookup;
  exports["lookupCmd"] = lookupCmd;
  exports["lookupOpt"] = lookupOpt;
  exports["match"] = match;
  exports["matchNamed"] = matchNamed;
  exports["matchOpt"] = matchOpt;
  exports["opt"] = opt;
  exports["parse"] = parse;
  exports["parseArgv"] = parseArgv;
  exports["token"] = token;
  exports["when"] = when;
})(PS["Pulp.Args.Parser"] = PS["Pulp.Args.Parser"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Either = PS["Data.Either"];
  var Data_String = PS["Data.String"];
  var Data_Version = PS["Data.Version"];
  var Data_Show = PS["Data.Show"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Functor = PS["Data.Functor"];
  var Data_Function = PS["Data.Function"];        
  var Major = (function () {
      function Major() {

      };
      Major.value = new Major();
      return Major;
  })();
  var Minor = (function () {
      function Minor() {

      };
      Minor.value = new Minor();
      return Minor;
  })();
  var Patch = (function () {
      function Patch() {

      };
      Patch.value = new Patch();
      return Patch;
  })();
  var ToExact = (function () {
      function ToExact(value0) {
          this.value0 = value0;
      };
      ToExact.create = function (value0) {
          return new ToExact(value0);
      };
      return ToExact;
  })();
  var parseBump = function (str) {
      var $3 = Data_String.toLower(str);
      if ($3 === "major") {
          return new Data_Maybe.Just(Major.value);
      };
      if ($3 === "minor") {
          return new Data_Maybe.Just(Minor.value);
      };
      if ($3 === "patch") {
          return new Data_Maybe.Just(Patch.value);
      };
      return Data_Functor.map(Data_Maybe.functorMaybe)(ToExact.create)(Data_Either.either(Data_Function["const"](Data_Maybe.Nothing.value))(Data_Maybe.Just.create)(Data_Version.parseVersion(str)));
  };
  var applyBump = function (b) {
      if (b instanceof Major) {
          return Data_Version.bumpMajor;
      };
      if (b instanceof Minor) {
          return Data_Version.bumpMinor;
      };
      if (b instanceof Patch) {
          return Data_Version.bumpPatch;
      };
      if (b instanceof ToExact) {
          return Data_Function["const"](b.value0);
      };
      throw new Error("Failed pattern match at Pulp.VersionBump line 28, column 15 - line 32, column 22: " + [ b.constructor.name ]);
  };
  exports["Major"] = Major;
  exports["Minor"] = Minor;
  exports["Patch"] = Patch;
  exports["ToExact"] = ToExact;
  exports["applyBump"] = applyBump;
  exports["parseBump"] = parseBump;
})(PS["Pulp.VersionBump"] = PS["Pulp.VersionBump"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Alt = PS["Control.Alt"];
  var Control_Monad_Trans_Class = PS["Control.Monad.Trans.Class"];
  var Data_String = PS["Data.String"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Int = PS["Data.Int"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Foreign = PS["Data.Foreign"];
  var Text_Parsing_Parser = PS["Text.Parsing.Parser"];
  var Node_FS_Stats = PS["Node.FS.Stats"];
  var Node_FS_Aff = PS["Node.FS.Aff"];
  var Node_Path = PS["Node.Path"];
  var Pulp_Args = PS["Pulp.Args"];
  var Pulp_Args_Parser = PS["Pulp.Args.Parser"];
  var Pulp_VersionBump = PS["Pulp.VersionBump"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Control_Bind = PS["Control.Bind"];
  var Data_Function = PS["Data.Function"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];        

  /**
 *  TODO: this is gross; we end up parsing the version twice. Probably should
 *  fix this by parameterising OptionParsers and ArgumentParsers based on the
 *  type of the thing they parse.
 */  
  var versionBump = function (arg) {
      var $6 = Pulp_VersionBump.parseBump(arg);
      if ($6 instanceof Data_Maybe.Just) {
          return Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(Control_Monad_Aff.monadAff))(Data_Foreign.toForeign(arg));
      };
      if ($6 instanceof Data_Maybe.Nothing) {
          return Text_Parsing_Parser.fail(Control_Monad_Aff.monadAff)("Not a valid version bump. Must be: 'major', 'minor', 'patch', " + "or a version.");
      };
      throw new Error("Failed pattern match at Pulp.Args.Types line 103, column 3 - line 108, column 31: " + [ $6.constructor.name ]);
  };
  var require = function (pred) {
      return function (typ) {
          return function (path) {
              return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(Control_Alt.alt(Text_Parsing_Parser.altParserT(Control_Monad_Aff.monadAff))(Control_Monad_Trans_Class.lift(Text_Parsing_Parser.monadTransParserT)(Control_Monad_Aff.monadAff)(Node_FS_Aff.stat(path)))(Pulp_Args_Parser.halt(typ + (" '" + (path + "' not found.")))))(function (v) {
                  return Control_Applicative.unless(Text_Parsing_Parser.applicativeParserT(Control_Monad_Aff.monadAff))(pred(v))(Pulp_Args_Parser.halt("Path '" + (path + ("' is not a " + (typ + ".")))));
              });
          };
      };
  };
  var requireDirectory = require(Node_FS_Stats.isDirectory)("Directory");
  var requireFile = require(Node_FS_Stats.isFile)("File");
  var flag = {
      name: Data_Maybe.Nothing.value, 
      parser: function (v) {
          return Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(Control_Monad_Aff.monadAff))(Data_Maybe.Nothing.value);
      }
  };
  var argErr = function (arg) {
      return function (msg) {
          return Pulp_Args_Parser.halt("Argument " + (arg + (": " + msg)));
      };
  };
  var directories = {
      name: new Data_Maybe.Just("<dir:dir:...>"), 
      parser: function (arg) {
          return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(Control_Alt.alt(Text_Parsing_Parser.altParserT(Control_Monad_Aff.monadAff))(Pulp_Args_Parser.token(Control_Monad_Aff.monadAff))(argErr(arg)("Needs a directory argument.")))(function (v) {
              var paths$prime = Data_String.split(Node_Path.delimiter)(v);
              return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(Data_Foldable.for_(Text_Parsing_Parser.applicativeParserT(Control_Monad_Aff.monadAff))(Data_Foldable.foldableArray)(paths$prime)(requireDirectory))(function () {
                  return Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(Control_Monad_Aff.monadAff))(new Data_Maybe.Just(Data_Foreign.toForeign(paths$prime)));
              });
          });
      }
  };
  var directory = {
      name: new Data_Maybe.Just("<dir>"), 
      parser: function (arg) {
          return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(Control_Alt.alt(Text_Parsing_Parser.altParserT(Control_Monad_Aff.monadAff))(Pulp_Args_Parser.token(Control_Monad_Aff.monadAff))(argErr(arg)("Needs a directory argument.")))(function (v) {
              return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(requireDirectory(v))(function () {
                  return Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(Control_Monad_Aff.monadAff))(new Data_Maybe.Just(Data_Foreign.toForeign(v)));
              });
          });
      }
  };
  var file = {
      name: new Data_Maybe.Just("<file>"), 
      parser: function (arg) {
          return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(Control_Alt.alt(Text_Parsing_Parser.altParserT(Control_Monad_Aff.monadAff))(Pulp_Args_Parser.token(Control_Monad_Aff.monadAff))(argErr(arg)("Needs a file argument.")))(function (v) {
              return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(requireFile(v))(function () {
                  return Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(Control_Monad_Aff.monadAff))(new Data_Maybe.Just(Data_Foreign.toForeign(v)));
              });
          });
      }
  };
  var $$int = {
      name: new Data_Maybe.Just("<int>"), 
      parser: function (arg) {
          var err = argErr(arg)("Needs an int argument.");
          return Control_Bind.bind(Text_Parsing_Parser.bindParserT(Control_Monad_Aff.monadAff))(Data_Functor.map(Text_Parsing_Parser.functorParserT(Control_Monad_Aff.functorAff))(Data_Int.fromString)(Control_Alt.alt(Text_Parsing_Parser.altParserT(Control_Monad_Aff.monadAff))(Pulp_Args_Parser.token(Control_Monad_Aff.monadAff))(err)))(function (v) {
              if (v instanceof Data_Maybe.Just) {
                  return Control_Applicative.pure(Text_Parsing_Parser.applicativeParserT(Control_Monad_Aff.monadAff))(new Data_Maybe.Just(Data_Foreign.toForeign(v.value0)));
              };
              if (v instanceof Data_Maybe.Nothing) {
                  return err;
              };
              throw new Error("Failed pattern match at Pulp.Args.Types line 53, column 5 - line 55, column 21: " + [ v.constructor.name ]);
          });
      }
  };
  var string = {
      name: new Data_Maybe.Just("<string>"), 
      parser: function (arg) {
          return Data_Functor.map(Text_Parsing_Parser.functorParserT(Control_Monad_Aff.functorAff))(function ($16) {
              return Data_Maybe.Just.create(Data_Foreign.toForeign($16));
          })(Control_Alt.alt(Text_Parsing_Parser.altParserT(Control_Monad_Aff.monadAff))(Pulp_Args_Parser.token(Control_Monad_Aff.monadAff))(argErr(arg)("Needs a string argument.")));
      }
  };
  exports["directories"] = directories;
  exports["directory"] = directory;
  exports["file"] = file;
  exports["flag"] = flag;
  exports["int"] = $$int;
  exports["string"] = string;
  exports["versionBump"] = versionBump;
})(PS["Pulp.Args.Types"] = PS["Pulp.Args.Types"] || {});
(function(exports) {
  // module Pulp.System.Stream
  "use strict";

  exports["concatStreamToBuffer'"] = function concatStream$prime(stream, callback) {
    var concat = require("concat-stream");

    var onSuccess = function(buf) {
      callback(null, buf);
    };

    var onError = function(err) {
      callback(err, null);
    };

    stream.on('error', onError);
    stream.pipe(concat(onSuccess));
  };

  exports.createGzip = require("zlib").createGzip;
})(PS["Pulp.System.Stream"] = PS["Pulp.System.Stream"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Pulp.System.Stream"];
  var Prelude = PS["Prelude"];
  var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
  var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Node_Stream = PS["Node.Stream"];
  var Node_Buffer = PS["Node.Buffer"];
  var Node_Encoding = PS["Node.Encoding"];
  var Unsafe_Coerce = PS["Unsafe.Coerce"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Data_Unit = PS["Data.Unit"];
  var Data_Function = PS["Data.Function"];
  var Control_Bind = PS["Control.Bind"];        
  var write = function (stream) {
      return function (str) {
          return Control_Monad_Aff.makeAff(function (v) {
              return function (done) {
                  return Data_Functor["void"](Control_Monad_Eff.functorEff)(Node_Stream.writeString(stream)(Node_Encoding.UTF8.value)(str)(done(Data_Unit.unit)));
              };
          });
      };
  };                                      
  var end = function (stream) {
      return Control_Monad_Aff.makeAff(function (v) {
          return function (done) {
              return Data_Functor["void"](Control_Monad_Eff.functorEff)(Node_Stream.end(stream)(done(Data_Unit.unit)));
          };
      });
  };
  var concatStreamToBuffer = function (stream) {
      return Pulp_System_FFI.runNode(Data_Function_Uncurried.runFn2($foreign["concatStreamToBuffer'"])(stream));
  };
  var concatStream = function (stream) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(concatStreamToBuffer(stream))(function (v) {
          return Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Node_Buffer.toString(Node_Encoding.UTF8.value)(v));
      });
  };
  exports["concatStream"] = concatStream;
  exports["concatStreamToBuffer"] = concatStreamToBuffer;
  exports["end"] = end;
  exports["write"] = write;
  exports["createGzip"] = $foreign.createGzip;
})(PS["Pulp.System.Stream"] = PS["Pulp.System.Stream"] || {});
(function(exports) {
  // module Pulp.System.SupportsColor
  "use strict";

  // The MIT License (MIT)
  // 
  // Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
  // 
  // Permission is hereby granted, free of charge, to any person obtaining a copy
  // of this software and associated documentation files (the "Software"), to deal
  // in the Software without restriction, including without limitation the rights
  // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  // copies of the Software, and to permit persons to whom the Software is
  // furnished to do so, subject to the following conditions:
  // 
  // The above copyright notice and this permission notice shall be included in
  // all copies or substantial portions of the Software.
  // 
  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  // THE SOFTWARE.

  exports.supportLevel = (function() {
    if (process.stderr && !process.stderr.isTTY) {
      return 0;
    }

    if (process.platform === 'win32') {
      return 1;
    }

    if ('COLORTERM' in process.env) {
      return 1;
    }

    if (process.env.TERM === 'dumb') {
      return 0;
    }

    if (/^xterm-256(?:color)?/.test(process.env.TERM)) {
      return 2;
    }

    if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) {
      return 1;
    }

    return 0;
  })();
})(PS["Pulp.System.SupportsColor"] = PS["Pulp.System.SupportsColor"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Pulp.System.SupportsColor"];
  var Prelude = PS["Prelude"];
  var Data_Ord = PS["Data.Ord"];        
  var hasBasic = $foreign.supportLevel >= 1;
  exports["hasBasic"] = hasBasic;
})(PS["Pulp.System.SupportsColor"] = PS["Pulp.System.SupportsColor"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Ansi_Codes = PS["Ansi.Codes"];
  var Ansi_Output = PS["Ansi.Output"];
  var Node_Process = PS["Node.Process"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Pulp_System_Stream = PS["Pulp.System.Stream"];
  var Pulp_System_SupportsColor = PS["Pulp.System.SupportsColor"];
  var Pulp_Args = PS["Pulp.Args"];
  var Pulp_Args_Get = PS["Pulp.Args.Get"];
  var Data_Function = PS["Data.Function"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Data_Unit = PS["Data.Unit"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Control_Bind = PS["Control.Bind"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_Functor = PS["Data.Functor"];        

  /**
 *  | An outputter which doesn't ever output anything.
 */  
  var nullOutputter = (function () {
      var dud = Data_Function["const"](Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(Data_Unit.unit));
      return {
          log: dud, 
          err: dud, 
          write: dud, 
          bolded: dud, 
          monochrome: false
      };
  })();
  var monochromeOutputter = (function () {
      var monobullet = function (text) {
          return Pulp_System_Stream.write(Node_Process.stderr)("* " + (text + "\n"));
      };
      return {
          log: monobullet, 
          err: monobullet, 
          write: Pulp_System_Stream.write(Node_Process.stderr), 
          bolded: Pulp_System_Stream.write(Node_Process.stderr), 
          monochrome: true
      };
  })();
  var bullet = function (stream) {
      return function (color) {
          return function (text) {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Ansi_Output.withGraphics(Control_Monad_Aff.monadAff)(Pulp_System_Stream.write(stream))(Ansi_Output.foreground(color))("* "))(function () {
                  return Pulp_System_Stream.write(stream)(text + "\n");
              });
          };
      };
  };
  var ansiOutputter = {
      log: bullet(Node_Process.stderr)(Ansi_Codes.Green.value), 
      err: bullet(Node_Process.stderr)(Ansi_Codes.Red.value), 
      write: Pulp_System_Stream.write(Node_Process.stderr), 
      bolded: Ansi_Output.withGraphics(Control_Monad_Aff.monadAff)(Pulp_System_Stream.write(Node_Process.stderr))(Ansi_Output.bold), 
      monochrome: false
  };

  /**
 *  | Get an outputter. The argument represents "monochrome"; if true is
 *  | supplied, the returned logger will never use color. Otherwise, whether or
 *  | not colour is used depends on the "supports-color" module. Note that the
 *  | `monochrome` attribute of the returned outputter might not necessarily
 *  | be the same as the argument supplied.
 */  
  var makeOutputter = function (monochrome) {
      var $1 = !monochrome && Pulp_System_SupportsColor.hasBasic;
      if ($1) {
          return ansiOutputter;
      };
      if (!$1) {
          return monochromeOutputter;
      };
      throw new Error("Failed pattern match at Pulp.Outputter line 42, column 3 - line 44, column 29: " + [ $1.constructor.name ]);
  };

  /**
 *  | Get an outputter, with monochrome based on the command line arguments.
 */  
  var getOutputter = function (args) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getFlag("_silenced")(args.commandOpts))(function (v) {
          if (v) {
              return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(nullOutputter);
          };
          if (!v) {
              return Data_Functor.map(Control_Monad_Aff.functorAff)(makeOutputter)(Pulp_Args_Get.getFlag("monochrome")(args.globalOpts));
          };
          throw new Error("Failed pattern match at Pulp.Outputter line 31, column 3 - line 33, column 64: " + [ v.constructor.name ]);
      });
  };
  exports["getOutputter"] = getOutputter;
  exports["makeOutputter"] = makeOutputter;
})(PS["Pulp.Outputter"] = PS["Pulp.Outputter"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Pulp.Args.Help"];
  var Prelude = PS["Prelude"];
  var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
  var Control_Monad_Except = PS["Control.Monad.Except"];
  var Data_Either = PS["Data.Either"];
  var Data_Array = PS["Data.Array"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_StrMap = PS["Data.StrMap"];
  var Data_String = PS["Data.String"];
  var Data_Traversable = PS["Data.Traversable"];
  var Data_Foreign = PS["Data.Foreign"];
  var Data_Foreign_Class = PS["Data.Foreign.Class"];
  var Node_Process = PS["Node.Process"];
  var Node_Path = PS["Node.Path"];
  var Pulp_Args = PS["Pulp.Args"];
  var Pulp_Args_Types = PS["Pulp.Args.Types"];
  var Pulp_Outputter = PS["Pulp.Outputter"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Partial_Unsafe = PS["Partial.Unsafe"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Function = PS["Data.Function"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Ring = PS["Data.Ring"];
  var Control_Bind = PS["Control.Bind"];
  var Data_Semiring = PS["Data.Semiring"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Data_Show = PS["Data.Show"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];        
  var prepareCmds = (function () {
      var foldCmds = function (n) {
          return Data_StrMap.insert(n.name)(n.desc);
      };
      return Data_Foldable.foldr(Data_Foldable.foldableArray)(foldCmds)(Data_StrMap.empty);
  })();
  var prepareArguments = (function () {
      var formatKey = function (arg) {
          return Data_String.toUpper(arg.name);
      };
      var foldOpts = function (arg) {
          return Data_StrMap.insert(formatKey(arg))(arg.desc);
      };
      return Data_Foldable.foldr(Data_Foldable.foldableArray)(foldOpts)(Data_StrMap.empty);
  })();
  var helpOpt = Pulp_Args.option("help")([ "--help", "-h" ])(Pulp_Args_Types.flag)("Show this help message.");
  var getCommandName = Data_Functor.map(Control_Monad_Eff.functorEff)(function ($26) {
      return Data_Maybe.maybe("pulp")(function ($27) {
          return (function (v) {
              return v.name;
          })(Node_Path.parse($27));
      })((function (v) {
          return Data_Array.index(v)(1);
      })($26));
  })(Node_Process.argv);
  var formatTable = function (table) {
      var headers = Data_Array.sort(Data_Ord.ordString)(Data_StrMap.keys(table));
      var longest = Data_Maybe.fromMaybe(0)(Data_Foldable.maximum(Data_Ord.ordInt)(Data_Foldable.foldableArray)(Data_Functor.mapFlipped(Data_Functor.functorArray)(headers)(Data_String.length)));
      var formatEntry = function (key) {
          return Partial_Unsafe.unsafePartial(function (dictPartial) {
              return (function (entry) {
                  var padding = longest - Data_String.length(key);
                  return function __do() {
                      var v = $foreign.wrap(entry)(longest + 4 | 0)();
                      return "  " + (key + ($foreign.pad(padding + 2 | 0) + (v + "\n")));
                  };
              })(Data_Maybe.fromJust(dictPartial)(Data_StrMap.lookup(key)(table)));
          });
      };
      return function __do() {
          var v = Data_Traversable.sequence(Data_Traversable.traversableArray)(Control_Monad_Eff.applicativeEff)(Data_Functor.mapFlipped(Data_Functor.functorArray)(headers)(formatEntry))();
          return Data_String.joinWith("")(v);
      };
  };
  var formatPassThrough = function (mdesc) {
      var desc = Data_Maybe.fromMaybe("Passthrough options are ignored.")(mdesc);
      return Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)($foreign.wrap("  " + desc)(2));
  };
  var formatCmds = function ($28) {
      return Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(formatTable(prepareCmds($28)));
  };
  var formatArguments = function ($29) {
      return Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(formatTable(prepareArguments($29)));
  };
  var describeOpt = function (opt) {
      var tryDefault = function (def) {
          var $10 = Control_Monad_Except.runExcept(Data_Foreign_Class.read(Data_Foreign_Class.stringIsForeign)(def));
          if ($10 instanceof Data_Either.Right) {
              return new Data_Maybe.Just(Data_Show.show(Data_Show.showString)($10.value0));
          };
          if ($10 instanceof Data_Either.Left) {
              var $12 = Control_Monad_Except.runExcept(Data_Foreign_Class.read(Data_Foreign_Class.intIsForeign)(def));
              if ($12 instanceof Data_Either.Right) {
                  return new Data_Maybe.Just(Data_Show.show(Data_Show.showInt)($12.value0));
              };
              if ($12 instanceof Data_Either.Left) {
                  return Data_Maybe.Nothing.value;
              };
              throw new Error("Failed pattern match at Pulp.Args.Help line 56, column 9 - line 60, column 20: " + [ $12.constructor.name ]);
          };
          throw new Error("Failed pattern match at Pulp.Args.Help line 52, column 5 - line 60, column 20: " + [ $10.constructor.name ]);
      };
      return opt.desc + (function () {
          if (opt.defaultValue instanceof Data_Maybe.Nothing) {
              return "";
          };
          if (opt.defaultValue instanceof Data_Maybe.Just) {
              return Data_Maybe.maybe("")(function (d) {
                  return " [Default: " + (d + "]");
              })(tryDefault(opt.defaultValue.value0));
          };
          throw new Error("Failed pattern match at Pulp.Args.Help line 47, column 19 - line 49, column 74: " + [ opt.defaultValue.constructor.name ]);
      })();
  };
  var prepareOpts = (function () {
      var formatKey = function (n) {
          return Data_String.joinWith(" ")(n.match) + (function () {
              if (n.parser.name instanceof Data_Maybe.Nothing) {
                  return "";
              };
              if (n.parser.name instanceof Data_Maybe.Just) {
                  return " " + n.parser.name.value0;
              };
              throw new Error("Failed pattern match at Pulp.Args.Help line 64, column 23 - line 66, column 33: " + [ n.parser.name.constructor.name ]);
          })();
      };
      var foldOpts = function (n) {
          return Data_StrMap.insert(formatKey(n))(describeOpt(n));
      };
      return Data_Foldable.foldr(Data_Foldable.foldableArray)(foldOpts)(Data_StrMap.empty);
  })();
  var formatOpts = function ($30) {
      return Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(formatTable(prepareOpts($30)));
  };
  var printHelp = function (out) {
      return function (globals) {
          return function (commands) {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(getCommandName))(function (v) {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.write("Usage: " + (v + " [global-options] <command> [command-options]\n")))(function () {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.bolded("\nGlobal options:\n"))(function () {
                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Bind.bind(Control_Monad_Aff.bindAff)(formatOpts(Data_Semigroup.append(Data_Semigroup.semigroupArray)(globals)([ helpOpt ])))(out.write))(function () {
                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.bolded("\nCommands:\n"))(function () {
                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Bind.bind(Control_Monad_Aff.bindAff)(formatCmds(commands))(out.write))(function () {
                                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)($foreign.wrap("Use `" + (v + (" <command> --help` to " + "learn about command specific options.")))(2)))(function (v1) {
                                          return out.write("\n" + (v1 + "\n\n"));
                                      });
                                  });
                              });
                          });
                      });
                  });
              });
          };
      };
  };
  var argumentSynopsis = (function () {
      var format = function (arg) {
          return Data_String.toUpper((function () {
              if (arg.required) {
                  return arg.name;
              };
              if (!arg.required) {
                  return "[" + (arg.name + "]");
              };
              throw new Error("Failed pattern match at Pulp.Args.Help line 96, column 5 - line 101, column 1: " + [ arg.required.constructor.name ]);
          })());
      };
      return function ($31) {
          return Data_String.joinWith(" ")(Data_Functor.map(Data_Functor.functorArray)(format)($31));
      };
  })();
  var printCommandHelp = function (out) {
      return function (globals) {
          return function (command) {
              var hasCommandOpts = !Data_Array["null"](command.options);
              var hasArguments = !Data_Array["null"](command["arguments"]);
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(getCommandName))(function (v) {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.write("Usage: " + (v + (" [global-options] " + (command.name + (" " + ((function () {
                      if (hasArguments) {
                          return argumentSynopsis(command["arguments"]) + " ";
                      };
                      if (!hasArguments) {
                          return "";
                      };
                      throw new Error("Failed pattern match at Pulp.Args.Help line 123, column 20 - line 123, column 90: " + [ hasArguments.constructor.name ]);
                  })() + ((function () {
                      if (hasCommandOpts) {
                          return "[command-options]";
                      };
                      if (!hasCommandOpts) {
                          return "";
                      };
                      throw new Error("Failed pattern match at Pulp.Args.Help line 124, column 20 - line 124, column 70: " + [ hasCommandOpts.constructor.name ]);
                  })() + "\n"))))))))(function () {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.bolded("\nCommand: " + (command.name + "\n")))(function () {
                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.write("  " + (command.desc + "\n")))(function () {
                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Applicative.when(Control_Monad_Aff.applicativeAff)(hasArguments)(Control_Bind.bind(Control_Monad_Aff.bindAff)(out.bolded("\nArguments:\n"))(function () {
                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(formatArguments(command["arguments"]))(out.write);
                              })))(function () {
                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Applicative.when(Control_Monad_Aff.applicativeAff)(hasCommandOpts)(Control_Bind.bind(Control_Monad_Aff.bindAff)(out.bolded("\nCommand options:\n"))(function () {
                                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(formatOpts(command.options))(out.write);
                                  })))(function () {
                                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.bolded("\nGlobal options:\n"))(function () {
                                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Bind.bind(Control_Monad_Aff.bindAff)(formatOpts(Data_Semigroup.append(Data_Semigroup.semigroupArray)(globals)([ helpOpt ])))(out.write))(function () {
                                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.bolded("\nPassthrough options:\n"))(function () {
                                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Bind.bind(Control_Monad_Aff.bindAff)(formatPassThrough(command.passthroughDesc))(out.write))(function () {
                                                      return out.write("\n");
                                                  });
                                              });
                                          });
                                      });
                                  });
                              });
                          });
                      });
                  });
              });
          };
      };
  };
  exports["printCommandHelp"] = printCommandHelp;
  exports["printHelp"] = printHelp;
})(PS["Pulp.Args.Help"] = PS["Pulp.Args.Help"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Either = PS["Data.Either"];
  var Data_String = PS["Data.String"];
  var Data_StrMap = PS["Data.StrMap"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Foldable = PS["Data.Foldable"];
  var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Control_Monad_Aff_AVar = PS["Control.Monad.Aff.AVar"];
  var Data_Posix_Signal = PS["Data.Posix.Signal"];
  var Node_Process = PS["Node.Process"];
  var Node_Platform = PS["Node.Platform"];
  var Node_ChildProcess = PS["Node.ChildProcess"];
  var Unsafe_Coerce = PS["Unsafe.Coerce"];
  var Pulp_System_Stream = PS["Pulp.System.Stream"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Show = PS["Data.Show"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Function = PS["Data.Function"];
  var Data_Boolean = PS["Data.Boolean"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Unit = PS["Data.Unit"];
  var Data_Functor = PS["Data.Functor"];        

  /**
 *  | A slightly weird combination of `onError` and `onExit` into one.
 */  
  var wait = function (child) {
      return Control_Monad_Aff.makeAff(function (v) {
          return function (win) {
              return function __do() {
                  Node_ChildProcess.onExit(child)(function ($33) {
                      return win(Data_Either.Right.create($33));
                  })();
                  return Node_ChildProcess.onError(child)(function ($34) {
                      return win(Data_Either.Left.create($34));
                  })();
              };
          };
      });
  };
  var showExit = function (v) {
      if (v instanceof Node_ChildProcess.Normally) {
          return "with exit code " + Data_Show.show(Data_Show.showInt)(v.value0);
      };
      if (v instanceof Node_ChildProcess.BySignal) {
          return "as a result of receiving " + Data_Show.show(Data_Posix_Signal.showSignal)(v.value0);
      };
      throw new Error("Failed pattern match at Pulp.Exec line 143, column 1 - line 143, column 55: " + [ v.constructor.name ]);
  };
  var handleErrors = function (cmd) {
      return function (retry) {
          return function (err) {
              if (err.code === "ENOENT") {
                  var $13 = Data_Eq.eq(Node_Platform.eqPlatform)(Node_Process.platform)(Node_Platform.Win32.value);
                  if ($13) {
                      var $14 = Data_String.stripSuffix(".cmd")(cmd);
                      if ($14 instanceof Data_Maybe.Nothing) {
                          return retry(cmd + ".cmd");
                      };
                      if ($14 instanceof Data_Maybe.Just) {
                          return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("`" + ($14.value0 + ("` executable not found. (nor `" + (cmd + "`)")))));
                      };
                      throw new Error("Failed pattern match at Pulp.Exec line 151, column 13 - line 155, column 8: " + [ $14.constructor.name ]);
                  };
                  if (!$13) {
                      return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("`" + (cmd + "` executable not found.")));
                  };
                  throw new Error("Failed pattern match at Pulp.Exec line 150, column 6 - line 158, column 3: " + [ $13.constructor.name ]);
              };
              if (Data_Boolean.otherwise) {
                  return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Node_ChildProcess.toStandardError(err));
              };
              throw new Error("Failed pattern match at Pulp.Exec line 147, column 1 - line 159, column 40: " + [ cmd.constructor.name, retry.constructor.name, err.constructor.name ]);
          };
      };
  };
  var execWithStdio = function (stdio) {
      return function (cmd) {
          return function (args) {
              return function (env) {
                  var retry = function (newCmd) {
                      return execWithStdio(stdio)(newCmd)(args)(env);
                  };
                  var onExit = function (exit) {
                      if (exit instanceof Node_ChildProcess.Normally && exit.value0 === 0) {
                          return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(Data_Unit.unit);
                      };
                      return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("Subcommand terminated " + showExit(exit)));
                  };
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Node_ChildProcess.spawn(cmd)(args)((function () {
                      var $18 = {};
                      for (var $19 in Node_ChildProcess.defaultSpawnOptions) {
                          if (Node_ChildProcess.defaultSpawnOptions.hasOwnProperty($19)) {
                              $18[$19] = Node_ChildProcess.defaultSpawnOptions[$19];
                          };
                      };
                      $18.env = env;
                      $18.stdio = stdio;
                      return $18;
                  })())))(function (v) {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(wait(v))(Data_Either.either(handleErrors(cmd)(retry))(onExit));
                  });
              };
          };
      };
  };
  var execQuietWithStderr = function (stderrBehaviour) {
      return function (cmd) {
          return function (args) {
              return function (env) {
                  var retry = function (newCmd) {
                      return execQuietWithStderr(stderrBehaviour)(newCmd)(args)(env);
                  };
                  var onExit = function (outVar) {
                      return function (exit) {
                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Aff_AVar.takeVar(outVar))(function (childOut) {
                              if (exit instanceof Node_ChildProcess.Normally && exit.value0 === 0) {
                                  return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(childOut);
                              };
                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_System_Stream.write(Node_Process.stderr)(childOut))(function () {
                                  return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("Subcommand terminated " + showExit(exit)));
                              });
                          });
                      };
                  };
                  var stdio = [ new Data_Maybe.Just(new Node_ChildProcess.ShareStream(Unsafe_Coerce.unsafeCoerce(Node_Process.stdin))), new Data_Maybe.Just(Node_ChildProcess.Pipe.value), new Data_Maybe.Just(stderrBehaviour) ];
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Node_ChildProcess.spawn(cmd)(args)((function () {
                      var $24 = {};
                      for (var $25 in Node_ChildProcess.defaultSpawnOptions) {
                          if (Node_ChildProcess.defaultSpawnOptions.hasOwnProperty($25)) {
                              $24[$25] = Node_ChildProcess.defaultSpawnOptions[$25];
                          };
                      };
                      $24.env = env;
                      $24.stdio = stdio;
                      return $24;
                  })())))(function (v) {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Aff_AVar.makeVar)(function (v1) {
                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Aff.forkAff(Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_System_Stream.concatStream(Node_ChildProcess.stdout(v)))(Control_Monad_Aff_AVar.putVar(v1))))(function () {
                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(wait(v))(Data_Either.either(handleErrors(cmd)(retry))(onExit(v1)));
                          });
                      });
                  });
              };
          };
      };
  };

  /**
 *  | Same as exec, except instead of relaying stdout immediately, it is
 *  | captured and returned as a String.
 */  
  var execQuiet = execQuietWithStderr(new Node_ChildProcess.ShareStream(Unsafe_Coerce.unsafeCoerce(Node_Process.stderr)));
  var pscBundle = function (files) {
      return function (args) {
          return function (env) {
              return execQuiet("psc-bundle")(Data_Semigroup.append(Data_Semigroup.semigroupArray)(files)(args))(env);
          };
      };
  };

  /**
 *  | Start a child process asynchronously, with the given command line
 *  | arguments and environment, and wait for it to exit.
 *  | On a non-zero exit code, throw an error.
 *  |
 *  | If the executable was not found and we are on Windows, retry with ".cmd"
 *  | appended.
 *  |
 *  | Stdout, stdin, and stderr of the child process are shared with the pulp
 *  | process (that is, data on stdin from pulp is relayed to the child process,
 *  | and any stdout and stderr from the child process are relayed back out by
 *  | pulp, which usually means they will immediately appear in the terminal).
 */  
  var exec = execWithStdio(Node_ChildProcess.inherit);

  /**
 *  | A version of `exec` which installs signal handlers to make sure that the
 *  | signals SIGINT and SIGTERM are relayed to the child process, if received.
 */  
  var execInteractive = function (cmd) {
      return function (args) {
          return function (env) {
              var retry = function (newCmd) {
                  return exec(newCmd)(args)(env);
              };
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Node_ChildProcess.spawn(cmd)(args)((function () {
                  var $29 = {};
                  for (var $30 in Node_ChildProcess.defaultSpawnOptions) {
                      if (Node_ChildProcess.defaultSpawnOptions.hasOwnProperty($30)) {
                          $29[$30] = Node_ChildProcess.defaultSpawnOptions[$30];
                      };
                  };
                  $29.env = env;
                  $29.stdio = Node_ChildProcess.inherit;
                  return $29;
              })())))(function (v) {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Data_Foldable.for_(Control_Monad_Eff.applicativeEff)(Data_Foldable.foldableArray)([ Data_Posix_Signal.SIGTERM.value, Data_Posix_Signal.SIGINT.value ])(function (sig) {
                      return Node_Process.onSignal(sig)(Data_Functor["void"](Control_Monad_Eff.functorEff)(Node_ChildProcess.kill(sig)(v)));
                  })))(function () {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(wait(v))(Data_Either.either(handleErrors(cmd)(retry))(Data_Function["const"](Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(Data_Unit.unit))));
                  });
              });
          };
      };
  };
  var compiler = function (name) {
      return function (deps) {
          return function (args) {
              return function (env) {
                
                  /**
                 *  | Like Node.ChildProcess.inherit except the child process' standard output
                 *  | is sent to Pulp's standard error.
                 */  
                  var inheritButOutToErr = Data_Functor.map(Data_Functor.functorArray)(Data_Maybe.Just.create)([ new Node_ChildProcess.ShareStream(Unsafe_Coerce.unsafeCoerce(Node_Process.stdin)), new Node_ChildProcess.ShareStream(Unsafe_Coerce.unsafeCoerce(Node_Process.stderr)), new Node_ChildProcess.ShareStream(Unsafe_Coerce.unsafeCoerce(Node_Process.stderr)) ]);
                  return execWithStdio(inheritButOutToErr)(name)(Data_Semigroup.append(Data_Semigroup.semigroupArray)(args)(deps))(env);
              };
          };
      };
  };
  var psa = compiler("psa");
  var psc = compiler("psc");
  exports["exec"] = exec;
  exports["execInteractive"] = execInteractive;
  exports["execQuiet"] = execQuiet;
  exports["execQuietWithStderr"] = execQuietWithStderr;
  exports["execWithStdio"] = execWithStdio;
  exports["psa"] = psa;
  exports["psc"] = psc;
  exports["pscBundle"] = pscBundle;
})(PS["Pulp.Exec"] = PS["Pulp.Exec"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Either = PS["Data.Either"];
  var Data_List = PS["Data.List"];
  var Data_String = PS["Data.String"];
  var Data_Version_Haskell = PS["Data.Version.Haskell"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
  var Text_Parsing_Parser = PS["Text.Parsing.Parser"];
  var Pulp_Exec = PS["Pulp.Exec"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Pulp_Outputter = PS["Pulp.Outputter"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_List_Types = PS["Data.List.Types"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Function = PS["Data.Function"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Ord = PS["Data.Ord"];        
  var minimumPscVersion = new Data_Version_Haskell.Version(Data_List.fromFoldable(Data_Foldable.foldableArray)([ 0, 9, 0 ]), Data_List_Types.Nil.value);
  var getPscVersion = function (out) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Data_Functor.map(Control_Monad_Aff.functorAff)(Data_String.trim)(Pulp_Exec.execQuiet("psc")([ "--version" ])(Data_Maybe.Nothing.value)))(function (v) {
          var $3 = Data_Version_Haskell.parseVersion(v);
          if ($3 instanceof Data_Either.Right) {
              return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)($3.value0);
          };
          if ($3 instanceof Data_Either.Left) {
              var msg = Text_Parsing_Parser.parseErrorMessage($3.value0);
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.err("Unable to parse the version from psc. (It was: " + (v + ")")))(function () {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.err("Please check that the right psc is on your PATH."))(function () {
                      return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("Couldn't parse version from psc"));
                  });
              });
          };
          throw new Error("Failed pattern match at Pulp.Validate line 34, column 3 - line 43, column 1: " + [ $3.constructor.name ]);
      });
  };
  var validate = function (out) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(getPscVersion(out))(function (v) {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Applicative.when(Control_Monad_Aff.applicativeAff)(Data_Ord.lessThan(Data_Version_Haskell.ordVersion)(v)(minimumPscVersion))(Control_Bind.bind(Control_Monad_Aff.bindAff)(out.err("This version of Pulp requires version " + (Data_Version_Haskell.showVersion(minimumPscVersion) + (" of the PureScript compiler " + "or higher."))))(function () {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.err("Your installed version is " + (Data_Version_Haskell.showVersion(v) + ".")))(function () {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.err("Please either upgrade PureScript or downgrade Pulp to version 8.x."))(function () {
                      return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("Minimum psc version not satisfied"));
                  });
              });
          })))(function () {
              return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(v);
          });
      });
  };
  exports["validate"] = validate;
})(PS["Pulp.Validate"] = PS["Pulp.Validate"] || {});
(function(exports) {
    "use strict";

  exports.__dirname = __dirname;
  exports.__filename = __filename;
})(PS["Node.Globals"] = PS["Node.Globals"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Node.Globals"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Node_FS = PS["Node.FS"];
  exports["__dirname"] = $foreign.__dirname;
  exports["__filename"] = $foreign.__filename;
})(PS["Node.Globals"] = PS["Node.Globals"] || {});
(function(exports) {
  // module Pulp.System.Which

  "use strict";

  exports["which'"] = require("which");
})(PS["Pulp.System.Which"] = PS["Pulp.System.Which"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Pulp.System.Which"];
  var Prelude = PS["Prelude"];
  var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Data_Function = PS["Data.Function"];        
  var which = function (cmd) {
      return Pulp_System_FFI.runNode(Data_Function_Uncurried.runFn2($foreign["which'"])(cmd));
  };
  exports["which"] = which;
})(PS["Pulp.System.Which"] = PS["Pulp.System.Which"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Either = PS["Data.Either"];
  var Data_String = PS["Data.String"];
  var Data_Version = PS["Data.Version"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
  var Control_Monad_Eff_Console = PS["Control.Monad.Eff.Console"];
  var Control_Monad_Eff_Unsafe = PS["Control.Monad.Eff.Unsafe"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Control_Monad_Eff_Exception_Unsafe = PS["Control.Monad.Eff.Exception.Unsafe"];
  var Control_Monad_Except = PS["Control.Monad.Except"];
  var Node_FS_Sync = PS["Node.FS.Sync"];
  var Node_Encoding = PS["Node.Encoding"];
  var Node_Path = PS["Node.Path"];
  var Data_Foreign = PS["Data.Foreign"];
  var Data_Foreign_Class = PS["Data.Foreign.Class"];
  var Node_Globals = PS["Node.Globals"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Pulp_System_Which = PS["Pulp.System.Which"];
  var Pulp_Exec = PS["Pulp.Exec"];
  var Data_Function = PS["Data.Function"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
  var Data_Identity = PS["Data.Identity"];
  var Data_Foreign_Index = PS["Data.Foreign.Index"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Show = PS["Data.Show"];
  var Data_List_Types = PS["Data.List.Types"];
  var Control_Applicative = PS["Control.Applicative"];
  var Text_Parsing_Parser = PS["Text.Parsing.Parser"];        
  var versionString = Control_Monad_Eff_Unsafe.unsafePerformEff(function __do() {
      var v = Node_FS_Sync.readTextFile(Node_Encoding.UTF8.value)(Node_Path.concat([ Node_Globals.__dirname, "package.json" ]))();
      var $4 = Control_Monad_Except.runExcept(Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Data_Foreign.parseJSON(v))(Data_Foreign_Class.readProp(Data_Foreign_Class.stringIsForeign)(Data_Foreign_Index.indexString)("version")));
      if ($4 instanceof Data_Either.Left) {
          return Control_Monad_Eff_Exception.throwException(Control_Monad_Eff_Exception.error("pulp: Unable to parse package.json: " + Data_Show.show(Data_List_Types.showNonEmptyList(Data_Foreign.showForeignError))($4.value0)))();
      };
      if ($4 instanceof Data_Either.Right) {
          return $4.value0;
      };
      throw new Error("Failed pattern match at Pulp.Version line 38, column 5 - line 42, column 15: " + [ $4.constructor.name ]);
  });
  var version = (function () {
      var $7 = Data_Version.parseVersion(versionString);
      if ($7 instanceof Data_Either.Right) {
          return $7.value0;
      };
      if ($7 instanceof Data_Either.Left) {
          return Control_Monad_Eff_Exception_Unsafe.unsafeThrow("pulp: Unable to parse version from package.json: " + Data_Show.show(Text_Parsing_Parser.showParseError)($7.value0));
      };
      throw new Error("Failed pattern match at Pulp.Version line 29, column 3 - line 32, column 42: " + [ $7.constructor.name ]);
  })();
  var printVersion = Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Exec.execQuiet("psc")([ "--version" ])(Data_Maybe.Nothing.value))(function (v) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Aff.attempt(Pulp_System_Which.which("psc")))(function (v1) {
          return Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Control_Monad_Eff_Console.log("Pulp version " + (Data_Version.showVersion(version) + ("\npsc version " + (Data_String.trim(v) + Data_Either.either(Data_Function["const"](""))(function (p) {
              return " using " + Data_String.trim(p);
          })(v1))))));
      });
  });
  exports["printVersion"] = printVersion;
  exports["version"] = version;
  exports["versionString"] = versionString;
})(PS["Pulp.Version"] = PS["Pulp.Version"] || {});
(function(exports) {
  // module Pulp.System.Files

  "use strict";

  exports.isEEXIST = function isEEXIST(err) {
    return err && err.code === 'EEXIST';
  };

  var temp = require('temp').track();
  exports["openTemp'"] = function openTemp$prime(opts, callback) {
    temp.open(opts, callback);
  };

  exports.createWriteStream = function createWriteStream(path) {
    return function() {
      return require('fs').createWriteStream(path);
    };
  };

  exports.isENOENT = function isENOENT(error) {
    return error.code === "ENOENT";
  };
})(PS["Pulp.System.Files"] = PS["Pulp.System.Files"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Pulp.System.Files"];
  var Prelude = PS["Prelude"];
  var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
  var Data_Maybe = PS["Data.Maybe"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
  var Node_FS = PS["Node.FS"];
  var Node_FS_Aff = PS["Node.FS.Aff"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Pulp_System_Stream = PS["Pulp.System.Stream"];
  var Data_Function = PS["Data.Function"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Data_Unit = PS["Data.Unit"];
  var Control_Applicative = PS["Control.Applicative"];
  var openTemp = function (opts) {
      return Pulp_System_FFI.runNode(Data_Function_Uncurried.runFn2($foreign["openTemp'"])(opts));
  };
  var mkdirIfNotExist = function (dir) {
      return Control_Monad_Error_Class.catchJust(Control_Monad_Aff.monadErrorAff)(function (e) {
          var $0 = $foreign.isEEXIST(e);
          if ($0) {
              return new Data_Maybe.Just(Data_Unit.unit);
          };
          if (!$0) {
              return Data_Maybe.Nothing.value;
          };
          throw new Error("Failed pattern match at Pulp.System.Files line 26, column 20 - line 26, column 61: " + [ $0.constructor.name ]);
      })(Node_FS_Aff.mkdir(dir))(Control_Applicative.pure(Control_Monad_Aff.applicativeAff));
  };
  exports["mkdirIfNotExist"] = mkdirIfNotExist;
  exports["openTemp"] = openTemp;
  exports["createWriteStream"] = $foreign.createWriteStream;
  exports["isENOENT"] = $foreign.isENOENT;
})(PS["Pulp.System.Files"] = PS["Pulp.System.Files"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Either = PS["Data.Either"];
  var Control_Monad_Except = PS["Control.Monad.Except"];
  var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
  var Data_Foreign = PS["Data.Foreign"];
  var Data_Foreign_Class = PS["Data.Foreign.Class"];
  var Node_FS_Aff = PS["Node.FS.Aff"];
  var Node_Encoding = PS["Node.Encoding"];
  var Node_Path = PS["Node.Path"];
  var Node_Process = PS["Node.Process"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Pulp_System_Files = PS["Pulp.System.Files"];
  var Pulp_Args = PS["Pulp.Args"];
  var Pulp_Args_Get = PS["Pulp.Args.Get"];
  var Data_Function = PS["Data.Function"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Show = PS["Data.Show"];
  var Data_List_Types = PS["Data.List.Types"];
  var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
  var Data_Identity = PS["Data.Identity"];
  var Data_Foreign_Index = PS["Data.Foreign.Index"];
  var Data_Eq = PS["Data.Eq"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];        
  var Project = function (x) {
      return x;
  };

  /**
 *  | Read a project's bower file at the given path and construct a Project
 *  | value.
 */  
  var readConfig = function (configFilePath) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Node_FS_Aff.readTextFile(Node_Encoding.UTF8.value)(configFilePath))(function (v) {
          var $8 = Control_Monad_Except.runExcept(Data_Foreign.parseJSON(v));
          if ($8 instanceof Data_Either.Left) {
              return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("Unable to parse bower.json: " + Data_Show.show(Data_List_Types.showNonEmptyList(Data_Foreign.showForeignError))($8.value0)));
          };
          if ($8 instanceof Data_Either.Right) {
              var path = Node_Path.dirname(configFilePath);
              var cachePath = Node_Path.resolve([ path ])(".pulp-cache");
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Node_Process.chdir(path)))(function () {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_System_Files.mkdirIfNotExist(cachePath))(function () {
                      return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)({
                          bowerFile: $8.value0, 
                          cache: cachePath, 
                          path: path
                      });
                  });
              });
          };
          throw new Error("Failed pattern match at Pulp.Project line 52, column 3 - line 60, column 70: " + [ $8.constructor.name ]);
      });
  };
  var isForeignProject = new Data_Foreign_Class.IsForeign(function (o) {
      return Data_Functor.map(Control_Monad_Except_Trans.functorExceptT(Data_Identity.functorIdentity))(Project)(Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Data_Foreign_Class.readProp(Data_Foreign_Class.foreignIsForeign)(Data_Foreign_Index.indexString)("bowerFile")(o))(function (v) {
          return Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Data_Foreign_Class.readProp(Data_Foreign_Class.stringIsForeign)(Data_Foreign_Index.indexString)("path")(o))(function (v1) {
              return Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Data_Foreign_Class.readProp(Data_Foreign_Class.stringIsForeign)(Data_Foreign_Index.indexString)("cache")(o))(function (v2) {
                  return Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))({
                      bowerFile: v, 
                      path: v1, 
                      cache: v2
                  });
              });
          });
      }));
  });
  var findIn = function (path) {
      return function (file) {
          var fullPath = Node_Path.concat([ path, file ]);
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Node_FS_Aff.exists(fullPath))(function (v) {
              if (v) {
                  return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(new Data_Maybe.Just(fullPath));
              };
              if (!v) {
                  var parent = Node_Path.dirname(path);
                  var $16 = path === parent;
                  if ($16) {
                      return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(Data_Maybe.Nothing.value);
                  };
                  if (!$16) {
                      return findIn(parent)(file);
                  };
                  throw new Error("Failed pattern match at Pulp.Project line 43, column 10 - line 45, column 35: " + [ $16.constructor.name ]);
              };
              throw new Error("Failed pattern match at Pulp.Project line 39, column 3 - line 45, column 35: " + [ v.constructor.name ]);
          });
      };
  };

  /**
 *  | Use the provided bower file, or if it is Nothing, try to find a bower file
 *  | path in this or any parent directory.
 */  
  var getBowerFile = (function () {
      var search = Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Node_Process.cwd))(function (v) {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(findIn(v)("bower.json"))(function (v1) {
              if (v1 instanceof Data_Maybe.Just) {
                  return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(v1.value0);
              };
              if (v1 instanceof Data_Maybe.Nothing) {
                  return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("No bower.json found in current or parent directories. Are you in a PureScript project?"));
              };
              throw new Error("Failed pattern match at Pulp.Project line 70, column 5 - line 75, column 1: " + [ v1.constructor.name ]);
          });
      });
      return Data_Maybe.maybe(search)(Control_Applicative.pure(Control_Monad_Aff.applicativeAff));
  })();
  var getProject = function (args) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getOption(Data_Foreign_Class.stringIsForeign)("bowerFile")(args))(getBowerFile))(readConfig);
  };
  exports["Project"] = Project;
  exports["getProject"] = getProject;
  exports["isForeignProject"] = isForeignProject;
})(PS["Pulp.Project"] = PS["Pulp.Project"] || {});
(function(exports) {
  // module Pulp.Init
  "use strict";

  exports.bowerFile = function bowerFile(name) {
    return JSON.stringify({
      name: name,
      ignore: [
        "**/.*",
        "node_modules",
        "bower_components",
        "output"
      ],
      dependencies: {
      },
      devDependencies: {
      },
    }, null, 2) + "\n";
  };
})(PS["Pulp.Init"] = PS["Pulp.Init"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
  var Data_Either = PS["Data.Either"];
  var Data_Maybe = PS["Data.Maybe"];
  var Pulp_Exec = PS["Pulp.Exec"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Pulp_System_Which = PS["Pulp.System.Which"];
  var Control_Bind = PS["Control.Bind"];
  var Data_Function = PS["Data.Function"];        
  var launchBower = function (args) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Aff.attempt(Pulp_System_Which.which("bower")))(function (v) {
          return Data_Either.either(Data_Function["const"](Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("No `bower` executable found.\nPulp no longer bundles Bower. You'll need to install it manually:\n\n   $ npm install -g bower\n"))))(function (e) {
              return Pulp_Exec.exec(e)(args)(Data_Maybe.Nothing.value);
          })(v);
      });
  };
  exports["launchBower"] = launchBower;
})(PS["Pulp.Bower"] = PS["Pulp.Bower"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Pulp.Init"];
  var Prelude = PS["Prelude"];
  var Data_String = PS["Data.String"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
  var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
  var Node_Path = PS["Node.Path"];
  var Node_FS_Aff = PS["Node.FS.Aff"];
  var Node_Encoding = PS["Node.Encoding"];
  var Node_Process = PS["Node.Process"];
  var Data_Traversable = PS["Data.Traversable"];
  var Data_Foldable = PS["Data.Foldable"];
  var Pulp_Outputter = PS["Pulp.Outputter"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Pulp_Args = PS["Pulp.Args"];
  var Pulp_Args_Get = PS["Pulp.Args.Get"];
  var Pulp_System_Files = PS["Pulp.System.Files"];
  var Pulp_Bower = PS["Pulp.Bower"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Data_Function = PS["Data.Function"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Eq = PS["Data.Eq"];        
  var unlines = function (arr) {
      return Data_String.joinWith("\n")(arr) + "\n";
  };
  var testFile = unlines([ "module Test.Main where", "", "import Prelude", "import Control.Monad.Eff (Eff)", "import Control.Monad.Eff.Console (CONSOLE, log)", "", "main :: forall e. Eff (console :: CONSOLE | e) Unit", "main = do", "  log \"You should add some tests.\"" ]);
  var mainFile = unlines([ "module Main where", "", "import Prelude", "import Control.Monad.Eff (Eff)", "import Control.Monad.Eff.Console (CONSOLE, log)", "", "main :: forall e. Eff (console :: CONSOLE | e) Unit", "main = do", "  log \"Hello sailor!\"" ]);
  var gitignore = unlines([ "/bower_components/", "/node_modules/", "/.pulp-cache/", "/output/", "/.psc*", "/.psa*" ]);
  var projectFiles = function (pathRoot) {
      return function (projectName) {
          var fullPath = function (pathParts) {
              return Node_Path.concat(Data_Semigroup.append(Data_Semigroup.semigroupArray)([ pathRoot ])(pathParts));
          };
          return [ {
              path: fullPath([ "bower.json" ]), 
              content: $foreign.bowerFile(projectName)
          }, {
              path: fullPath([ ".gitignore" ]), 
              content: gitignore
          }, {
              path: fullPath([ "src", "Main.purs" ]), 
              content: mainFile
          }, {
              path: fullPath([ "test", "Main.purs" ]), 
              content: testFile
          } ];
      };
  };
  var init = function (force) {
      return function (out) {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Node_Process.cwd))(function (v) {
              var projectName = Node_Path.basename(v);
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.log("Generating project skeleton in " + v))(function () {
                  var files = projectFiles(v)(projectName);
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Applicative.when(Control_Monad_Aff.applicativeAff)(!force)(Data_Foldable.for_(Control_Monad_Aff.applicativeAff)(Data_Foldable.foldableArray)(files)(function (f) {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Node_FS_Aff.exists(f.path))(function (v1) {
                          return Control_Applicative.when(Control_Monad_Aff.applicativeAff)(v1)(Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("Found " + (f.path + (": " + ("There's already a project here. Run `pulp init --force` " + "if you're sure you want to overwrite it."))))));
                      });
                  })))(function () {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Data_Traversable["for"](Control_Monad_Aff.applicativeAff)(Data_Traversable.traversableArray)(files)(function (f) {
                          var dir = Node_Path.dirname(f.path);
                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Applicative.when(Control_Monad_Aff.applicativeAff)(dir !== v)(Pulp_System_Files.mkdirIfNotExist(dir)))(function () {
                              return Node_FS_Aff.writeTextFile(Node_Encoding.UTF8.value)(f.path)(f.content);
                          });
                      }))(function () {
                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Bower.launchBower([ "install", "--save", "purescript-prelude", "purescript-console" ]))(function () {
                              return Pulp_Bower.launchBower([ "install", "--save-dev", "purescript-psci-support" ]);
                          });
                      });
                  });
              });
          });
      };
  };
  var action = function (args) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getFlag("force")(args.commandOpts))(function (v) {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Outputter.getOutputter(args))(function (v1) {
              return init(v)(v1);
          });
      });
  };
  exports["action"] = action;
})(PS["Pulp.Init"] = PS["Pulp.Init"] || {});
(function(exports) {
  // module Pulp.Files

  "use strict";

  exports["glob'"] = function glob$prime(pat, callback) {
    require("glob")(pat, {}, callback);
  };
})(PS["Pulp.Files"] = PS["Pulp.Files"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Pulp.Files"];
  var Prelude = PS["Prelude"];
  var Data_Array = PS["Data.Array"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
  var Data_Foreign_Class = PS["Data.Foreign.Class"];
  var Data_List = PS["Data.List"];
  var Data_Set = PS["Data.Set"];
  var Data_Traversable = PS["Data.Traversable"];
  var Node_Path = PS["Node.Path"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Pulp_Args = PS["Pulp.Args"];
  var Pulp_Args_Get = PS["Pulp.Args.Get"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Unfoldable = PS["Data.Unfoldable"];
  var Data_Functor = PS["Data.Functor"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Ord = PS["Data.Ord"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Control_Bind = PS["Control.Bind"];
  var Data_Function = PS["Data.Function"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Category = PS["Control.Category"];
  var Data_List_Types = PS["Data.List.Types"];        
  var recursiveGlobWithExtension = function (ext) {
      return function ($7) {
          return Data_Functor.map(Data_Functor.functorArray)(function (v) {
              return v + ("/**/*." + ext);
          })(Data_Set.toUnfoldable(Data_Unfoldable.unfoldableArray)($7));
      };
  };
  var sources = recursiveGlobWithExtension("purs");
  var outputModules = function (buildPath) {
      return [ buildPath + "/*/*.js" ];
  };
  var includeGlobs = function (opts) {
      var mkSet = function ($8) {
          return Data_Set.fromFoldable(Data_Foldable.foldableArray)(Data_Ord.ordString)(Data_Maybe.fromMaybe([  ])($8));
      };
      return Data_Functor.map(Control_Monad_Aff.functorAff)(mkSet)(Pulp_Args_Get.getOption(Data_Foreign_Class.arrayIsForeign(Data_Foreign_Class.stringIsForeign))("includePaths")(opts));
  };
  var globsFromOption$prime = function (dictIsForeign) {
      return function (f) {
          return function (name) {
              return function (opts) {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getOption(dictIsForeign)(name)(opts))(function (v) {
                      return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)((function () {
                          if (v instanceof Data_Maybe.Just) {
                              return Data_Set.singleton(f(v.value0));
                          };
                          if (v instanceof Data_Maybe.Nothing) {
                              return Data_Set.empty;
                          };
                          throw new Error("Failed pattern match at Pulp.Files line 43, column 3 - line 45, column 31: " + [ v.constructor.name ]);
                      })());
                  });
              };
          };
      };
  };
  var globsFromOption = function (dictIsForeign) {
      return globsFromOption$prime(dictIsForeign)(Control_Category.id(Control_Category.categoryFn));
  };
  var localGlobs = globsFromOption(Data_Foreign_Class.stringIsForeign)("srcPath");
  var testGlobs = globsFromOption(Data_Foreign_Class.stringIsForeign)("testPath");
  var glob = function (pattern) {
      return Pulp_System_FFI.runNode(Data_Function_Uncurried.runFn2($foreign["glob'"])(pattern));
  };
  var resolveGlobs = function (patterns) {
      return Data_Functor.map(Control_Monad_Aff.functorAff)(Data_Array.concat)(Data_Traversable.traverse(Data_Traversable.traversableArray)(Control_Monad_Aff.applicativeAff)(glob)(patterns));
  };
  var ffis = recursiveGlobWithExtension("js");
  var dependencyGlobs = globsFromOption$prime(Data_Foreign_Class.stringIsForeign)(function (path) {
      return Node_Path.concat([ path, "purescript-*", "src" ]);
  })("dependencyPath");
  var defaultGlobs = function (opts) {
      return Data_Functor.map(Control_Monad_Aff.functorAff)(Data_Set.unions(Data_List_Types.foldableList)(Data_Ord.ordString))(Data_Traversable.sequence(Data_List_Types.traversableList)(Control_Monad_Aff.applicativeAff)(Data_List.fromFoldable(Data_Foldable.foldableArray)([ localGlobs(opts), dependencyGlobs(opts), includeGlobs(opts) ])));
  };
  exports["defaultGlobs"] = defaultGlobs;
  exports["dependencyGlobs"] = dependencyGlobs;
  exports["ffis"] = ffis;
  exports["glob"] = glob;
  exports["includeGlobs"] = includeGlobs;
  exports["localGlobs"] = localGlobs;
  exports["outputModules"] = outputModules;
  exports["resolveGlobs"] = resolveGlobs;
  exports["sources"] = sources;
  exports["testGlobs"] = testGlobs;
})(PS["Pulp.Files"] = PS["Pulp.Files"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Either = PS["Data.Either"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Map = PS["Data.Map"];
  var Data_String = PS["Data.String"];
  var Data_Set = PS["Data.Set"];
  var Data_Foldable = PS["Data.Foldable"];
  var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Node_Process = PS["Node.Process"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Pulp_System_Stream = PS["Pulp.System.Stream"];
  var Pulp_Outputter = PS["Pulp.Outputter"];
  var Pulp_System_Files = PS["Pulp.System.Files"];
  var Pulp_System_Which = PS["Pulp.System.Which"];
  var Pulp_Args = PS["Pulp.Args"];
  var Pulp_Args_Get = PS["Pulp.Args.Get"];
  var Pulp_Exec = PS["Pulp.Exec"];
  var Pulp_Files = PS["Pulp.Files"];
  var Data_Eq = PS["Data.Eq"];
  var Control_Bind = PS["Control.Bind"];
  var Data_Foreign_Class = PS["Data.Foreign.Class"];
  var Data_Function = PS["Data.Function"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Functor = PS["Data.Functor"];
  var Data_Monoid = PS["Data.Monoid"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Control_Apply = PS["Control.Apply"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Show = PS["Data.Show"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];        
  var NormalBuild = (function () {
      function NormalBuild() {

      };
      NormalBuild.value = new NormalBuild();
      return NormalBuild;
  })();
  var TestBuild = (function () {
      function TestBuild() {

      };
      TestBuild.value = new TestBuild();
      return TestBuild;
  })();

  /**
 *  | Get a writable stream which output should be written to, based on the
 *  | value of the 'to' option.
 */  
  var withOutputStream = function (opts) {
      return function (aff) {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getOption(Data_Foreign_Class.stringIsForeign)("to")(opts))(function (v) {
              if (v instanceof Data_Maybe.Just) {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Pulp_System_Files.createWriteStream(v.value0)))(function (v1) {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(aff(v1))(function () {
                          return Pulp_System_Stream.end(v1);
                      });
                  });
              };
              if (v instanceof Data_Maybe.Nothing) {
                  return aff(Node_Process.stdout);
              };
              throw new Error("Failed pattern match at Pulp.Build line 121, column 3 - line 127, column 19: " + [ v.constructor.name ]);
          });
      };
  };
  var eqBuildType = new Data_Eq.Eq(function (v) {
      return function (v1) {
          if (v instanceof NormalBuild && v1 instanceof NormalBuild) {
              return true;
          };
          if (v instanceof TestBuild && v1 instanceof TestBuild) {
              return true;
          };
          return false;
      };
  });
  var bundle = function (args) {
      var parseModulesOption = Data_Maybe.maybe([  ])(Data_String.split(","));
      var opts = Data_Map.union(Data_Ord.ordString)(args.globalOpts)(args.commandOpts);
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Outputter.getOutputter(args))(function (v) {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(v.log("Bundling JavaScript..."))(function () {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("main")(opts))(function (v1) {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Data_Functor.map(Control_Monad_Aff.functorAff)(parseModulesOption)(Pulp_Args_Get.getOption(Data_Foreign_Class.stringIsForeign)("modules")(opts)))(function (v2) {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("buildPath")(opts))(function (v3) {
                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getFlag("skipEntryPoint")(opts))(function (v4) {
                              var bundleArgs = Data_Foldable.fold(Data_Foldable.foldableArray)(Data_Monoid.monoidArray)([ [ "--module=" + v1 ], (function () {
                                  if (v4) {
                                      return [  ];
                                  };
                                  if (!v4) {
                                      return [ "--main=" + v1 ];
                                  };
                                  throw new Error("Failed pattern match at Pulp.Build line 101, column 11 - line 101, column 56: " + [ v4.constructor.name ]);
                              })(), Data_Functor.map(Data_Functor.functorArray)(function (m) {
                                  return "--module=" + m;
                              })(v2), args.remainder ]);
                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Exec.pscBundle(Pulp_Files.outputModules(v3))(bundleArgs)(Data_Maybe.Nothing.value))(function (v5) {
                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(withOutputStream(opts)(function (out$prime) {
                                      return Pulp_System_Stream.write(out$prime)(v5);
                                  }))(function () {
                                      return v.log("Bundled.");
                                  });
                              });
                          });
                      });
                  });
              });
          });
      });
  };
  var go = function (buildType) {
      return function (args) {
          var opts = Data_Map.union(Data_Ord.ordString)(args.globalOpts)(args.commandOpts);
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Outputter.getOutputter(args))(function (v) {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Node_Process.cwd))(function (v1) {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(v.log("Building project in " + v1))(function () {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Apply.apply(Control_Monad_Aff.applyAff)(Data_Functor.map(Control_Monad_Aff.functorAff)(Data_Set.union(Data_Ord.ordString))(Pulp_Files.defaultGlobs(opts)))((function () {
                          var $35 = Data_Eq.eq(eqBuildType)(buildType)(TestBuild.value);
                          if ($35) {
                              return Pulp_Files.testGlobs(opts);
                          };
                          if (!$35) {
                              return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(Data_Set.empty);
                          };
                          throw new Error("Failed pattern match at Pulp.Build line 54, column 27 - line 56, column 48: " + [ $35.constructor.name ]);
                      })()))(function (v2) {
                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("buildPath")(args.commandOpts))(function (v3) {
                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getFlag("noPsa")(args.commandOpts))(function (v4) {
                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getOption(Data_Foreign_Class.intIsForeign)("jobs")(args.commandOpts))(function (v5) {
                                      var jobsArgs = Data_Maybe.maybe([  ])(function (j) {
                                          return [ "+RTS", "-N" + Data_Show.show(Data_Show.showInt)(j), "-RTS" ];
                                      })(v5);
                                      var sourceGlobs = Pulp_Files.sources(v2);
                                      var binArgs = Data_Semigroup.append(Data_Semigroup.semigroupArray)([ "-o", v3 ])(Data_Semigroup.append(Data_Semigroup.semigroupArray)(jobsArgs)(args.remainder));
                                      var runPsc = Pulp_Exec.psc(sourceGlobs)(binArgs)(Data_Maybe.Nothing.value);
                                      return Control_Bind.bind(Control_Monad_Aff.bindAff)((function () {
                                          if (v4) {
                                              return runPsc;
                                          };
                                          if (!v4) {
                                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Aff.attempt(Pulp_System_Which.which("psa")))(function (v6) {
                                                  if (v6 instanceof Data_Either.Left) {
                                                      return runPsc;
                                                  };
                                                  if (v6 instanceof Data_Either.Right) {
                                                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getFlag("monochrome")(args.globalOpts))(function (v7) {
                                                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("dependencyPath")(args.commandOpts))(function (v8) {
                                                              var binArgs$prime = Data_Semigroup.append(Data_Semigroup.semigroupArray)(binArgs)(Data_Semigroup.append(Data_Semigroup.semigroupArray)([ "--is-lib=" + v8 ])((function () {
                                                                  if (v7) {
                                                                      return [ "--monochrome" ];
                                                                  };
                                                                  if (!v7) {
                                                                      return [  ];
                                                                  };
                                                                  throw new Error("Failed pattern match at Pulp.Build line 77, column 38 - line 79, column 47: " + [ v7.constructor.name ]);
                                                              })()));
                                                              return Pulp_Exec.psa(sourceGlobs)(binArgs$prime)(Data_Maybe.Nothing.value);
                                                          });
                                                      });
                                                  };
                                                  throw new Error("Failed pattern match at Pulp.Build line 71, column 7 - line 80, column 43: " + [ v6.constructor.name ]);
                                              });
                                          };
                                          throw new Error("Failed pattern match at Pulp.Build line 67, column 3 - line 80, column 43: " + [ v4.constructor.name ]);
                                      })())(function () {
                                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(v.log("Build successful."))(function () {
                                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Apply.apply(Control_Monad_Aff.applyAff)(Data_Functor.map(Control_Monad_Aff.functorAff)(Data_HeytingAlgebra.disj(Data_HeytingAlgebra.heytingAlgebraBoolean))(Pulp_Args_Get.getFlag("optimise")(opts)))(Pulp_Args_Get.hasOption("to")(opts)))(function (v6) {
                                                  return Control_Applicative.when(Control_Monad_Aff.applicativeAff)(v6)(bundle(args));
                                              });
                                          });
                                      });
                                  });
                              });
                          });
                      });
                  });
              });
          });
      };
  };
  var testBuild = Pulp_Args.runAction(go(TestBuild.value));
  var action = go(NormalBuild.value);
  var build = Pulp_Args.runAction(action);
  exports["action"] = action;
  exports["build"] = build;
  exports["testBuild"] = testBuild;
  exports["withOutputStream"] = withOutputStream;
})(PS["Pulp.Build"] = PS["Pulp.Build"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Map = PS["Data.Map"];
  var Data_StrMap = PS["Data.StrMap"];
  var Data_String = PS["Data.String"];
  var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
  var Node_Path = PS["Node.Path"];
  var Node_FS_Aff = PS["Node.FS.Aff"];
  var Node_Buffer = PS["Node.Buffer"];
  var Node_Encoding = PS["Node.Encoding"];
  var Node_Process = PS["Node.Process"];
  var Pulp_Args = PS["Pulp.Args"];
  var Pulp_Args_Get = PS["Pulp.Args.Get"];
  var Pulp_Exec = PS["Pulp.Exec"];
  var Pulp_Files = PS["Pulp.Files"];
  var Pulp_Outputter = PS["Pulp.Outputter"];
  var Pulp_System_Files = PS["Pulp.System.Files"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Data_Function = PS["Data.Function"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Foreign_Class = PS["Data.Foreign.Class"];        
  var prependPath = function (newPath) {
      return function (paths) {
          return Data_Maybe.Just.create((function () {
              if (paths instanceof Data_Maybe.Nothing) {
                  return newPath;
              };
              if (paths instanceof Data_Maybe.Just) {
                  return newPath + (Node_Path.delimiter + paths.value0);
              };
              throw new Error("Failed pattern match at Pulp.Run line 61, column 3 - line 63, column 46: " + [ paths.constructor.name ]);
          })());
      };
  };

  /**
 *  | Given a build path, create an environment that is just like this process'
 *  | environment, except with NODE_PATH set up for commands like `pulp run`.
 */  
  var setupEnv = function (buildPath) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Node_Process.getEnv))(function (v) {
          return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(Data_StrMap.alter(prependPath(Node_Path.resolve([  ])(buildPath)))("NODE_PATH")(v));
      });
  };

  /**
 *  | Escape a string for insertion into a JS string literal.
 */  
  var jsEscape = function ($22) {
      return Data_String.replace("'")("\\'")(Data_String.replace("\\")("\\\\")($22));
  };

  /**
 *  | Construct a JS string to be used as an entry point from a module name.
 */  
  var makeEntry = function (main) {
      return "require('" + (jsEscape(main) + "').main();\n");
  };
  var action = function (args) {
      var opts = Data_Map.union(Data_Ord.ordString)(args.globalOpts)(args.commandOpts);
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Outputter.getOutputter(args))(function (v) {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Node_Process.cwd))(function (v1) {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(v.log("Building project in" + v1))(function () {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Files.defaultGlobs(opts))(function (v2) {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("buildPath")(opts))(function (v3) {
                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Exec.psc(Pulp_Files.sources(v2))([ "-o", v3 ])(Data_Maybe.Nothing.value))(function () {
                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(v.log("Build successful."))(function () {
                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("main")(opts))(function (v4) {
                                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Node_Buffer.fromString(makeEntry(v4))(Node_Encoding.UTF8.value)))(function (v5) {
                                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_System_Files.openTemp({
                                              prefix: "pulp-run", 
                                              suffix: ".js"
                                          }))(function (v6) {
                                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Node_FS_Aff.fdAppend(v6.fd)(v5))(function () {
                                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Node_FS_Aff.fdClose(v6.fd))(function () {
                                                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("runtime")(opts))(function (v7) {
                                                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(setupEnv(v3))(function (v8) {
                                                              return Pulp_Exec.exec(v7)(Data_Semigroup.append(Data_Semigroup.semigroupArray)([ v6.path ])(args.remainder))(new Data_Maybe.Just(v8));
                                                          });
                                                      });
                                                  });
                                              });
                                          });
                                      });
                                  });
                              });
                          });
                      });
                  });
              });
          });
      });
  };
  exports["action"] = action;
  exports["jsEscape"] = jsEscape;
  exports["makeEntry"] = makeEntry;
  exports["prependPath"] = prependPath;
  exports["setupEnv"] = setupEnv;
})(PS["Pulp.Run"] = PS["Pulp.Run"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Map = PS["Data.Map"];
  var Data_Foreign = PS["Data.Foreign"];
  var Pulp_Outputter = PS["Pulp.Outputter"];
  var Pulp_Args = PS["Pulp.Args"];
  var Pulp_Args_Get = PS["Pulp.Args.Get"];
  var Pulp_Exec = PS["Pulp.Exec"];
  var Pulp_Build = PS["Pulp.Build"];
  var Pulp_Run = PS["Pulp.Run"];
  var Data_Ord = PS["Data.Ord"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Data_Foreign_Class = PS["Data.Foreign.Class"];
  var Data_Eq = PS["Data.Eq"];
  var Control_Category = PS["Control.Category"];
  var Data_Semigroup = PS["Data.Semigroup"];        
  var action = function (args) {
      var opts = Data_Map.union(Data_Ord.ordString)(args.globalOpts)(args.commandOpts);
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Outputter.getOutputter(args))(function (v) {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("runtime")(opts))(function (v1) {
              var isNode = v1 === "node";
              var changeOpts = (function () {
                  if (isNode) {
                      return Control_Category.id(Control_Category.categoryFn);
                  };
                  if (!isNode) {
                      return Data_Map.insert(Data_Ord.ordString)("to")(new Data_Maybe.Just(Data_Foreign.toForeign("./output/test.js")));
                  };
                  throw new Error("Failed pattern match at Pulp.Test line 25, column 20 - line 27, column 80: " + [ isNode.constructor.name ]);
              })();
              var buildArgs = (function () {
                  var $9 = {};
                  for (var $10 in args) {
                      if (args.hasOwnProperty($10)) {
                          $9[$10] = args[$10];
                      };
                  };
                  $9.remainder = [  ];
                  $9.commandOpts = changeOpts(args.commandOpts);
                  return $9;
              })();
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Build.testBuild(buildArgs))(function () {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(v.log("Running tests..."))(function () {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)((function () {
                          if (isNode) {
                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("main")(opts))(function (v2) {
                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("buildPath")(opts))(function (v3) {
                                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Run.setupEnv(v3))(function (v4) {
                                          return Pulp_Exec.exec(v1)(Data_Semigroup.append(Data_Semigroup.semigroupArray)([ "-e", "require('" + (v2 + "').main()") ])(args.remainder))(new Data_Maybe.Just(v4));
                                      });
                                  });
                              });
                          };
                          if (!isNode) {
                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("to")(buildArgs.commandOpts))(function (v2) {
                                  return Pulp_Exec.exec(v1)(Data_Semigroup.append(Data_Semigroup.semigroupArray)([ v2 ])(args.remainder))(Data_Maybe.Nothing.value);
                              });
                          };
                          throw new Error("Failed pattern match at Pulp.Test line 35, column 3 - line 45, column 52: " + [ isNode.constructor.name ]);
                      })())(function () {
                          return v.log("Tests OK.");
                      });
                  });
              });
          });
      });
  };
  exports["action"] = action;
})(PS["Pulp.Test"] = PS["Pulp.Test"] || {});
(function(exports) {
  // module Pulp.Browserify

  "use strict";

  function write(input, output, callback) {
    var pipe = require("through")();
    input.pipe(pipe);
    pipe.pipe(output, {end: false});
    pipe.on("end", callback);
  }

  exports["browserifyBundle'"] = function browserifyBundle$prime(opts, callback) {
    var StringStream = require("string-stream");
    var browserify = require("browserify");

    var b = browserify({
      basedir: opts.basedir,
      entries: new StringStream(opts.src),
      standalone: opts.standalone
    });
    if (opts.transform) b.transform(opts.transform);
    write(b.bundle(), opts.out, callback);
  };

  exports["browserifyIncBundle'"] = function browserifyIncBundle$prime(opts, callback) {
    var browserifyInc = require("browserify-incremental");

    var b = browserifyInc({
      basedir: opts.buildPath,
      cacheFile: opts.cachePath,
      standalone: opts.standalone
    });
    b.add(opts.path);
    if (opts.transform) b.transform(opts.transform);
    write(b.bundle(), opts.out, callback);
  };
})(PS["Pulp.Browserify"] = PS["Pulp.Browserify"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Pulp.Browserify"];
  var Prelude = PS["Prelude"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
  var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Map = PS["Data.Map"];
  var Data_Nullable = PS["Data.Nullable"];
  var Node_Path = PS["Node.Path"];
  var Node_Encoding = PS["Node.Encoding"];
  var Node_FS_Aff = PS["Node.FS.Aff"];
  var Node_Process = PS["Node.Process"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Pulp_System_Stream = PS["Pulp.System.Stream"];
  var Pulp_Outputter = PS["Pulp.Outputter"];
  var Pulp_Args = PS["Pulp.Args"];
  var Pulp_Args_Get = PS["Pulp.Args.Get"];
  var Pulp_Exec = PS["Pulp.Exec"];
  var Pulp_Files = PS["Pulp.Files"];
  var Pulp_Build = PS["Pulp.Build"];
  var Pulp_Run = PS["Pulp.Run"];
  var Pulp_Project = PS["Pulp.Project"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Data_Function = PS["Data.Function"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Ord = PS["Data.Ord"];
  var Data_Foreign_Class = PS["Data.Foreign.Class"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];        

  /**
 *  | Given the build path, modify this process' NODE_PATH environment variable
 *  | for browserify.
 */  
  var setupNodePath = function (buildPath) {
      return function __do() {
          var v = Node_Process.lookupEnv("NODE_PATH")();
          var buildPath$prime = Node_Path.resolve([  ])(buildPath);
          return Node_Process.setEnv("NODE_PATH")((function () {
              if (v instanceof Data_Maybe.Just) {
                  return buildPath$prime + (Node_Path.delimiter + v.value0);
              };
              if (v instanceof Data_Maybe.Nothing) {
                  return buildPath$prime;
              };
              throw new Error("Failed pattern match at Pulp.Browserify line 138, column 3 - line 141, column 28: " + [ v.constructor.name ]);
          })())();
      };
  };
  var makeOptExport = function (main) {
      return "module.exports = PS[\"" + (Pulp_Run.jsEscape(main) + "\"];\n");
  };
  var makeExport = function (main) {
      return function ($$export) {
          if ($$export) {
              return "module.exports = require(\"" + (Pulp_Run.jsEscape(main) + "\");\n");
          };
          if (!$$export) {
              return Pulp_Run.makeEntry(main);
          };
          throw new Error("Failed pattern match at Pulp.Browserify line 43, column 3 - line 45, column 22: " + [ $$export.constructor.name ]);
      };
  };
  var browserifyIncBundle = function (opts) {
      return Pulp_System_FFI.runNode(Data_Function_Uncurried.runFn2($foreign["browserifyIncBundle'"])(opts));
  };
  var incremental = function (args) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Outputter.getOutputter(args))(function (v) {
          var munge = Data_Map["delete"](Data_Ord.ordString)("to");
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Build.build((function () {
              var $26 = {};
              for (var $27 in args) {
                  if (args.hasOwnProperty($27)) {
                      $26[$27] = args[$27];
                  };
              };
              $26.commandOpts = munge(args.commandOpts);
              return $26;
          })()))(function () {
              var opts = Data_Map.union(Data_Ord.ordString)(args.globalOpts)(args.commandOpts);
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(v.log("Browserifying..."))(function () {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("buildPath")(opts))(function (v1) {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(setupNodePath(v1)))(function () {
                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getFlag("force")(opts))(function (v2) {
                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Pulp_Project.isForeignProject)("_project")(opts))(function (v3) {
                                  var cachePath = Node_Path.resolve([ v3.cache ])("browserify.json");
                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Applicative.when(Control_Monad_Aff.applicativeAff)(v2)(Control_Monad_Aff.apathize(Node_FS_Aff.unlink(cachePath))))(function () {
                                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getOption(Data_Foreign_Class.stringIsForeign)("transform")(opts))(function (v4) {
                                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getOption(Data_Foreign_Class.stringIsForeign)("standalone")(opts))(function (v5) {
                                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getFlag("skipEntryPoint")(opts))(function (v6) {
                                                  var skipEntryPoint = v6 && Data_Maybe.isNothing(v5);
                                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("main")(opts))(function (v7) {
                                                      return Control_Bind.bind(Control_Monad_Aff.bindAff)((function () {
                                                          if (skipEntryPoint) {
                                                              return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(Node_Path.concat([ v1, v7 ]));
                                                          };
                                                          if (!skipEntryPoint) {
                                                              var entryJs = makeExport(v7)(Data_Maybe.isJust(v5));
                                                              var entryPath = Node_Path.concat([ v1, "browserify.js" ]);
                                                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Node_FS_Aff.writeTextFile(Node_Encoding.UTF8.value)(entryPath)(entryJs))(function () {
                                                                  return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(entryPath);
                                                              });
                                                          };
                                                          throw new Error("Failed pattern match at Pulp.Browserify line 113, column 11 - line 120, column 29: " + [ skipEntryPoint.constructor.name ]);
                                                      })())(function (v8) {
                                                          return Pulp_Build.withOutputStream(opts)(function (out$prime) {
                                                              return browserifyIncBundle({
                                                                  basedir: v1, 
                                                                  cacheFile: cachePath, 
                                                                  path: v8, 
                                                                  transform: Data_Nullable.toNullable(v4), 
                                                                  standalone: Data_Nullable.toNullable(v5), 
                                                                  out: out$prime
                                                              });
                                                          });
                                                      });
                                                  });
                                              });
                                          });
                                      });
                                  });
                              });
                          });
                      });
                  });
              });
          });
      });
  };
  var browserifyBundle = function (opts) {
      return Pulp_System_FFI.runNode(Data_Function_Uncurried.runFn2($foreign["browserifyBundle'"])(opts));
  };
  var optimising = function (args) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Outputter.getOutputter(args))(function (v) {
          var munge = function ($55) {
              return Data_Map["delete"](Data_Ord.ordString)("optimise")(Data_Map["delete"](Data_Ord.ordString)("to")($55));
          };
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Build.build((function () {
              var $39 = {};
              for (var $40 in args) {
                  if (args.hasOwnProperty($40)) {
                      $39[$40] = args[$40];
                  };
              };
              $39.commandOpts = munge(args.commandOpts);
              return $39;
          })()))(function () {
              var opts = Data_Map.union(Data_Ord.ordString)(args.globalOpts)(args.commandOpts);
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Files.defaultGlobs(opts))(function (v1) {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("buildPath")(opts))(function (v2) {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("main")(opts))(function (v3) {
                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getOption(Data_Foreign_Class.stringIsForeign)("transform")(opts))(function (v4) {
                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getOption(Data_Foreign_Class.stringIsForeign)("standalone")(opts))(function (v5) {
                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getFlag("skipEntryPoint")(opts))(function (v6) {
                                      var skipEntryPoint = v6 || Data_Maybe.isJust(v5);
                                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Exec.pscBundle(Pulp_Files.outputModules(v2))(Data_Semigroup.append(Data_Semigroup.semigroupArray)([ "--module=" + v3 ])((function () {
                                          if (skipEntryPoint) {
                                              return [  ];
                                          };
                                          if (!skipEntryPoint) {
                                              return Data_Semigroup.append(Data_Semigroup.semigroupArray)([ "--main=" + v3 ])(args.remainder);
                                          };
                                          throw new Error("Failed pattern match at Pulp.Browserify line 68, column 27 - line 72, column 44: " + [ skipEntryPoint.constructor.name ]);
                                      })()))(Data_Maybe.Nothing.value))(function (v7) {
                                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(v.log("Browserifying..."))(function () {
                                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(setupNodePath(v2)))(function () {
                                                  return Pulp_Build.withOutputStream(opts)(function (out$prime) {
                                                      return browserifyBundle({
                                                          basedir: Node_Path.resolve([  ])(v2), 
                                                          src: v7 + (function () {
                                                              var $50 = Data_Maybe.isJust(v5);
                                                              if ($50) {
                                                                  return makeOptExport(v3);
                                                              };
                                                              if (!$50) {
                                                                  return "";
                                                              };
                                                              throw new Error("Failed pattern match at Pulp.Browserify line 82, column 14 - line 83, column 7: " + [ $50.constructor.name ]);
                                                          })(), 
                                                          transform: Data_Nullable.toNullable(v4), 
                                                          standalone: Data_Nullable.toNullable(v5), 
                                                          out: out$prime
                                                      });
                                                  });
                                              });
                                          });
                                      });
                                  });
                              });
                          });
                      });
                  });
              });
          });
      });
  };
  var action = function (args) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Outputter.getOutputter(args))(function (v) {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Node_Process.cwd))(function (v1) {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(v.log("Browserifying project in " + v1))(function () {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getFlag("optimise")(args.commandOpts))(function (v2) {
                      var act = (function () {
                          if (v2) {
                              return optimising;
                          };
                          if (!v2) {
                              return incremental;
                          };
                          throw new Error("Failed pattern match at Pulp.Browserify line 35, column 13 - line 35, column 57: " + [ v2.constructor.name ]);
                      })();
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args.runAction(act)(args))(function () {
                          return v.log("Browserified.");
                      });
                  });
              });
          });
      });
  };
  exports["action"] = action;
  exports["browserifyBundle"] = browserifyBundle;
  exports["browserifyIncBundle"] = browserifyIncBundle;
  exports["incremental"] = incremental;
  exports["makeExport"] = makeExport;
  exports["makeOptExport"] = makeOptExport;
  exports["optimising"] = optimising;
  exports["setupNodePath"] = setupNodePath;
})(PS["Pulp.Browserify"] = PS["Pulp.Browserify"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Tuple = PS["Data.Tuple"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Array = PS["Data.Array"];
  var Data_Set = PS["Data.Set"];
  var Data_Map = PS["Data.Map"];
  var Data_String = PS["Data.String"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Traversable = PS["Data.Traversable"];
  var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
  var Node_FS_Aff = PS["Node.FS.Aff"];
  var Node_Encoding = PS["Node.Encoding"];
  var Node_Process = PS["Node.Process"];
  var Pulp_Args = PS["Pulp.Args"];
  var Pulp_Args_Get = PS["Pulp.Args.Get"];
  var Pulp_Exec = PS["Pulp.Exec"];
  var Pulp_Files = PS["Pulp.Files"];
  var Pulp_Outputter = PS["Pulp.Outputter"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Functor = PS["Data.Functor"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_Eq = PS["Data.Eq"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Control_Bind = PS["Control.Bind"];
  var Data_Function = PS["Data.Function"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Ord = PS["Data.Ord"];
  var Control_Apply = PS["Control.Apply"];
  var Data_Monoid = PS["Data.Monoid"];        
  var showModuleName = Data_String.joinWith(".");

  /**
 *  | Given a line in a PureScript source file, attempt to extract its name.
 */  
  var moduleNameFromLine = function ($29) {
      return Data_Functor.map(Data_Maybe.functorMaybe)(function ($30) {
          return Data_String.split(".")(Data_String.takeWhile(function ($31) {
              return !(function (v) {
                  return Data_Foldable.elem(Data_Foldable.foldableArray)(Data_Eq.eqChar)(v)([ " ", "(" ]);
              })($31);
          })($30));
      })(Data_String.stripPrefix("module ")($29));
  };

  /**
 *  | Given a PureScript source file path, extract its module name (or throw
 *  | an error).
 */  
  var extractModuleName = function (path) {
      var go = function ($32) {
          return (function ($33) {
              return Data_Array.head(Data_Array.catMaybes($33));
          })(Data_Functor.map(Data_Functor.functorArray)(moduleNameFromLine)(Data_String.split("\n")($32)));
      };
      return Data_Functor.map(Control_Monad_Aff.functorAff)(go)(Node_FS_Aff.readTextFile(Node_Encoding.UTF8.value)(path));
  };

  /**
 *  | Given a module name, return the file path where its documentation should
 *  | be written to.
 */  
  var docPath = function (mn) {
      return "docs/" + (Data_String.joinWith("/")(mn) + ".md");
  };

  /**
 *  | Given a file path to be included in the documentation, return a --docgen
 *  | argument for it, to be passsed to psc-docs.
 */  
  var makeDocgen = function (path) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(extractModuleName(path))(function (v) {
          return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)((function () {
              if (v instanceof Data_Maybe.Just) {
                  return new Data_Tuple.Tuple([ "--docgen", showModuleName(v.value0) + (":" + docPath(v.value0)) ], [  ]);
              };
              if (v instanceof Data_Maybe.Nothing) {
                  return new Data_Tuple.Tuple([  ], [ path ]);
              };
              throw new Error("Failed pattern match at Pulp.Docs line 62, column 3 - line 66, column 22: " + [ v.constructor.name ]);
          })());
      });
  };
  var action = function (args) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Outputter.getOutputter(args))(function (v) {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Node_Process.cwd))(function (v1) {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(v.log("Generating documentation in " + v1))(function () {
                  var opts = Data_Map.union(Data_Ord.ordString)(args.globalOpts)(args.commandOpts);
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getFlag("withTests")(opts))(function (v2) {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getFlag("withDependencies")(opts))(function (v3) {
                          var includeWhen = function (b) {
                              return function (act) {
                                  if (b) {
                                      return act;
                                  };
                                  if (!b) {
                                      return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(Data_Set.empty);
                                  };
                                  throw new Error("Failed pattern match at Pulp.Docs line 37, column 27 - line 37, column 60: " + [ b.constructor.name ]);
                              };
                          };
                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Apply.apply(Control_Monad_Aff.applyAff)(Data_Functor.map(Control_Monad_Aff.functorAff)(Data_Set.union(Data_Ord.ordString))(includeWhen(v2)(Pulp_Files.testGlobs(opts))))(includeWhen(v3)(Pulp_Files.dependencyGlobs(opts))))(function (v4) {
                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Data_Functor.map(Control_Monad_Aff.functorAff)(Data_Set.union(Data_Ord.ordString)(v4))(Pulp_Files.defaultGlobs(opts)))(function (v5) {
                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Data_Functor.map(Control_Monad_Aff.functorAff)(Data_Set.union(Data_Ord.ordString)(v4))(Pulp_Files.localGlobs(opts)))(function (v6) {
                                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Files.resolveGlobs(Pulp_Files.sources(v6)))(function (v7) {
                                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Data_Functor.map(Control_Monad_Aff.functorAff)(Data_Foldable.fold(Data_Foldable.foldableArray)(Data_Tuple.monoidTuple(Data_Monoid.monoidArray)(Data_Monoid.monoidArray)))(Data_Traversable.traverse(Data_Traversable.traversableArray)(Control_Monad_Aff.applicativeAff)(makeDocgen)(v7)))(function (v8) {
                                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Applicative.unless(Control_Monad_Aff.applicativeAff)(Data_Array["null"](v8.value1))(Control_Bind.bind(Control_Monad_Aff.bindAff)(v.err("Unable to extract module name from the following modules:"))(function () {
                                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Data_Foldable.for_(Control_Monad_Aff.applicativeAff)(Data_Foldable.foldableArray)(v8.value1)(function ($34) {
                                                      return v.log((function (v9) {
                                                          return "  " + v9;
                                                      })($34));
                                                  }))(function () {
                                                      return v.err("This may be a bug.");
                                                  });
                                              })))(function () {
                                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Exec.execQuiet("psc-docs")(Data_Semigroup.append(Data_Semigroup.semigroupArray)(args.remainder)(Data_Semigroup.append(Data_Semigroup.semigroupArray)(Pulp_Files.sources(v5))(v8.value0)))(Data_Maybe.Nothing.value))(function (v9) {
                                                      return v.log("Documentation generated.");
                                                  });
                                              });
                                          });
                                      });
                                  });
                              });
                          });
                      });
                  });
              });
          });
      });
  };
  exports["action"] = action;
  exports["docPath"] = docPath;
  exports["extractModuleName"] = extractModuleName;
  exports["makeDocgen"] = makeDocgen;
  exports["moduleNameFromLine"] = moduleNameFromLine;
  exports["showModuleName"] = showModuleName;
})(PS["Pulp.Docs"] = PS["Pulp.Docs"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Map = PS["Data.Map"];
  var Data_Set = PS["Data.Set"];
  var Pulp_Args = PS["Pulp.Args"];
  var Pulp_Exec = PS["Pulp.Exec"];
  var Pulp_Files = PS["Pulp.Files"];
  var Data_Ord = PS["Data.Ord"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Control_Apply = PS["Control.Apply"];
  var Data_Functor = PS["Data.Functor"];
  var Data_Semigroup = PS["Data.Semigroup"];        
  var action = function (args) {
      var opts = Data_Map.union(Data_Ord.ordString)(args.globalOpts)(args.commandOpts);
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Apply.apply(Control_Monad_Aff.applyAff)(Data_Functor.map(Control_Monad_Aff.functorAff)(Data_Set.union(Data_Ord.ordString))(Pulp_Files.defaultGlobs(opts)))(Pulp_Files.testGlobs(opts)))(function (v) {
          return Pulp_Exec.execInteractive("psci")(Data_Semigroup.append(Data_Semigroup.semigroupArray)(Pulp_Files.sources(v))(args.remainder))(Data_Maybe.Nothing.value);
      });
  };
  exports["action"] = action;
})(PS["Pulp.Psci"] = PS["Pulp.Psci"] || {});
(function(exports) {
    "use strict";

  exports["new"] = function(path) {
    return function() {
      var s = require('node-static');
      return new s.Server(path);
    };
  };

  exports.serve = function(server) {
    return function(req) {
      return function(res) {
        return function() {
          server.serve(req, res);
        };
      };
    };
  };

  exports.serveFile = function(server) {
    return function(file) {
      return function(statusCode) {
        return function(req) {
          return function(res) {
            return function() {
              server.serveFile(file, statusCode, {}, req, res);
            };
          };
        };
      };
    };
  };
})(PS["Pulp.System.StaticServer"] = PS["Pulp.System.StaticServer"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Pulp.System.StaticServer"];
  var Prelude = PS["Prelude"];
  var Node_HTTP = PS["Node.HTTP"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  exports["new"] = $foreign["new"];
  exports["serve"] = $foreign.serve;
  exports["serveFile"] = $foreign.serveFile;
})(PS["Pulp.System.StaticServer"] = PS["Pulp.System.StaticServer"] || {});
(function(exports) {
  // module Pulp.Watch

  "use strict";

  exports.watch = function watch(directories) {
    return function(act) {
      return function() {
        var Watchpack = require("watchpack");
        var watchpack = new Watchpack();
        watchpack.watch([], directories, Date.now() - 10000);
        watchpack.on("change", function(path) {
          act(path)();
        });
      };
    };
  };

  exports.minimatch = function(str) {
    return function(glob) {
      return require("minimatch")(str, glob);
    };
  };
})(PS["Pulp.Watch"] = PS["Pulp.Watch"] || {});
(function(exports) {
  // module Pulp.System.TreeKill
  "use strict";

  exports.treeKill = function treeKill(pid) {
    return function(signal) {
      return function() {
        require("tree-kill")(pid, signal);
      };
    };
  };
})(PS["Pulp.System.TreeKill"] = PS["Pulp.System.TreeKill"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Pulp.System.TreeKill"];
  var Prelude = PS["Prelude"];
  var Data_Posix = PS["Data.Posix"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  exports["treeKill"] = $foreign.treeKill;
})(PS["Pulp.System.TreeKill"] = PS["Pulp.System.TreeKill"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Pulp.Watch"];
  var Prelude = PS["Prelude"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Array = PS["Data.Array"];
  var Data_Set = PS["Data.Set"];
  var Data_Map = PS["Data.Map"];
  var Data_Foldable = PS["Data.Foldable"];
  var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Control_Monad_Aff_AVar = PS["Control.Monad.Aff.AVar"];
  var Node_Process = PS["Node.Process"];
  var Node_Globals = PS["Node.Globals"];
  var Node_ChildProcess = PS["Node.ChildProcess"];
  var Pulp_Args = PS["Pulp.Args"];
  var Pulp_Args_Get = PS["Pulp.Args.Get"];
  var Pulp_Files = PS["Pulp.Files"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Pulp_System_TreeKill = PS["Pulp.System.TreeKill"];
  var Pulp_Outputter = PS["Pulp.Outputter"];
  var Unsafe_Coerce = PS["Unsafe.Coerce"];
  var Control_Bind = PS["Control.Bind"];
  var Data_Foreign_Class = PS["Data.Foreign.Class"];
  var Data_Functor = PS["Data.Functor"];
  var Data_Function = PS["Data.Function"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Data_Ord = PS["Data.Ord"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Eq = PS["Data.Eq"];
  var Control_Apply = PS["Control.Apply"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];        
  var watchDirectories = function (opts) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("srcPath")(opts))(function (v) {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("testPath")(opts))(function (v1) {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("dependencyPath")(opts))(function (v2) {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Data_Functor.map(Control_Monad_Aff.functorAff)(Data_Maybe.fromMaybe([  ]))(Pulp_Args_Get.getOption(Data_Foreign_Class.arrayIsForeign(Data_Foreign_Class.stringIsForeign))("includePaths")(opts)))(function (v3) {
                      return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(Data_Semigroup.append(Data_Semigroup.semigroupArray)([ v, v1, v2 ])(v3));
                  });
              });
          });
      });
  };
  var removeErrLabel = Unsafe_Coerce.unsafeCoerce;
  var watchAff = function (dirs) {
      return function (callback) {
          return Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)($foreign.watch(dirs)(function (path) {
              return Data_Functor["void"](Control_Monad_Eff.functorEff)(Control_Monad_Aff.launchAff(removeErrLabel(callback(path))));
          }));
      };
  };
  var action = function (args) {
      var opts = Data_Map.union(Data_Ord.ordString)(args.globalOpts)(args.commandOpts);
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Outputter.getOutputter(args))(function (v) {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Data_Functor.map(Control_Monad_Eff.functorEff)(function ($21) {
              return Data_Array.filter(function (v1) {
                  return Data_Foldable.notElem(Data_Foldable.foldableArray)(Data_Eq.eqString)(v1)([ "-w", "--watch" ]);
              })(Data_Array.drop(2)($21));
          })(Node_Process.argv)))(function (v1) {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Aff_AVar.makeVar)(function (v2) {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Node_ChildProcess.fork(Node_Globals.__filename)(v1)))(Control_Monad_Aff_AVar.putVar(v2)))(function () {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(watchDirectories(opts))(function (v3) {
                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Apply.apply(Control_Monad_Aff.applyAff)(Data_Functor.map(Control_Monad_Aff.functorAff)(Data_Set.union(Data_Ord.ordString))(Pulp_Files.defaultGlobs(opts)))(Pulp_Files.testGlobs(opts)))(function (v4) {
                              var fileGlobs = Data_Semigroup.append(Data_Semigroup.semigroupArray)(Pulp_Files.sources(v4))(Pulp_Files.ffis(v4));
                              return watchAff(v3)(function (path) {
                                  return Control_Applicative.when(Control_Monad_Aff.applicativeAff)(Data_Foldable.any(Data_Foldable.foldableArray)(Data_HeytingAlgebra.heytingAlgebraBoolean)($foreign.minimatch(path))(fileGlobs))(Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Aff_AVar.takeVar(v2))(function (v5) {
                                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Pulp_System_TreeKill.treeKill(Node_ChildProcess.pid(v5))("SIGTERM")))(function () {
                                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(v.log("Source tree changed; restarting:"))(function () {
                                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Node_ChildProcess.fork(Node_Globals.__filename)(v1)))(Control_Monad_Aff_AVar.putVar(v2));
                                          });
                                      });
                                  }));
                              });
                          });
                      });
                  });
              });
          });
      });
  };
  exports["action"] = action;
  exports["removeErrLabel"] = removeErrLabel;
  exports["watchAff"] = watchAff;
  exports["watchDirectories"] = watchDirectories;
})(PS["Pulp.Watch"] = PS["Pulp.Watch"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Either = PS["Data.Either"];
  var Data_Map = PS["Data.Map"];
  var Data_Foreign = PS["Data.Foreign"];
  var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Control_Monad_Aff_AVar = PS["Control.Monad.Aff.AVar"];
  var Node_HTTP = PS["Node.HTTP"];
  var Node_Encoding = PS["Node.Encoding"];
  var Node_Stream = PS["Node.Stream"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Pulp_System_StaticServer = PS["Pulp.System.StaticServer"];
  var Pulp_Outputter = PS["Pulp.Outputter"];
  var Pulp_Args = PS["Pulp.Args"];
  var Pulp_Args_Get = PS["Pulp.Args.Get"];
  var Pulp_Watch = PS["Pulp.Watch"];
  var Pulp_Build = PS["Pulp.Build"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Ord = PS["Data.Ord"];
  var Control_Category = PS["Control.Category"];
  var Data_Unit = PS["Data.Unit"];
  var Data_Functor = PS["Data.Functor"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Foreign_Class = PS["Data.Foreign.Class"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Data_Function = PS["Data.Function"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Show = PS["Data.Show"];        
  var Succeeded = (function () {
      function Succeeded() {

      };
      Succeeded.value = new Succeeded();
      return Succeeded;
  })();
  var Failed = (function () {
      function Failed() {

      };
      Failed.value = new Failed();
      return Failed;
  })();
  var rebuildWith = function (v) {
      return function (args) {
          var addExtras = function ($41) {
              return (function () {
                  if (v.quiet) {
                      return Data_Map.insert(Data_Ord.ordString)("_silenced")(Data_Maybe.Nothing.value);
                  };
                  if (!v.quiet) {
                      return Control_Category.id(Control_Category.categoryFn);
                  };
                  throw new Error("Failed pattern match at Pulp.Server line 104, column 5 - line 105, column 59: " + [ v.quiet.constructor.name ]);
              })()(Data_Map.insert(Data_Ord.ordString)("to")(new Data_Maybe.Just(Data_Foreign.toForeign(v.bundleFileName)))($41));
          };
          return Pulp_Build.build((function () {
              var $18 = {};
              for (var $19 in args) {
                  if (args.hasOwnProperty($19)) {
                      $18[$19] = args[$19];
                  };
              };
              $18.commandOpts = addExtras(args.commandOpts);
              return $18;
          })());
      };
  };
  var listen = function (server) {
      return function (opts) {
          return Control_Monad_Aff.makeAff(function (v) {
              return function (done) {
                  return Node_HTTP.listen(server)(opts)(done(Data_Unit.unit));
              };
          });
      };
  };
  var getBundleFileName = function (opts) {
      return Data_Functor.map(Control_Monad_Aff.functorAff)(function (v) {
          return v + "/app.js";
      })(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("buildPath")(opts));
  };
  var createServer = function (rebuildV) {
      return function (bundleFileName) {
          return function __do() {
              var v = Pulp_System_StaticServer["new"](".")();
              return Node_HTTP.createServer(function (req) {
                  return function (res) {
                      var $25 = Node_HTTP.requestURL(req);
                      if ($25 === "/app.js") {
                          return Data_Functor["void"](Control_Monad_Eff.functorEff)(Pulp_System_FFI.unsafeToEffN(Control_Monad_Aff.launchAff(Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Aff_AVar.peekVar(rebuildV))(function (v1) {
                              return Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)((function () {
                                  if (v1 instanceof Succeeded) {
                                      return Pulp_System_StaticServer.serveFile(v)(bundleFileName)(200)(req)(res);
                                  };
                                  if (v1 instanceof Failed) {
                                      return function __do() {
                                          Node_HTTP.setStatusCode(res)(400)();
                                          Node_HTTP.setStatusMessage(res)("Rebuild failed")();
                                          var resS = Node_HTTP.responseAsStream(res);
                                          return Data_Functor["void"](Control_Monad_Eff.functorEff)(Node_Stream.writeString(resS)(Node_Encoding.UTF8.value)("Compile error in pulp server")(Node_Stream.end(resS)(Control_Applicative.pure(Control_Monad_Eff.applicativeEff)(Data_Unit.unit))))();
                                      };
                                  };
                                  throw new Error("Failed pattern match at Pulp.Server line 80, column 11 - line 89, column 46: " + [ v1.constructor.name ]);
                              })());
                          }))));
                      };
                      return Pulp_System_StaticServer.serve(v)(req)(res);
                  };
              })();
          };
      };
  };
  var action = function (args) {
      var opts = Data_Map.union(Data_Ord.ordString)(args.globalOpts)(args.commandOpts);
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Outputter.getOutputter(args))(function (v) {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(getBundleFileName(opts))(function (v1) {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("host")(opts))(function (v2) {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.intIsForeign)("port")(opts))(function (v3) {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Aff_AVar.makeVar)(function (v4) {
                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(createServer(v4)(v1)))(function (v5) {
                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(listen(v5)({
                                  hostname: v2, 
                                  port: v3, 
                                  backlog: Data_Maybe.Nothing.value
                              }))(function () {
                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(v.log("Server listening on http://" + (v2 + (":" + (Data_Show.show(Data_Show.showInt)(v3) + "/")))))(function () {
                                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getFlag("quiet")(opts))(function (v6) {
                                          var rebuild = Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Aff.attempt(rebuildWith({
                                              bundleFileName: v1, 
                                              quiet: v6
                                          })(args)))(function (v7) {
                                              if (v7 instanceof Data_Either.Right) {
                                                  return Control_Monad_Aff_AVar.putVar(v4)(Succeeded.value);
                                              };
                                              if (v7 instanceof Data_Either.Left) {
                                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Aff_AVar.putVar(v4)(Failed.value))(function () {
                                                      return v.err("Failed to rebuild; try to fix the compile errors");
                                                  });
                                              };
                                              throw new Error("Failed pattern match at Pulp.Server line 57, column 9 - line 63, column 3: " + [ v7.constructor.name ]);
                                          });
                                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(rebuild)(function () {
                                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Watch.watchDirectories(opts))(function (v7) {
                                                  return Pulp_Watch.watchAff(v7)(function (v8) {
                                                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Data_Functor["void"](Control_Monad_Aff.functorAff)(Control_Monad_Aff_AVar.takeVar(v4)))(function () {
                                                          return rebuild;
                                                      });
                                                  });
                                              });
                                          });
                                      });
                                  });
                              });
                          });
                      });
                  });
              });
          });
      });
  };
  exports["action"] = action;
})(PS["Pulp.Server"] = PS["Pulp.Server"] || {});
(function(exports) {
    "use strict";
  var http =require("http");
  var https =require("https"); 

  exports.requestImpl = function (opts) {
    return function (k) {
      return function () {
        var lib = opts.protocol === "https:" ? https : http;
        return lib.request(opts, function (res) {
          k(res)();
        });
      };
    };
  };
})(PS["Node.HTTP.Client"] = PS["Node.HTTP.Client"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Node.HTTP.Client"];
  var Prelude = PS["Prelude"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Data_Foreign = PS["Data.Foreign"];
  var Data_Functor_Contravariant = PS["Data.Functor.Contravariant"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Options = PS["Data.Options"];
  var Data_StrMap = PS["Data.StrMap"];
  var Node_HTTP = PS["Node.HTTP"];
  var Node_Stream = PS["Node.Stream"];
  var Node_URL = PS["Node.URL"];
  var Unsafe_Coerce = PS["Unsafe.Coerce"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Function = PS["Data.Function"];
  var Data_Op = PS["Data.Op"];
  var statusMessage = function ($6) {
      return (function (v) {
          return v.statusMessage;
      })(Unsafe_Coerce.unsafeCoerce($6));
  };
  var statusCode = function ($7) {
      return (function (v) {
          return v.statusCode;
      })(Unsafe_Coerce.unsafeCoerce($7));
  };
  var responseAsStream = Unsafe_Coerce.unsafeCoerce;
  var requestAsStream = Unsafe_Coerce.unsafeCoerce;
  var request = function ($9) {
      return $foreign.requestImpl(Data_Options.options($9));
  };                                                              
  var protocol = Data_Options.opt("protocol");
  var path = Data_Options.opt("path");
  var method = Data_Options.opt("method");
  var hostname = Data_Options.opt("hostname");
  var headers = Data_Options.opt("headers");
  exports["headers"] = headers;
  exports["hostname"] = hostname;
  exports["method"] = method;
  exports["path"] = path;
  exports["protocol"] = protocol;
  exports["request"] = request;
  exports["requestAsStream"] = requestAsStream;
  exports["responseAsStream"] = responseAsStream;
  exports["statusCode"] = statusCode;
  exports["statusMessage"] = statusMessage;
})(PS["Node.HTTP.Client"] = PS["Node.HTTP.Client"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Options = PS["Data.Options"];
  var Node_Buffer = PS["Node.Buffer"];
  var Node_HTTP_Client = PS["Node.HTTP.Client"];
  var Node_Stream = PS["Node.Stream"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Unit = PS["Data.Unit"];        
  var httpRequest = function (reqOptions) {
      return function (reqBody) {
          var maybeWrite = function (v) {
              return function (v1) {
                  return function (next) {
                      if (v1 instanceof Data_Maybe.Just) {
                          return Data_Functor["void"](Control_Monad_Eff.functorEff)(Node_Stream.write(v)(v1.value0)(next));
                      };
                      if (v1 instanceof Data_Maybe.Nothing) {
                          return next;
                      };
                      throw new Error("Failed pattern match at Pulp.System.HTTP line 23, column 3 - line 23, column 76: " + [ v.constructor.name, v1.constructor.name, next.constructor.name ]);
                  };
              };
          };
          return Control_Monad_Aff.makeAff(function (err) {
              return function (done) {
                  return function __do() {
                      var v = Node_HTTP_Client.request(reqOptions)(done)();
                      var reqStream = Node_HTTP_Client.requestAsStream(v);
                      Node_Stream.onError(reqStream)(err)();
                      return maybeWrite(reqStream)(reqBody)(Node_Stream.end(reqStream)(Control_Applicative.pure(Control_Monad_Eff.applicativeEff)(Data_Unit.unit)))();
                  };
              };
          });
      };
  };
  exports["httpRequest"] = httpRequest;
})(PS["Pulp.System.HTTP"] = PS["Pulp.System.HTTP"] || {});
(function(exports) {
  // module Pulp.System.Read

  "use strict";

  exports["read'"] = require("read");
})(PS["Pulp.System.Read"] = PS["Pulp.System.Read"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Pulp.System.Read"];
  var Prelude = PS["Prelude"];
  var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Data_Function = PS["Data.Function"];        
  var read = function (opts) {
      return Pulp_System_FFI.runNode(Data_Function_Uncurried.runFn2($foreign["read'"])(opts));
  };
  exports["read"] = read;
})(PS["Pulp.System.Read"] = PS["Pulp.System.Read"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
  var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
  var Control_Monad_Except = PS["Control.Monad.Except"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Tuple_Nested = PS["Data.Tuple.Nested"];
  var Data_Either = PS["Data.Either"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Foreign = PS["Data.Foreign"];
  var Data_Foreign_Class = PS["Data.Foreign.Class"];
  var Data_String = PS["Data.String"];
  var Data_StrMap = PS["Data.StrMap"];
  var Data_Options = PS["Data.Options"];
  var Node_Process = PS["Node.Process"];
  var Node_Platform = PS["Node.Platform"];
  var Node_Path = PS["Node.Path"];
  var Node_FS_Aff = PS["Node.FS.Aff"];
  var Node_FS_Perms = PS["Node.FS.Perms"];
  var Node_Encoding = PS["Node.Encoding"];
  var Node_HTTP_Client = PS["Node.HTTP.Client"];
  var Pulp_System_HTTP = PS["Pulp.System.HTTP"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Pulp_System_Stream = PS["Pulp.System.Stream"];
  var Pulp_System_Read = PS["Pulp.System.Read"];
  var Pulp_Outputter = PS["Pulp.Outputter"];
  var Pulp_Args = PS["Pulp.Args"];
  var Pulp_Version = PS["Pulp.Version"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Data_Functor = PS["Data.Functor"];
  var Data_Foreign_Index = PS["Data.Foreign.Index"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Unit = PS["Data.Unit"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Control_Apply = PS["Control.Apply"];
  var Data_Semiring = PS["Data.Semiring"];
  var Data_Tuple = PS["Data.Tuple"];
  var Data_Function = PS["Data.Function"];
  var Data_Show = PS["Data.Show"];
  var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
  var Data_Identity = PS["Data.Identity"];
  var Data_List_Types = PS["Data.List.Types"];        
  var obtainTokenFromStdin = function (out) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.write("Please obtain a GitHub personal access token at:\n"))(function () {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.write("  https://github.com/settings/tokens/new\n"))(function () {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.write("No scopes are required, so don't check any of the boxes.\n"))(function () {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.write("\n"))(function () {
                      return Data_Functor.map(Control_Monad_Aff.functorAff)(Data_String.trim)(Pulp_System_Read.read({
                          prompt: "After you've done that, paste it in here: ", 
                          silent: true
                      }));
                  });
              });
          });
      });
  };
  var mkdirIfNotExist = function (dirname) {
      return Control_Monad_Error_Class.catchError(Control_Monad_Aff.monadErrorAff)(Node_FS_Aff.mkdir(dirname))(function (v) {
          var code = Data_Foreign_Class.readProp(Data_Foreign_Class.stringIsForeign)(Data_Foreign_Index.indexString)("code")(Data_Foreign.toForeign(v));
          var $8 = Control_Monad_Except.runExcept(code);
          if ($8 instanceof Data_Either.Right && $8.value0 === "EEXIST") {
              return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(Data_Unit.unit);
          };
          return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(v);
      });
  };
  var getHome = (function () {
      var homeVar = (function () {
          var $10 = Data_Eq.eq(Node_Platform.eqPlatform)(Node_Process.platform)(Node_Platform.Win32.value);
          if ($10) {
              return "USERPROFILE";
          };
          if (!$10) {
              return "HOME";
          };
          throw new Error("Failed pattern match at Pulp.Login line 122, column 17 - line 123, column 3: " + [ $10.constructor.name ]);
      })();
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Node_Process.lookupEnv(homeVar)))(function (v) {
          if (v instanceof Data_Maybe.Just) {
              return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(v.value0);
          };
          if (v instanceof Data_Maybe.Nothing) {
              return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("The " + (homeVar + " environment variable is not set.")));
          };
          throw new Error("Failed pattern match at Pulp.Login line 124, column 3 - line 129, column 66: " + [ v.constructor.name ]);
      });
  })();
  var tokenFilePath = Control_Apply.apply(Control_Monad_Aff.applyAff)(Data_Functor.map(Control_Monad_Aff.functorAff)(Data_Semigroup.append(Data_Semigroup.semigroupString))(getHome))(Control_Applicative.pure(Control_Monad_Aff.applicativeAff)("/.pulp/github-oauth-token"));
  var writeTokenFile = function (token) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(tokenFilePath)(function (v) {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(mkdirIfNotExist(Node_Path.dirname(v)))(function () {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Node_FS_Aff.writeTextFile(Node_Encoding.UTF8.value)(v)(token))(function () {
                  return Node_FS_Aff.chmod(v)(Node_FS_Perms.mkPerms(Data_Semiring.add(Node_FS_Perms.semiringPerm)(Node_FS_Perms.read)(Node_FS_Perms.write))(Node_FS_Perms.none)(Node_FS_Perms.none));
              });
          });
      });
  };
  var checkToken = function (out) {
      return function (token) {
          var reqOptions = Data_Foldable.fold(Data_Foldable.foldableArray)(Data_Options.monoidOptions)([ Data_Options.assoc(Node_HTTP_Client.protocol)("https:"), Data_Options.assoc(Node_HTTP_Client.hostname)("api.github.com"), Data_Options.assoc(Node_HTTP_Client.path)("/user"), Data_Options.assoc(Node_HTTP_Client.headers)(Data_StrMap.fromFoldable(Data_Foldable.foldableArray)([ new Data_Tuple.Tuple("Accept", "application/vnd.github.v3+json"), new Data_Tuple.Tuple("Authorization", "token " + token), new Data_Tuple.Tuple("User-Agent", "Pulp-" + Pulp_Version.versionString) ])) ]);
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_System_HTTP.httpRequest(reqOptions)(Data_Maybe.Nothing.value))(function (v) {
              var statusCode = Node_HTTP_Client.statusCode(v);
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_System_Stream.concatStream(Node_HTTP_Client.responseAsStream(v)))(function (v1) {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Applicative.unless(Control_Monad_Aff.applicativeAff)(statusCode === 200)(Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error((function () {
                      if (statusCode === 401) {
                          return "Your token was not accepted (401 Unauthorized).";
                      };
                      var header = "Something went wrong (HTTP " + (Data_Show.show(Data_Show.showInt)(statusCode) + (" " + (Node_HTTP_Client.statusMessage(v) + ").")));
                      return header + ("\n" + v1);
                  })()))))(function () {
                      var $18 = Control_Monad_Except.runExcept(Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Data_Foreign.parseJSON(v1))(Data_Foreign_Class.readProp(Data_Foreign_Class.stringIsForeign)(Data_Foreign_Index.indexString)("login")));
                      if ($18 instanceof Data_Either.Right) {
                          return out.write("Successfully authenticated as " + ($18.value0 + ".\n"));
                      };
                      if ($18 instanceof Data_Either.Left) {
                          return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("Unexpected response from GitHub API: " + Data_Show.show(Data_List_Types.showNonEmptyList(Data_Foreign.showForeignError))($18.value0)));
                      };
                      throw new Error("Failed pattern match at Pulp.Login line 81, column 3 - line 85, column 79: " + [ $18.constructor.name ]);
                  });
              });
          });
      };
  };

  /**
 *  TODO: Obtain tokens automatically after prompting for a username and
 *  password.
 * 
 *  Unfortunately it is not easy to do this without exposing the client secret,
 *  so I think we need to add a route to Pursuit itself to support this, so that
 *  Pursuit sort of proxies to GitHub and adds its client secret itself.
 */  
  var action = function (args) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Outputter.getOutputter(args))(function (v) {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(obtainTokenFromStdin(v))(function (v1) {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(checkToken(v)(v1))(function () {
                  return writeTokenFile(v1);
              });
          });
      });
  };
  exports["action"] = action;
  exports["tokenFilePath"] = tokenFilePath;
})(PS["Pulp.Login"] = PS["Pulp.Login"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Data_Function = PS["Data.Function"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Tuple = PS["Data.Tuple"];
  var Data_Either = PS["Data.Either"];
  var Data_Array = PS["Data.Array"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Version = PS["Data.Version"];
  var Data_String = PS["Data.String"];
  var Node_ChildProcess = PS["Node.ChildProcess"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Pulp_Exec = PS["Pulp.Exec"];
  var Control_Bind = PS["Control.Bind"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Unit = PS["Data.Unit"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Functor = PS["Data.Functor"];
  var Data_Ord = PS["Data.Ord"];        

  /**
 *  | Throw an error if the git working tree is dirty.
 */  
  var requireCleanGitWorkingTree = Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Exec.execQuiet("git")([ "status", "--porcelain" ])(Data_Maybe.Nothing.value))(function (v) {
      var $2 = Data_Foldable.all(Data_Foldable.foldableArray)(Data_HeytingAlgebra.heytingAlgebraBoolean)(Data_String["null"])(Data_String.split("\n")(v));
      if ($2) {
          return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(Data_Unit.unit);
      };
      if (!$2) {
          return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("Your git working tree is dirty. Please commit or stash your changes " + "first."));
      };
      throw new Error("Failed pattern match at Pulp.Git line 25, column 3 - line 31, column 1: " + [ $2.constructor.name ]);
  });
  var dropPrefix = function (prefix) {
      return function (str) {
          return Data_Maybe.fromMaybe(str)(Data_String.stripPrefix(prefix)(str));
      };
  };

  /**
 *  | Given a number of lines of text, attempt to parse each line as a version,
 *  | and return the maximum.
 */  
  var maxVersion = (function () {
      var parseMay = function (str) {
          return Data_Functor.map(Data_Maybe.functorMaybe)(Data_Tuple.Tuple.create(str))(Data_Either.either(Data_Function["const"](Data_Maybe.Nothing.value))(Data_Maybe.Just.create)(Data_Version.parseVersion(dropPrefix("v")(str))));
      };
      return function ($3) {
          return Data_Foldable.maximumBy(Data_Foldable.foldableArray)(Data_Function.on(Data_Ord.compare(Data_Version.ordVersion))(Data_Tuple.snd))(Data_Array.mapMaybe(function ($4) {
              return parseMay(Data_String.trim($4));
          })(Data_String.split("\n")($3)));
      };
  })();

  /**
 *  | Get the most recently tagged version from the git tag.
 */  
  var getVersionFromGitTag = (function () {
    
      /**
     *  Run a command, piping stderr to /dev/null
     */  
      var run = Pulp_Exec.execQuietWithStderr(Node_ChildProcess.Ignore.value);
      return Data_Functor.map(Control_Monad_Aff.functorAff)(Data_Either.either(Data_Function["const"](Data_Maybe.Nothing.value))(maxVersion))(Control_Monad_Aff.attempt(run("git")([ "describe", "--tags", "--abbrev=0", "HEAD" ])(Data_Maybe.Nothing.value)));
  })();
  exports["dropPrefix"] = dropPrefix;
  exports["getVersionFromGitTag"] = getVersionFromGitTag;
  exports["maxVersion"] = maxVersion;
  exports["requireCleanGitWorkingTree"] = requireCleanGitWorkingTree;
})(PS["Pulp.Git"] = PS["Pulp.Git"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Tuple = PS["Data.Tuple"];
  var Data_Either = PS["Data.Either"];
  var Data_List = PS["Data.List"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Version = PS["Data.Version"];
  var Data_String = PS["Data.String"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Pulp_Exec = PS["Pulp.Exec"];
  var Pulp_VersionBump = PS["Pulp.VersionBump"];
  var Pulp_System_Read = PS["Pulp.System.Read"];
  var Pulp_Outputter = PS["Pulp.Outputter"];
  var Pulp_Args = PS["Pulp.Args"];
  var Pulp_Args_Get = PS["Pulp.Args.Get"];
  var Pulp_Git = PS["Pulp.Git"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Data_List_Types = PS["Data.List.Types"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Function = PS["Data.Function"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];
  var Data_Foreign_Class = PS["Data.Foreign.Class"];
  var Data_Functor = PS["Data.Functor"];        
  var untilJust = function (dictMonad) {
      return function (act) {
          return Control_Bind.bind(dictMonad["__superclass_Control.Bind.Bind_1"]())(act)(function (v) {
              if (v instanceof Data_Maybe.Just) {
                  return Control_Applicative.pure(dictMonad["__superclass_Control.Applicative.Applicative_0"]())(v.value0);
              };
              if (v instanceof Data_Maybe.Nothing) {
                  return untilJust(dictMonad)(act);
              };
              throw new Error("Failed pattern match at Pulp.BumpVersion line 139, column 3 - line 143, column 20: " + [ v.constructor.name ]);
          });
      };
  };
  var tagNewVersion = function (version) {
      var versionStr = "v" + Data_Version.showVersion(version);
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Exec.exec("git")([ "commit", "--allow-empty", "--message=" + versionStr ])(Data_Maybe.Nothing.value))(function () {
          return Pulp_Exec.exec("git")([ "tag", "--annotate", "--message=" + versionStr, versionStr ])(Data_Maybe.Nothing.value);
      });
  };

  /**
 *  | Prompt and ask the user what to use as the initial version.
 */  
  var promptInitial = function (out) {
      var vers = function (major) {
          return function (minor) {
              return function (patch) {
                  return Data_Version.version(major)(minor)(patch)(Data_List_Types.Nil.value)(Data_List_Types.Nil.value);
              };
          };
      };
      var initialOptions = [ new Data_Tuple.Tuple("a", vers(1)(0)(0)), new Data_Tuple.Tuple("b", vers(0)(1)(0)), new Data_Tuple.Tuple("c", vers(0)(0)(1)) ];
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.log("Initial version"))(function () {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.write("You can release this code as:\n"))(function () {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Data_Foldable.for_(Control_Monad_Aff.applicativeAff)(Data_Foldable.foldableArray)(initialOptions)(function (v) {
                  return out.write(v.value0 + (") v" + (Data_Version.showVersion(v.value1) + "\n")));
              }))(function () {
                  return untilJust(Control_Monad_Aff.monadAff)(Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_System_Read.read({
                      prompt: "Choose one, or enter a specific version:", 
                      silent: false
                  }))(function (v) {
                      var $19 = Data_Tuple.lookup(Data_Foldable.foldableArray)(Data_Eq.eqString)(Data_String.toLower(v))(initialOptions);
                      if ($19 instanceof Data_Maybe.Just) {
                          return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(new Data_Maybe.Just($19.value0));
                      };
                      if ($19 instanceof Data_Maybe.Nothing) {
                          var $21 = Data_Version.parseVersion(Pulp_Git.dropPrefix("v")(v));
                          if ($21 instanceof Data_Either.Right) {
                              return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(new Data_Maybe.Just($21.value0));
                          };
                          if ($21 instanceof Data_Either.Left) {
                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.log("Sorry, that choice wasn't understood."))(function () {
                                  return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(Data_Maybe.Nothing.value);
                              });
                          };
                          throw new Error("Failed pattern match at Pulp.BumpVersion line 89, column 9 - line 94, column 25: " + [ $21.constructor.name ]);
                      };
                      throw new Error("Failed pattern match at Pulp.BumpVersion line 85, column 5 - line 94, column 25: " + [ $19.constructor.name ]);
                  }));
              });
          });
      });
  };
  var promptCurrent = function (out) {
      return function (current) {
          var bumpOptions = [ new Data_Tuple.Tuple("a", Pulp_VersionBump.Major.value), new Data_Tuple.Tuple("b", Pulp_VersionBump.Minor.value), new Data_Tuple.Tuple("c", Pulp_VersionBump.Patch.value) ];
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.log("The current version is v" + Data_Version.showVersion(current)))(function () {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.write("You can bump the version to:\n"))(function () {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Data_Foldable.for_(Control_Monad_Aff.applicativeAff)(Data_Foldable.foldableArray)(bumpOptions)(function (v) {
                      return out.write(v.value0 + (") v" + (Data_Version.showVersion(Pulp_VersionBump.applyBump(v.value1)(current)) + "\n")));
                  }))(function () {
                      return untilJust(Control_Monad_Aff.monadAff)(Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_System_Read.read({
                          prompt: "Choose one, or enter a specific version:", 
                          silent: false
                      }))(function (v) {
                          var $28 = Data_Tuple.lookup(Data_Foldable.foldableArray)(Data_Eq.eqString)(Data_String.toLower(v))(bumpOptions);
                          if ($28 instanceof Data_Maybe.Just) {
                              return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(new Data_Maybe.Just(Pulp_VersionBump.applyBump($28.value0)(current)));
                          };
                          if ($28 instanceof Data_Maybe.Nothing) {
                              var $30 = Data_Version.parseVersion(Pulp_Git.dropPrefix("v")(v));
                              if ($30 instanceof Data_Either.Right) {
                                  return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(new Data_Maybe.Just($30.value0));
                              };
                              if ($30 instanceof Data_Either.Left) {
                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.log("Sorry, that choice wasn't understood."))(function () {
                                      return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(Data_Maybe.Nothing.value);
                                  });
                              };
                              throw new Error("Failed pattern match at Pulp.BumpVersion line 122, column 9 - line 127, column 25: " + [ $30.constructor.name ]);
                          };
                          throw new Error("Failed pattern match at Pulp.BumpVersion line 118, column 5 - line 127, column 25: " + [ $28.constructor.name ]);
                      }));
                  });
              });
          });
      };
  };
  var internalError = function (msg) {
      return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("Internal error in Pulp.BumpVersion: " + (msg + ("\n" + "This is a bug. Please report it.\n"))));
  };

  /**
 *  | Try running `psc-publish --dry-run` to make sure the code is suitable for
 *  | release.
 */  
  var checkPscPublish = function (out) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.log("Checking your package using psc-publish..."))(function () {
          return Pulp_Exec.exec("psc-publish")([ "--dry-run" ])(Data_Maybe.Nothing.value);
      });
  };

  /**
 *  | Returns the new version that we should bump to.
 */  
  var bumpVersion = function (args) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getOption(Data_Foreign_Class.stringIsForeign)("bump")(args.commandArgs))(function (v) {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Data_Functor.map(Control_Monad_Aff.functorAff)(Data_Functor.map(Data_Maybe.functorMaybe)(Data_Tuple.snd))(Pulp_Git.getVersionFromGitTag))(function (v1) {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Outputter.getOutputter(args))(function (v2) {
                  if (v instanceof Data_Maybe.Just) {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Data_Maybe.maybe(internalError("invalid bump"))(Control_Applicative.pure(Control_Monad_Aff.applicativeAff))(Pulp_VersionBump.parseBump(v.value0)))(function (v3) {
                          return Data_Maybe.maybe(promptInitial(v2))(function ($41) {
                              return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(Pulp_VersionBump.applyBump(v3)($41));
                          })(v1);
                      });
                  };
                  if (v instanceof Data_Maybe.Nothing) {
                      return Data_Maybe.maybe(promptInitial(v2))(promptCurrent(v2))(v1);
                  };
                  throw new Error("Failed pattern match at Pulp.BumpVersion line 48, column 3 - line 54, column 61: " + [ v.constructor.name ]);
              });
          });
      });
  };
  var action = function (args) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Outputter.getOutputter(args))(function (v) {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Git.requireCleanGitWorkingTree)(function () {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(checkPscPublish(v))(function () {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(bumpVersion(args))(function (v1) {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(tagNewVersion(v1))(function () {
                          return v.log("Bumped to: v" + Data_Version.showVersion(v1));
                      });
                  });
              });
          });
      });
  };
  exports["action"] = action;
})(PS["Pulp.BumpVersion"] = PS["Pulp.BumpVersion"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Control_Monad_Except = PS["Control.Monad.Except"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Tuple = PS["Data.Tuple"];
  var Data_Tuple_Nested = PS["Data.Tuple.Nested"];
  var Data_Either = PS["Data.Either"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_Foreign = PS["Data.Foreign"];
  var Data_Foreign_Class = PS["Data.Foreign.Class"];
  var Data_Version = PS["Data.Version"];
  var Data_String = PS["Data.String"];
  var Data_StrMap = PS["Data.StrMap"];
  var Data_Options = PS["Data.Options"];
  var Node_Encoding = PS["Node.Encoding"];
  var Node_Buffer = PS["Node.Buffer"];
  var Node_ChildProcess = PS["Node.ChildProcess"];
  var Node_FS_Aff = PS["Node.FS.Aff"];
  var Node_HTTP_Client = PS["Node.HTTP.Client"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Pulp_System_HTTP = PS["Pulp.System.HTTP"];
  var Pulp_System_Stream = PS["Pulp.System.Stream"];
  var Pulp_Exec = PS["Pulp.Exec"];
  var Pulp_Args = PS["Pulp.Args"];
  var Pulp_Args_Get = PS["Pulp.Args.Get"];
  var Pulp_Outputter = PS["Pulp.Outputter"];
  var Pulp_System_Files = PS["Pulp.System.Files"];
  var Pulp_System_Read = PS["Pulp.System.Read"];
  var Pulp_Git = PS["Pulp.Git"];
  var Pulp_Login = PS["Pulp.Login"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Applicative = PS["Control.Applicative"];
  var Data_Unit = PS["Data.Unit"];
  var Data_Show = PS["Data.Show"];
  var Data_List_Types = PS["Data.List.Types"];
  var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
  var Data_Identity = PS["Data.Identity"];
  var Data_Foreign_Index = PS["Data.Foreign.Index"];
  var uploadPursuitDocs = function (out) {
      return function (authToken) {
          return function (gzippedJson) {
              var headers = Data_StrMap.fromFoldable(Data_Foldable.foldableArray)([ new Data_Tuple.Tuple("Accept", "application/json"), new Data_Tuple.Tuple("Authorization", "token " + authToken), new Data_Tuple.Tuple("Content-Encoding", "gzip") ]);
              var reqOptions = Data_Foldable.fold(Data_Foldable.foldableArray)(Data_Options.monoidOptions)([ Data_Options.assoc(Node_HTTP_Client.method)("POST"), Data_Options.assoc(Node_HTTP_Client.protocol)("https:"), Data_Options.assoc(Node_HTTP_Client.hostname)("pursuit.purescript.org"), Data_Options.assoc(Node_HTTP_Client.path)("/packages"), Data_Options.assoc(Node_HTTP_Client.headers)(headers) ]);
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_System_HTTP.httpRequest(reqOptions)(new Data_Maybe.Just(gzippedJson)))(function (v) {
                  var $19 = Node_HTTP_Client.statusCode(v);
                  if ($19 === 201) {
                      return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(Data_Unit.unit);
                  };
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Bind.bindFlipped(Control_Monad_Aff.bindAff)(out.err)(Pulp_System_Stream.concatStream(Node_HTTP_Client.responseAsStream(v))))(function () {
                      return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("Expected an HTTP 201 response from Pursuit, got: " + Data_Show.show(Data_Show.showInt)($19)));
                  });
              });
          };
      };
  };
  var readTokenFile = Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Login.tokenFilePath)(function (v) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Aff.attempt(Node_FS_Aff.readTextFile(Node_Encoding.UTF8.value)(v)))(function (v1) {
          if (v1 instanceof Data_Either.Right) {
              return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(v1.value0);
          };
          if (v1 instanceof Data_Either.Left && Pulp_System_Files.isENOENT(v1.value0)) {
              return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("Pursuit authentication token not found. Try running `pulp login` " + "first."));
          };
          if (v1 instanceof Data_Either.Left) {
              return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(v1.value0);
          };
          throw new Error("Failed pattern match at Pulp.Publish line 145, column 3 - line 153, column 21: " + [ v1.constructor.name ]);
      });
  });
  var readBowerJson = Control_Bind.bind(Control_Monad_Aff.bindAff)(Node_FS_Aff.readTextFile(Node_Encoding.UTF8.value)("bower.json"))(function (v) {
      var $27 = Control_Monad_Except.runExcept(Data_Foreign.parseJSON(v));
      if ($27 instanceof Data_Either.Right) {
          return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)($27.value0);
      };
      if ($27 instanceof Data_Either.Left) {
          return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("Unable to parse bower.json:" + Data_Show.show(Data_List_Types.showNonEmptyList(Data_Foreign.showForeignError))($27.value0)));
      };
      throw new Error("Failed pattern match at Pulp.Publish line 116, column 3 - line 121, column 52: " + [ $27.constructor.name ]);
  });
  var pursuitUrl = function (name) {
      return function (vers) {
          return "https://pursuit.purescript.org/packages/" + (name + ("/" + Data_Version.showVersion(vers)));
      };
  };
  var pscPublish = Pulp_Exec.execQuiet("psc-publish")([  ])(Data_Maybe.Nothing.value);
  var gzip = function (str) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Pulp_System_Stream.createGzip))(function (v) {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_System_Stream.write(v)(str))(function () {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_System_Stream.end(v))(function () {
                  return Pulp_System_Stream.concatStreamToBuffer(v);
              });
          });
      });
  };
  var getBowerRepositoryUrl = function (v) {
      var $32 = Control_Monad_Except.runExcept(Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Data_Foreign_Class.readProp(Data_Foreign_Class.foreignIsForeign)(Data_Foreign_Index.indexString)("repository")(v))(Data_Foreign_Class.readProp(Data_Foreign_Class.stringIsForeign)(Data_Foreign_Index.indexString)("url")));
      if ($32 instanceof Data_Either.Right) {
          return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)($32.value0);
      };
      if ($32 instanceof Data_Either.Left) {
          return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("Unable to read property 'repository.url' from bower.json:" + Data_Show.show(Data_List_Types.showNonEmptyList(Data_Foreign.showForeignError))($32.value0)));
      };
      throw new Error("Failed pattern match at Pulp.Publish line 134, column 3 - line 139, column 82: " + [ $32.constructor.name ]);
  };
  var getBowerName = function (v) {
      var $36 = Control_Monad_Except.runExcept(Data_Foreign_Class.readProp(Data_Foreign_Class.stringIsForeign)(Data_Foreign_Index.indexString)("name")(v));
      if ($36 instanceof Data_Either.Right) {
          return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)($36.value0);
      };
      if ($36 instanceof Data_Either.Left) {
          return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("Unable to read property 'name' from bower.json:" + Data_Show.show(Data_List_Types.showNonEmptyList(Data_Foreign.showForeignError))($36.value0)));
      };
      throw new Error("Failed pattern match at Pulp.Publish line 125, column 3 - line 130, column 72: " + [ $36.constructor.name ]);
  };
  var confirm = function (q) {
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_System_Read.read({
          prompt: q + " [y/n] ", 
          silent: false
      }))(function (v) {
          var $40 = Data_String.trim(Data_String.toLower(v));
          if ($40 === "y") {
              return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(Data_Unit.unit);
          };
          return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("Aborted"));
      });
  };
  var confirmRun = function (out) {
      return function (cmd) {
          return function (args) {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.log("About to execute:"))(function () {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.write("> " + (cmd + (" " + (Data_String.joinWith(" ")(args) + "\n")))))(function () {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(confirm("Ok?"))(function () {
                          return Pulp_Exec.exec(cmd)(args)(Data_Maybe.Nothing.value);
                      });
                  });
              });
          };
      };
  };
  var registerOnBowerIfNecessary = function (out) {
      return function (name) {
          return function (repoUrl) {
            
              /**
             *  Run a command, sending stderr to /dev/null
             */  
              var run = Pulp_Exec.execQuietWithStderr(Node_ChildProcess.Ignore.value);
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Aff.attempt(run("bower")([ "info", name, "--json" ])(Data_Maybe.Nothing.value)))(function (v) {
                  if (v instanceof Data_Either.Left) {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.log("Registering your package on Bower..."))(function () {
                          return confirmRun(out)("bower")([ "register", name, repoUrl ]);
                      });
                  };
                  if (v instanceof Data_Either.Right) {
                      return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(Data_Unit.unit);
                  };
                  throw new Error("Failed pattern match at Pulp.Publish line 162, column 3 - line 168, column 16: " + [ v.constructor.name ]);
              });
          };
      };
  };

  /**
 *  TODO:
 *  * Check that the 'origin' remote matches with bower.json
 *  * Better handling for the situation where the person running 'pulp publish'
 *    doesn't actually own the repo.
 */  
  var action = (function () {
      var getVersion = Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Git.getVersionFromGitTag)(Data_Maybe.maybe(Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("Internal error: No version could be extracted from the git tags" + (" in this repository. This should not have happened. Please" + " report this: https://github.com/bodil/pulp/issues/new"))))(Control_Applicative.pure(Control_Monad_Aff.applicativeAff)));
      return function (args) {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Outputter.getOutputter(args))(function (v) {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Git.requireCleanGitWorkingTree)(function () {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(readTokenFile)(function (v1) {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Bind.bind(Control_Monad_Aff.bindAff)(pscPublish)(gzip))(function (v2) {
                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(getVersion)(function (v3) {
                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(readBowerJson)(function (v4) {
                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(getBowerName(v4))(function (v5) {
                                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(confirm("Publishing " + (v5 + (" at v" + (Data_Version.showVersion(v3.value1) + ". Is this ok?")))))(function () {
                                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getFlag("noPush")(args.commandOpts))(function (v6) {
                                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Applicative.unless(Control_Monad_Aff.applicativeAff)(v6)(Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get["getOption'"](Data_Foreign_Class.stringIsForeign)("pushTo")(args.commandOpts))(function (v7) {
                                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(confirmRun(v)("git")([ "push", v7, "HEAD", "refs/tags/" + v3.value0 ]))(function () {
                                                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(getBowerRepositoryUrl(v4))(function (v8) {
                                                          return registerOnBowerIfNecessary(v)(v5)(v8);
                                                      });
                                                  });
                                              })))(function () {
                                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(v.log("Uploading documentation to Pursuit..."))(function () {
                                                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(uploadPursuitDocs(v)(v1)(v2))(function () {
                                                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(v.log("Done."))(function () {
                                                              return v.log("You can view your package's documentation at: " + pursuitUrl(v5)(v3.value1));
                                                          });
                                                      });
                                                  });
                                              });
                                          });
                                      });
                                  });
                              });
                          });
                      });
                  });
              });
          });
      };
  })();
  exports["action"] = action;
})(PS["Pulp.Publish"] = PS["Pulp.Publish"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var Prelude = PS["Prelude"];
  var Data_Maybe = PS["Data.Maybe"];
  var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
  var Node_Encoding = PS["Node.Encoding"];
  var Node_Buffer = PS["Node.Buffer"];
  var Node_FS_Aff = PS["Node.FS.Aff"];
  var Node_Process = PS["Node.Process"];
  var Node_Platform = PS["Node.Platform"];
  var Pulp_Exec = PS["Pulp.Exec"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Pulp_System_Files = PS["Pulp.System.Files"];
  var Pulp_Outputter = PS["Pulp.Outputter"];
  var Control_Bind = PS["Control.Bind"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Data_Function = PS["Data.Function"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Data_Eq = PS["Data.Eq"];        
  var shell$prime = function (out) {
      return function (cmd) {
          return function (opts) {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.log("Executing " + cmd))(function () {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Node_Buffer.fromString(cmd)(Node_Encoding.UTF8.value)))(function (v) {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_System_Files.openTemp({
                          prefix: "pulp-cmd-", 
                          suffix: opts.extension
                      }))(function (v1) {
                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Node_FS_Aff.fdAppend(v1.fd)(v))(function () {
                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Node_FS_Aff.fdClose(v1.fd))(function () {
                                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Exec.exec(opts.executable)(Data_Semigroup.append(Data_Semigroup.semigroupArray)(opts.extraArgs)([ v1.path ]))(Data_Maybe.Nothing.value))(function () {
                                      return out.log("Done.");
                                  });
                              });
                          });
                      });
                  });
              });
          };
      };
  };
  var shell = function (out) {
      return function (cmd) {
          var $4 = Data_Eq.eq(Node_Platform.eqPlatform)(Node_Process.platform)(Node_Platform.Win32.value);
          if ($4) {
              return shell$prime(out)(cmd)({
                  extension: ".cmd", 
                  executable: "cmd", 
                  extraArgs: [ "/s", "/c" ]
              });
          };
          if (!$4) {
              return shell$prime(out)(cmd)({
                  extension: ".sh", 
                  executable: "sh", 
                  extraArgs: [  ]
              });
          };
          throw new Error("Failed pattern match at Pulp.Shell line 20, column 3 - line 30, column 14: " + [ $4.constructor.name ]);
      };
  };
  exports["shell"] = shell;
})(PS["Pulp.Shell"] = PS["Pulp.Shell"] || {});
(function(exports) {
  // Generated by psc version 0.10.2
  "use strict";
  var $foreign = PS["Main"];
  var Prelude = PS["Prelude"];
  var Control_Monad_Aff = PS["Control.Monad.Aff"];
  var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
  var Control_Monad_Eff_Console = PS["Control.Monad.Eff.Console"];
  var Control_Monad_Eff_Unsafe = PS["Control.Monad.Eff.Unsafe"];
  var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
  var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
  var Control_Monad_Except = PS["Control.Monad.Except"];
  var Data_Maybe = PS["Data.Maybe"];
  var Data_Either = PS["Data.Either"];
  var Data_Map = PS["Data.Map"];
  var Data_Foreign = PS["Data.Foreign"];
  var Data_Foreign_Class = PS["Data.Foreign.Class"];
  var Data_Array = PS["Data.Array"];
  var Data_Foldable = PS["Data.Foldable"];
  var Data_List = PS["Data.List"];
  var Data_Version = PS["Data.Version"];
  var Data_String = PS["Data.String"];
  var Text_Parsing_Parser = PS["Text.Parsing.Parser"];
  var Node_Encoding = PS["Node.Encoding"];
  var Node_FS_Sync = PS["Node.FS.Sync"];
  var Node_Path = PS["Node.Path"];
  var Node_Process = PS["Node.Process"];
  var Pulp_Args = PS["Pulp.Args"];
  var Pulp_Args_Get = PS["Pulp.Args.Get"];
  var Pulp_Args_Help = PS["Pulp.Args.Help"];
  var Pulp_Args_Types = PS["Pulp.Args.Types"];
  var Pulp_Args_Parser = PS["Pulp.Args.Parser"];
  var Pulp_System_FFI = PS["Pulp.System.FFI"];
  var Pulp_Outputter = PS["Pulp.Outputter"];
  var Pulp_Validate = PS["Pulp.Validate"];
  var Pulp_Version = PS["Pulp.Version"];
  var Pulp_Project = PS["Pulp.Project"];
  var Pulp_Init = PS["Pulp.Init"];
  var Pulp_Build = PS["Pulp.Build"];
  var Pulp_Run = PS["Pulp.Run"];
  var Pulp_Test = PS["Pulp.Test"];
  var Pulp_Browserify = PS["Pulp.Browserify"];
  var Pulp_Docs = PS["Pulp.Docs"];
  var Pulp_Psci = PS["Pulp.Psci"];
  var Pulp_Server = PS["Pulp.Server"];
  var Pulp_Login = PS["Pulp.Login"];
  var Pulp_BumpVersion = PS["Pulp.BumpVersion"];
  var Pulp_Publish = PS["Pulp.Publish"];
  var Pulp_Watch = PS["Pulp.Watch"];
  var Pulp_Shell = PS["Pulp.Shell"];
  var Data_Function = PS["Data.Function"];
  var Control_Applicative = PS["Control.Applicative"];
  var Control_Monad_Eff = PS["Control.Monad.Eff"];
  var Data_Unit = PS["Data.Unit"];
  var Control_Bind = PS["Control.Bind"];
  var Data_Eq = PS["Data.Eq"];
  var Data_Ord = PS["Data.Ord"];
  var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
  var Data_Semigroup = PS["Data.Semigroup"];
  var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
  var Data_Identity = PS["Data.Identity"];
  var Data_Foreign_Index = PS["Data.Foreign.Index"];
  var Data_Show = PS["Data.Show"];
  var Data_List_Types = PS["Data.List.Types"];
  var Data_Functor = PS["Data.Functor"];
  var Control_Semigroupoid = PS["Control.Semigroupoid"];        
  var succeeded = Data_Function["const"](Control_Applicative.pure(Control_Monad_Eff.applicativeEff)(Data_Unit.unit));
  var runWithArgs = function (args) {
    
      /**
     *  This is really quite gross, especially with _project. Not sure exactly
     *  how to go about improving this.
     */  
      var runShellForOption = function (option) {
          return function (opts) {
              return function (out) {
                  return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getOption(Data_Foreign_Class.stringIsForeign)(option)(opts))(function (v) {
                      if (v instanceof Data_Maybe.Just) {
                          return Pulp_Shell.shell(out)(v.value0);
                      };
                      if (v instanceof Data_Maybe.Nothing) {
                          return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(Data_Unit.unit);
                      };
                      throw new Error("Failed pattern match at Main line 283, column 5 - line 285, column 28: " + [ v.constructor.name ]);
                  });
              };
          };
      };
      var noProject = [ "init", "login" ];
      var addProject = function (as) {
          var $14 = Data_Foldable.elem(Data_Foldable.foldableArray)(Data_Eq.eqString)(as.command.name)(noProject);
          if ($14) {
              return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(as);
          };
          if (!$14) {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Project.getProject(as.globalOpts))(function (v) {
                  var globalOpts$prime = Data_Map.insert(Data_Ord.ordString)("_project")(new Data_Maybe.Just(Data_Foreign.toForeign(v)))(as.globalOpts);
                  return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)((function () {
                      var $16 = {};
                      for (var $17 in as) {
                          if (as.hasOwnProperty($17)) {
                              $16[$17] = as[$17];
                          };
                      };
                      $16.globalOpts = globalOpts$prime;
                      return $16;
                  })());
              });
          };
          throw new Error("Failed pattern match at Main line 274, column 5 - line 279, column 47: " + [ $14.constructor.name ]);
      };
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Outputter.getOutputter(args))(function (v) {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Validate.validate(v))(function (v1) {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Get.getFlag("watch")(args.globalOpts))(function (v2) {
                  var $22 = v2 && args.command.name !== "server";
                  if ($22) {
                      return Pulp_Args.runAction(Pulp_Watch.action)(args);
                  };
                  if (!$22) {
                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(addProject(args))(function (v3) {
                          return Control_Bind.bind(Control_Monad_Aff.bindAff)(runShellForOption("before")(v3.globalOpts)(v))(function () {
                              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Aff.attempt(Pulp_Args.runAction(args.command.action)(v3)))(function (v4) {
                                  if (v4 instanceof Data_Either.Left) {
                                      return Control_Bind.bind(Control_Monad_Aff.bindAff)(runShellForOption("else")(v3.globalOpts)(v))(function () {
                                          return Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Control_Monad_Eff_Exception.throwException(v4.value0));
                                      });
                                  };
                                  if (v4 instanceof Data_Either.Right) {
                                      return runShellForOption("then")(v3.globalOpts)(v);
                                  };
                                  throw new Error("Failed pattern match at Main line 262, column 7 - line 267, column 56: " + [ v4.constructor.name ]);
                              });
                          });
                      });
                  };
                  throw new Error("Failed pattern match at Main line 255, column 3 - line 267, column 56: " + [ $22.constructor.name ]);
              });
          });
      });
  };
  var requireNodeAtLeast = function (minimum) {
      var stripV = function (str) {
          return Data_Maybe.fromMaybe(str)(Data_String.stripPrefix("v")(str));
      };
      var $28 = Data_Version.parseVersion(stripV(Node_Process.version));
      if ($28 instanceof Data_Either.Left) {
          var message = Text_Parsing_Parser.parseErrorMessage($28.value0);
          return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("Failed to parse node.js version: " + message));
      };
      if ($28 instanceof Data_Either.Right) {
          return Control_Applicative.when(Control_Monad_Aff.applicativeAff)(Data_Ord.lessThan(Data_Version.ordVersion)($28.value0)(minimum))(Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadErrorAff)(Control_Monad_Eff_Exception.error("Your node.js version is too old " + ("(required: " + (Data_Version.showVersion(minimum) + (", actual: " + (Data_Version.showVersion($28.value0) + ")")))))));
      };
      throw new Error("Failed pattern match at Main line 289, column 3 - line 298, column 56: " + [ $28.constructor.name ]);
  };
  var remainderToTest = new Data_Maybe.Just("Passthrough options are sent to the test program. " + "This can be useful for only running one particular test, for instance.");
  var remainderToPsci = new Data_Maybe.Just("Passthrough options are sent to `psci`.");
  var remainderToPscDocs = new Data_Maybe.Just("Passthrough options are sent to `psc-docs`.");
  var remainderToPsc = new Data_Maybe.Just("Passthrough options are sent to `psc`.");
  var remainderToProgram = new Data_Maybe.Just("Passthrough options are sent to your program.");
  var remainderToBundle = new Data_Maybe.Just("Passthrough options are sent to `psc-bundle`.");

  /**
 *  TODO: This is possibly just a temporary separation from buildArgs; at the
 *        moment, the browserify action doesn't support this option, but it's
 *        definitely in the realm of possibility.
 */  
  var moduleArgs = [ Pulp_Args.option("modules")([ "--modules" ])(Pulp_Args_Types.string)("Additional modules to be included in the output bundle (comma-separated list).") ];
  var globals = [ Pulp_Args.option("bowerFile")([ "--bower-file", "-b" ])(Pulp_Args_Types.file)("Read this bower.json file instead of autodetecting it."), Pulp_Args.option("watch")([ "--watch", "-w" ])(Pulp_Args_Types.flag)("Watch source directories and re-run command if something changes."), Pulp_Args.option("monochrome")([ "--monochrome" ])(Pulp_Args_Types.flag)("Don't colourise log output."), Pulp_Args.option("before")([ "--before" ])(Pulp_Args_Types.string)("Run a shell command before the operation begins. Useful with `--watch`, eg. `--watch --before clear`."), Pulp_Args.option("then")([ "--then" ])(Pulp_Args_Types.string)("Run a shell command after the operation finishes successfully. Useful with `--watch`, eg. `--watch --then 'say Done'`"), Pulp_Args.option("else")([ "--else" ])(Pulp_Args_Types.string)("Run a shell command if an operation finishes. Useful with `--watch`, eg. `--watch --then 'say Done' --else 'say Failed'`"), Pulp_Args.option("version")([ "--version", "-v" ])(Pulp_Args_Types.flag)("Show current pulp version.") ];
  var failed = function (err) {
      return function __do() {
          Control_Monad_Eff_Console.error("* ERROR: " + Control_Monad_Eff_Exception.message(err))();
          return Node_Process.exit(1)();
      };
  };
  var defaultDependencyPath = (function () {
      var readFromBowerRc = function __do() {
          var v = Node_FS_Sync.readTextFile(Node_Encoding.UTF8.value)(".bowerrc")();
          var $32 = Control_Monad_Except.runExcept(Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Data_Foreign.parseJSON(v))(Data_Foreign_Class.readProp(Data_Foreign_Class.stringIsForeign)(Data_Foreign_Index.indexString)("directory")));
          if ($32 instanceof Data_Either.Right) {
              return $32.value0;
          };
          if ($32 instanceof Data_Either.Left) {
              return Control_Monad_Eff_Exception.throwException(Control_Monad_Eff_Exception.error(Data_Show.show(Data_List_Types.showNonEmptyList(Data_Foreign.showForeignError))($32.value0)))();
          };
          throw new Error("Failed pattern match at Main line 77, column 5 - line 79, column 53: " + [ $32.constructor.name ]);
      };
      return Control_Monad_Eff_Unsafe.unsafePerformEff(Control_Monad_Eff_Exception.catchException(Data_Function["const"](Control_Applicative.pure(Control_Monad_Eff.applicativeEff)("bower_components")))(readFromBowerRc));
  })();

  /**
 *  | Options for any command requiring paths
 */  
  var pathArgs = [ Pulp_Args.optionDefault("includePaths")([ "--include", "-I" ])(Pulp_Args_Types.directories)("Additional directories for PureScript source files, separated by `" + (Node_Path.delimiter + "`."))([  ]), Pulp_Args.optionDefault("srcPath")([ "--src-path" ])(Pulp_Args_Types.directory)("Directory for PureScript source files.")("src"), Pulp_Args.optionDefault("testPath")([ "--test-path" ])(Pulp_Args_Types.directory)("Directory for PureScript test files.")("test"), Pulp_Args.optionDefault("dependencyPath")([ "--dependency-path" ])(Pulp_Args_Types.directory)("Directory for PureScript dependency files.")(defaultDependencyPath) ];

  /**
 *  | Options common to 'build', 'test', and 'browserify'
 */  
  var buildishArgs = Data_Semigroup.append(Data_Semigroup.semigroupArray)([ Pulp_Args.optionDefault("buildPath")([ "--build-path", "-o" ])(Pulp_Args_Types.string)("Path for compiler output.")("./output"), Pulp_Args.option("noPsa")([ "--no-psa" ])(Pulp_Args_Types.flag)("Do not attempt to use the psa frontend instead of psc") ])(pathArgs);
  var runArgs = Data_Semigroup.append(Data_Semigroup.semigroupArray)([ Pulp_Args.optionDefault("main")([ "--main", "-m" ])(Pulp_Args_Types.string)("Application's entry point.")("Main"), Pulp_Args.option("jobs")([ "--jobs", "-j" ])(Pulp_Args_Types["int"])("Tell psc to use the specified number of cores.") ])(buildishArgs);
  var buildArgs = Data_Semigroup.append(Data_Semigroup.semigroupArray)([ Pulp_Args.option("to")([ "--to", "-t" ])(Pulp_Args_Types.string)("Output file name (stdout if not specified)."), Pulp_Args.option("optimise")([ "--optimise", "-O" ])(Pulp_Args_Types.flag)("Perform dead code elimination."), Pulp_Args.option("skipEntryPoint")([ "--skip-entry-point" ])(Pulp_Args_Types.flag)("Don't add code to automatically invoke Main.") ])(runArgs);
  var commands = [ Pulp_Args.command("init")("Generate an example PureScript project.")(Data_Maybe.Nothing.value)(Pulp_Init.action)([ Pulp_Args.option("force")([ "--force" ])(Pulp_Args_Types.flag)("Overwrite any project found in the current directory.") ]), Pulp_Args.command("build")("Build the project.")(remainderToPsc)(Pulp_Build.action)(Data_Semigroup.append(Data_Semigroup.semigroupArray)(buildArgs)(moduleArgs)), Pulp_Args.command("test")("Run project tests.")(remainderToTest)(Pulp_Test.action)(Data_Semigroup.append(Data_Semigroup.semigroupArray)([ Pulp_Args.optionDefault("main")([ "--main", "-m" ])(Pulp_Args_Types.string)("Test entry point.")("Test.Main"), Pulp_Args.optionDefault("runtime")([ "--runtime", "-r" ])(Pulp_Args_Types.string)("Run test script using this command instead of Node.")("node") ])(buildishArgs)), Pulp_Args.command("browserify")("Produce a deployable bundle using Browserify.")(remainderToBundle)(Pulp_Browserify.action)(Data_Semigroup.append(Data_Semigroup.semigroupArray)([ Pulp_Args.option("transform")([ "--transform" ])(Pulp_Args_Types.string)("Apply a Browserify transform."), Pulp_Args.option("sourceMap")([ "--source-map" ])(Pulp_Args_Types.string)("Generate source maps."), Pulp_Args.option("force")([ "--force" ])(Pulp_Args_Types.flag)("Force a non-incremental build by deleting the build cache."), Pulp_Args.option("standalone")([ "--standalone" ])(Pulp_Args_Types.string)("Output a UMD bundle with the given external module name.") ])(buildArgs)), Pulp_Args.command("run")("Compile and run the project.")(remainderToProgram)(Pulp_Run.action)(Data_Semigroup.append(Data_Semigroup.semigroupArray)([ Pulp_Args.optionDefault("runtime")([ "--runtime", "-r" ])(Pulp_Args_Types.string)("Run the program using this command instead of Node.")("node") ])(runArgs)), Pulp_Args.command("docs")("Generate project documentation.")(remainderToPscDocs)(Pulp_Docs.action)(Data_Semigroup.append(Data_Semigroup.semigroupArray)([ Pulp_Args.option("withTests")([ "--with-tests", "-t" ])(Pulp_Args_Types.flag)("Include tests."), Pulp_Args.option("withDependencies")([ "--with-dependencies", "-d" ])(Pulp_Args_Types.flag)("Include external dependencies.") ])(pathArgs)), Pulp_Args.command("psci")("Launch a PureScript REPL configured for the project.")(remainderToPsci)(Pulp_Psci.action)(pathArgs), Pulp_Args.command("server")("Launch a development server.")(Data_Maybe.Nothing.value)(Pulp_Server.action)(Data_Semigroup.append(Data_Semigroup.semigroupArray)([ Pulp_Args.optionDefault("main")([ "--main", "-m" ])(Pulp_Args_Types.string)("Application's entry point.")("Main"), Pulp_Args.optionDefault("port")([ "--port", "-p" ])(Pulp_Args_Types["int"])("Port number to listen on.")(1337), Pulp_Args.optionDefault("host")([ "--host" ])(Pulp_Args_Types.string)("IP address to bind the server to.")("localhost"), Pulp_Args.option("quiet")([ "--quiet", "-q" ])(Pulp_Args_Types.flag)("Display nothing to the console when rebuilding.") ])(buildishArgs)), Pulp_Args.command("login")("Obtain and store a token for uploading packages to Pursuit.")(Data_Maybe.Nothing.value)(Pulp_Login.action)([  ]), Pulp_Args.commandWithArgs("version")("Bump and tag a new version in preparation for release.")(Data_Maybe.Nothing.value)(Pulp_BumpVersion.action)([  ])([ Pulp_Args.argument("bump")(Pulp_Args_Types.versionBump)("How to bump the version. Acceptable values: 'major', 'minor', 'patch', or any specific version. If omitted, Pulp will prompt you for a version.")(false) ]), Pulp_Args.command("publish")("Publish a previously tagged version to Bower and Pursuit.")(Data_Maybe.Nothing.value)(Pulp_Publish.action)([ Pulp_Args.optionDefault("pushTo")([ "--push-to" ])(Pulp_Args_Types.string)("The Git remote to push commits and tags to.")("origin"), Pulp_Args.option("noPush")([ "--no-push" ])(Pulp_Args_Types.flag)("Skip pushing commits or tags to any remote.") ]) ];
  var main = (function () {
      var out = Pulp_Outputter.makeOutputter(false);
      var handleParseError = function (v) {
          return function (err) {
              if (v instanceof Data_Maybe.Just) {
                  if (Data_Foldable.elem(Data_Foldable.foldableArray)(Data_Eq.eqString)(v.value0)([ "--version", "-v" ])) {
                      return Pulp_Version.printVersion;
                  };
                  if (Data_Foldable.elem(Data_Foldable.foldableArray)(Data_Eq.eqString)(v.value0)([ "--help", "-h" ])) {
                      return Pulp_Args_Help.printHelp(out)(globals)(commands);
                  };
              };
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.err("Error: " + err))(function () {
                  return Pulp_Args_Help.printHelp(out)(globals)(commands);
              });
          };
      };
      return Data_Functor["void"](Control_Monad_Eff.functorEff)(Control_Monad_Aff.runAff(failed)(succeeded)(Control_Bind.bind(Control_Monad_Aff.bindAff)(requireNodeAtLeast(Data_Version.version(4)(0)(0)(Data_List_Types.Nil.value)(Data_List_Types.Nil.value)))(function () {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(Data_Functor.map(Control_Monad_Aff.functorAff)(Data_Array.drop(2))(Control_Monad_Eff_Class.liftEff(Control_Monad_Aff.monadEffAff)(Node_Process.argv)))(function (v) {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(Pulp_Args_Parser.parse(globals)(commands)(v))(function (v1) {
                  if (v1 instanceof Data_Either.Left) {
                      return handleParseError(Data_Array.head(v))(Text_Parsing_Parser.parseErrorMessage(v1.value0));
                  };
                  if (v1 instanceof Data_Either.Right && v1.value0 instanceof Data_Either.Left) {
                      return Pulp_Args_Help.printCommandHelp(out)(globals)(v1.value0.value0);
                  };
                  if (v1 instanceof Data_Either.Right && v1.value0 instanceof Data_Either.Right) {
                      return runWithArgs(v1.value0.value0);
                  };
                  throw new Error("Failed pattern match at Main line 230, column 17 - line 236, column 38: " + [ v1.constructor.name ]);
              });
          });
      })));
  })();
  var argsParserDiagnostics = function (opts) {
      var out = Pulp_Outputter.makeOutputter(false);
      return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.log("Globals: " + Data_Show.show(Data_Map.showMap(Data_Show.showString)(Data_Maybe.showMaybe(Data_Show.showString)))(Data_Functor.map(Data_Map.functorMap)(Data_Functor.map(Data_Maybe.functorMaybe)(Pulp_System_FFI.unsafeInspect))(opts.globalOpts))))(function () {
          return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.log("Command: " + opts.command.name))(function () {
              return Control_Bind.bind(Control_Monad_Aff.bindAff)(out.log("Locals: " + Data_Show.show(Data_Map.showMap(Data_Show.showString)(Data_Maybe.showMaybe(Data_Show.showString)))(Data_Functor.map(Data_Map.functorMap)(Data_Functor.map(Data_Maybe.functorMaybe)(Pulp_System_FFI.unsafeInspect))(opts.commandOpts))))(function () {
                  return out.log("Remainder: " + Data_Show.show(Data_Show.showArray(Data_Show.showString))(opts.remainder));
              });
          });
      });
  };
  exports["argsParserDiagnostics"] = argsParserDiagnostics;
  exports["buildArgs"] = buildArgs;
  exports["buildishArgs"] = buildishArgs;
  exports["commands"] = commands;
  exports["defaultDependencyPath"] = defaultDependencyPath;
  exports["failed"] = failed;
  exports["globals"] = globals;
  exports["main"] = main;
  exports["moduleArgs"] = moduleArgs;
  exports["pathArgs"] = pathArgs;
  exports["remainderToBundle"] = remainderToBundle;
  exports["remainderToProgram"] = remainderToProgram;
  exports["remainderToPsc"] = remainderToPsc;
  exports["remainderToPscDocs"] = remainderToPscDocs;
  exports["remainderToPsci"] = remainderToPsci;
  exports["remainderToTest"] = remainderToTest;
  exports["requireNodeAtLeast"] = requireNodeAtLeast;
  exports["runArgs"] = runArgs;
  exports["runWithArgs"] = runWithArgs;
  exports["succeeded"] = succeeded;
  exports["logStack"] = $foreign.logStack;
})(PS["Main"] = PS["Main"] || {});
PS["Main"].main();