Skip to content

Instantly share code, notes, and snippets.

@dasch
Last active Oct 28, 2017
Embed
What would you like to do?
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