Created
August 15, 2012 22:47
-
-
Save 5outh/3364418 to your computer and use it in GitHub Desktop.
MonoidConstructor
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
instance Monoid Fraction where | |
mempty = 0 | |
mappend = (+) | |
mconcat = foldr mappend mempty | |
(%) :: Integer -> Integer -> Fraction | |
(%) a = simplify . Frac a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment