-- COMP1100 Semester 1, 2006.

-- Laboratory week 3, exercise 3.

-- Clem Baker-Finch


-- This Haskell script contains some simple and common errors.  As one
-- of the Week 3 Laboratory exercises, you should load it into GHCi
-- 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 GHCi.

----------------------------------------------------------------------------

-- Let's define a function that finds the minimum of two numbers.
-- There is already such a function `min' in the standard prelude, 
-- but this is just an exercise.

myMinimum :: Int -> Int -> Int
myMinimum x y
    | x <= y     = x
    | otherwise  = y

-- Next is a definition of a function that doesn't do anything very
-- useful, but it does show you to be careful with where clauses.

f :: Int ->Int -> Int
 f x y
    | x > 10  = a
    |otherwise  = x - a
    where a = square (y+1)
          square x = x * x

