
complejos...
By: a guest on
Mar 20th, 2012 | syntax:
Haskell | size: 0.51 KB | hits: 37 | expires: Never
module Main (main) where
import System.Environment
data Complex = Complex (Int, Int)
instance Show Complex where
show a = "(" ++ show (pairFst a) ++ ", " ++ show (pairSnd a) ++ ")"
instance Eq Complex where
x == y = (pairFst x == pairFst y) && (pairSnd y == pairSnd x)
pairFst :: Complex -> Int
pairFst (Pair (a, b)) = a
pairSnd :: Complex -> Int
pairSnd (Pair (a, b)) = b
main :: IO ()
main = let a = Pair (1, 1)
b = Pair (1, 1)
in putStrLn $ show $ a == b