Page 1

Types in Haskell

Page 2

Predefined types

Page 3

Collections of things

Tuples

t1 = (False, 42) :: (Bool,Int)

t2 = ("Hello",False,5) :: (String,Bool,Int)

t3 = ("Haskell",True,4,0.5) :: (String,Bool,Int,Double)

t0 = () :: ()    -- the empty tuple
Page 4
Collections of things

Lists

l1 = [2,3,5,7,11] :: [Integer]

l2 = ["Hello","world"] :: [String]

l3 = [] :: [Bool]

l4 = [] :: [Int]   -- the empty list has many types
Page 5

Maybe and Either

Page 6

Function types

power :: Integer -> Integer -> Integer

exampleFunction :: (Bool, Int, String) -> Bool

doubles :: [Integer] -> [Integer]

summary :: [String] -> String
Page 7

Types can be combined in arbitrary ways

Page 8

Polymorphism (generic functions)

Page 9

Overloading (restricted polymorphism)