class MyConstants a where
one :: a
ten :: a
instance MyConstants Int where
one = 1
ten = 10
instance MyConstants Float where
one = 1.0
ten = 10.0
instance MyConstants String where
one = "one"
ten = "ten"
main = do
putStrLn . show $ (ten :: Int)
putStrLn . show $ (one :: String)
putStrLn . show $ (ten :: Float) + one
putStrLn . show $ "Count from " ++ one ++ " to " ++ ten