 
Summary: Programming Assignment 4
Haskell (20 Points)
Rather than give you one large program to do, you are being asked to do a series of short
functions so that you have experience with a variety of features. Comments begin with
two hyphens and continue to the end of the line. Before each function, insert comments
which illustrate that the function works, i.e. show a few calls to the function and the
output produced.
1. Write isPrime :: Integer > Bool which determines whether a given integer is
prime.
2. Define primes :: [Integer] which returns the list of all primes. This is an infinite
list, but because Haskell uses lazy evaluation, we will only generate as much of
the list as we need. A call such as take 5 primes would return the first five
primes.
3. Sets can be implemented using lists, provided that Ord and Eq operations are
available that implement a total order on potential set elements. Show how a
polymorphic set ADT based on lists can be implemented using Haskell
polymorphic types. Demonstrate that the same code works for sets of Int or sets
of Color. Color is defined as an enumerated type of your favorite colors.
data Color = Red  Blue GreenYellowPurpleOrangePink
deriving (Show,Eq,Ord)
