Skip to content

Instantly share code, notes, and snippets.

@UserGalileo
Created April 14, 2020 17:37
Show Gist options
  • Save UserGalileo/9fcb05a9c79f45d970a70f39de93b626 to your computer and use it in GitHub Desktop.
Save UserGalileo/9fcb05a9c79f45d970a70f39de93b626 to your computer and use it in GitHub Desktop.
Monoid falling into the same set
const f = x => Identity(x + 1); // a -> M a
const g = x => Identity(x + 2); // a -> M a
const h = x => Identity(x + 3); // a -> M a
const f_g = op(f,g); // a -> M a
// We call it with an "a", we get back a "M a"
const Ma = f_g('whatever');
// Identity(whatever12)
inspect(Ma);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment