Created
May 11, 2021 06:57
-
-
Save forketyfork/7b4acd7d7e2cb0ce6ec859c522ab1625 to your computer and use it in GitHub Desktop.
Code to article "Why You Should Learn Functional Programming: Type Classes vs. Interfaces"
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
instance Num a => Monoid (Product a) where | |
mempty = Product 1 | |
Product x `mappend` Product y = Product (x * y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment