Skip to content

Instantly share code, notes, and snippets.

@forketyfork
Created May 11, 2021 06:57
Show Gist options
  • Save forketyfork/7b4acd7d7e2cb0ce6ec859c522ab1625 to your computer and use it in GitHub Desktop.
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"
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