Next | Types Are Theorems; Programs Are Proofs | 18 |
In Haskell, you can construct a pair of values:
(1, "foo") :: (Int, String)
(True, []) :: (Bool, [a])
(1, (True, "foo")) :: (Int, (Bool, String))
If you have values x :: a and y :: b you can construct:
(x, y) :: (a, b)
If you have value z :: (a,b), you can extract:
fst z :: a snd z :: b
Next | Next |