Introduction to Programming Assignment 5, 5 Nov 2008 Due Mon 17 Nov 2008 Note: Remember to always supply a type definition for every function you write, including any auxiliary functions that you may define to solve the given problem. grep grep is a useful unix command to identify lines in a text file that match a pattern. In its most basic form, grep will take a fixed string of characters (a pattern) and a file name, and report all lines in the file that contain that pattern, prefixed by the line number. A typical example is shown here. $ grep memofib lecture19-03nov2008.txt 252: fib n = memofib n [] 254:The function memofib takes an argument for which the function is 258: memofib :: Int -> [(Int,Int)] -> (Int,[(Int,Int)]) 259: memofib n l 280: (vala,memoa) = memofib (n-1) l 281: (valb,memob) = memofib (n-2) memoa 382: fib n = memofib n emptytable 384: memofib :: Int -> [Table Int Int] -> (Int,Table Int Int) 385: memofib n t 391: (vala,memoa) = memofib (n-1) l 392: (valb,memob) = memofib (n-2) memoa 398:in the definition of fib/memofib. (Note: In unix, you actually have to say "grep -n" to get the line numbers, ...). Write a Haskell program that does the following: 1. Ask the user for the string to use as a pattern. 2. Ask the user for the name of an input file. 3. Print out the line number and contents of each line that contains the pattern string, similar to the example above. IMPORTANT: When you use "putStr" to prompt the user for input in steps 1 and 2, terminate your string with "\n". Your program should additionally have the following features: 1. It should compile into a standalone program using the compiler "ghc". Submit your code in two modules: Main.hs -- contains just one function "main" Grep.hs -- contains all the other functions required to solve the assignment 2. Your program should handle the following exceptions: a. If the input file specified by the user does not exist, your program should print "Input file does not exist" and exit. b. All other exceptions can be passed on to a higher level using the function "ioError". "File does not exist" is signalled by the exception isDoesNotExistError :: IOError -> Bool ======================================================================