Skip to content

Instantly share code, notes, and snippets.

View gsimard's full-sized avatar

Guillaume Simard gsimard

View GitHub Profile
@gsimard
gsimard / option.js
Last active August 29, 2015 14:18 — forked from igstan/option.js
// `unit` is `return` from Haskell
// `bind` is `>>=` from Haskell, or `flatMap` from Scala
var None = {
bind: function (fn) { return this; },
unit: function (v) { return Option(v); },
getOrElse: function (elseValue) { return elseValue; }
};
var Some = function (value) {