-- This Haskell script contains some simple and common errors. -- In exercise 3, you should load it into Hugs and note the -- error messages that are reported. You should correct the -- errors one at a time by editing and saving this file, then -- reloading into Hugs. -- Here is a definition of a function that doesn't do anything very -- useful, but it does show you how to use a where clause. f :: (Int,Int) -> Int f x y | x > 10 = max x y | otherwise = x - a where a = square (y+1) square x = x * x -- Here is a function to give the next character in the ascii sequence. next :: Char -> Char next c = chr (ord c)+1 -- Here is an attempt to write a definition of a function that adds one -- to its argument. increment :: Int -> Int increment x = x where x = x+1 -- Obviously this definition doesn't make sense! -- How can x possibly equal x+1? That would mean 0==1 ... -- Try increment 3 to see what happens.