Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save UserGalileo/2aeda4a52fa752f6fb18b4dab92adf43 to your computer and use it in GitHub Desktop.
Save UserGalileo/2aeda4a52fa752f6fb18b4dab92adf43 to your computer and use it in GitHub Desktop.
Composing Functions yielding monadic values
// These are our new elements
const f = x => Identity(x + 1);
const g = x => Identity(x + 2);
const h = x => Identity(x + 3);
// For now, let's just compose 2 of them.
const composed = f('a').chain(g);
// Identity(a12)
inspect(composed);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment