Last active
April 14, 2020 18:24
-
-
Save UserGalileo/5c9fe2a8e84d017aa6cf56cddd03233a to your computer and use it in GitHub Desktop.
Monad Identity Monoid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Here's our unit function | |
const id = x => Identity(x); | |
// Left & Right Identity... | |
const identity1 = op(f, id); | |
const identity2 = op(id, f); | |
// ...are the same! | |
inspect(identity1('i')); // Identity(i1) | |
inspect(identity2('i')); // Identity(i1) | |
/** | |
* We can say that: | |
* | |
* op(f,id) EQUALS op(id, f) | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment