Created
July 11, 2010 04:50
-
-
Save nonowarn/471287 to your computer and use it in GitHub Desktop.
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 Fractional Integer where | |
fromRational x = 0 | |
instance Fractional Int where | |
fromRational x = 1 | |
a :: Int | |
a = 0 | |
b :: Fractional a => a | |
b = 0.0 | |
c :: Int | |
c = 0 | |
d :: Fractional a => a | |
d = 0.0 | |
main = do | |
print $ a + c == 0 -- True. | |
print $ a == c -- True. a == c == 0. | |
print $ c == 0 -- True. Of course. | |
print $ a + d == 1 -- True. d == 1. | |
print $ b + c == 1 -- True. b == 1. | |
print $ b + d == 0 -- True. What happened?! | |
print $ b == d -- True. ?! | |
print $ d == 0 -- True. ?!?! | |
-- hints to make answer unique (perhaps...) | |
print $ sum [a, b, c] -- 1 | |
print $ sum [a, b, d] -- 1 | |
print $ [a, b, c] !! a -- 0 | |
print $ [a, b, c] !! b -- 1 | |
print $ [a, b, c] !! c -- 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment