Skip to content

Instantly share code, notes, and snippets.

@dewey92
Created April 4, 2019 01:15
Show Gist options
  • Select an option

  • Save dewey92/d1a66d64c21e24e451d2694ce8df0bf6 to your computer and use it in GitHub Desktop.

Select an option

Save dewey92/d1a66d64c21e24e451d2694ce8df0bf6 to your computer and use it in GitHub Desktop.
Object Monoid
const obj = createMonoid({
indentity: {},
semigroup: (a, b) => { ...a, ...b }, // Object.assign({}, a, b)
});
log(obj.id) // => {}
log(obj.append({ a: 1 }, { b: 2 })) // => { a: 1, b: 2 }
log(obj.append({ a: 1 }, obj.id)) // => { a: 1 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment