[ create a new paste ] login | about

Link: http://codepad.org/WXVXxOve    [ raw code | output | fork ]

JeremyBanks - Haskell, pasted on Feb 1:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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


Output:
1
2
3
4
10
"one"
11.0
"Count from one to ten"


Create a new paste based on this one


Comments: