Created
May 13, 2012 14:20
-
-
Save pbadenski/2688654 to your computer and use it in GitHub Desktop.
haskell money types
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
data Dollars = Dollars | |
data Euro = Euro | |
class Money a where | |
(+) :: (Int, a) -> (Int, a) -> Int | |
(+) (a, _) (b, _) = (Prelude.+) a b | |
instance Money Dollars | |
instance Money Euro |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment