CS 254 Lab 1.5: Short, informal exercise (titling)

(I guess this one is not for a grade, but just for practice & for bringing to class on Friday.)

For this short exercise, you should write a songle function in a Haskell script file. The function should take a String argument and return a String result: the output string should look just like the input string, except that:

Hint: you will likely want to use the library functions words, unwords, map, toUpper and toLower. All of these are in the Prelude except for the last two: they are in the Char module. In order to get access to the Char module in your script, start the script file off like this:

module MyFile where
import Char
...

Another hint: you can define some test strings to try out your function on as you work, as in test1 = "hELLo wHIrlED!", etc.

When you are done, your function should behave something like this:

> title "thIS IS a TEST phrase to be TItleD"
"This Is A Test Phrase To Be Titled"