Skip to content

Instantly share code, notes, and snippets.

@codedmart
Created December 4, 2015 15:38
Show Gist options
  • Select an option

  • Save codedmart/f3fad445b90e6cd9f6ef to your computer and use it in GitHub Desktop.

Select an option

Save codedmart/f3fad445b90e6cd9f6ef to your computer and use it in GitHub Desktop.
var update = function (action) {
return function (state) {
if (action instanceof Update) {
return action.value0;
};
if (action instanceof Alert) {
return state;
};
if (action instanceof DoFoo) {
if (action.value0 instanceof Data_Maybe.Just) {
var _10 = {};
for (var _11 in state) {
if (state.hasOwnProperty(_11)) {
_10[_11] = state[_11];
};
};
_10.foo = action.value0.value0;
return _10;
};
if (action.value0 instanceof Data_Maybe.Nothing) {
return state;
};
throw new Error("Failed pattern match at Stores.App line 174, column 1 - line 175, column 1: " + [ action.value0.constructor.name ]);
};
if (action instanceof Upload) {
return state;
};
if (action instanceof ToggleLoginModal) {
var _15 = {};
for (var _16 in state) {
if (state.hasOwnProperty(_16)) {
_15[_16] = state[_16];
};
};
_15.loginModalIsOpen = action.value0;
return _15;
};
if (action instanceof NoOp) {
return state;
};
throw new Error("Failed pattern match at Stores.App line 174, column 1 - line 175, column 1: " + [ action.constructor.name ]);
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment