Last active
April 4, 2019 08:08
-
-
Save dewey92/a8d188d0ee78f1d816c84a3fd3a100d0 to your computer and use it in GitHub Desktop.
CSS 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
| const cssColor = createMonoid({ | |
| indentity: 'transparent', | |
| semigroup(a, b) { | |
| if (a === this.identity) return b; | |
| if (b === this.identity) return a; | |
| // entah gimana implementasinya | |
| // ... | |
| return result; | |
| } | |
| }); | |
| log(cssColor.id) // => 'transparent' | |
| log(cssColor.append('#AAAAAA', '#4F22AC')) // => '#7D66AB' | |
| log(cssColor.append('#AAAAAA', cssColor.id)) // => '#AAAAAA' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment