apply: (mf) => {
var self = this;
return (ma) => {
return self.flatMap(mf)((f) => {
return self.flatMap(ma)((a) => {
return self.unit(f(a));
});
});
};
},
get: (maybe) => {
var self = this;
return self.getOrElse(maybe)(null);
},
getOrElse: (instance) => {
var self = this;
return (alternate) => {
return self.match(instance,{
just: (value) => {
return value;
},
nothing: (_) => {
return alternate;
}
});
};
},
isEqual : (maybeA) => {
var self = this;
return (maybeB) => {
return self.match(maybeA,{
just: (valueA) => {
return self.match(maybeB,{
just: (valueB) => {
return (valueA === valueB);
},
nothing: (_) => {
return false;
}
});
},
nothing: (_) => {
return self.match(maybeB,{
just: (_) => {
return false;
},
nothing: (_) => {
return true;
}
});
}
});
};
}
},
Either: {
match: (data, pattern) => {
return data.call(data,pattern);
},
left : (value) => {
return (pattern) => {
return pattern.left(value);
};
},
right : (value) => {
return (pattern) => {
return pattern.right(value);
};
},