Last active
April 4, 2019 07:52
-
-
Save dewey92/f7593bcf123eca1457288e5750dceece to your computer and use it in GitHub Desktop.
Boolean Monoid
This file contains hidden or 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
| // OR | |
| const boolOr = createMonoid({ | |
| indentity: false, | |
| semigroup: (a, b) => a || b, | |
| }); | |
| log(boolOr.id) // => false | |
| log(boolOr.append(true, boolOr.id)) // => true | |
| log(boolOr.append(false, boolOr.id)) // => false | |
| // AND | |
| const boolAnd = createMonoid({ | |
| indentity: true, | |
| semigroup: (a, b) => a && b, | |
| }); | |
| log(boolAnd.id) // => true | |
| log(boolAnd.append(true, boolAnd.id)) // => true | |
| log(boolAnd.append(false, boolAnd.id)) // => false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment