Last active
October 28, 2017 22:09
-
-
Save dasch/18e77c22f08a12778d12960dd456fb45 to your computer and use it in GitHub Desktop.
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
type Product = Product Integer | |
instance Monoid Product where | |
empty : Product | |
empty = Product 1 | |
add : Product -> Product -> Product | |
add (Product x) (Product y) = Product (x * y) | |
instance (Monoid a, Monoid b) => Monoid (a, b) where | |
empty : (a, b) | |
empty = (empty, empty) | |
add : (a, b) -> (a, b) -> (a, b) | |
add (x1, x2) (y1, y2) = (add x1 y1, add x2 y2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment