/*! Monad - v0.1.0 - 2013-09-13 * https://github.com/mbseid/Monad.js * Copyright (c) 2013 Michael Seid; Licensed MIT */ !function(a,b){"use strict";var c="undefined"!=typeof module&&module.exports,d=function(a){var b={};return a&&"[object Function]"===b.toString.call(a)},e=function(){for(var a=this.get,b=0,c=arguments.length;c>b;b++){var d=arguments[b];if(d.shouldCallback.apply(this))return d.callback.apply(this,[a])}},f=function(a){return this.get=a,this};f.prototype.isDefined=function(){return!("undefined"==typeof this.get||null===this.get)},f.prototype.getOrElse=function(a){return this.isDefined()?this.get:d(a)?a():a},f.prototype.match=e,a.Option=f,a.Some=function(a){return this.get=a,this},a.Some.prototype=a.Option.prototype,a.None=function(){return this.get=b,this},a.None.prototype=a.Option.prototype,a.case=function(a,b){var c=function(){var b=!1;return d(a)?b=!!a.apply(this):this instanceof a&&(b=!0),b};return{shouldCallback:c,callback:b}};var g=function(a){return this.get=a,this};a.Either=function(){return this},a.Either.prototype.match=e,a.Either.prototype.fold=function(b,c){return this.match(a.case(a.Left,b),a.case(a.Right,c))},a.Left=g,a.Left.prototype=a.Either.prototype,a.Right=g,a.Right.prototype=a.Either.prototype,c?a=a:"undefined"==typeof ender&&(this.M=a)}("object"==typeof exports&&exports||this);