-- the final example of functions (that I am doing), is the concept of the -- monad. These are needed for interacting with the real world, and you -- have already seen one, in the form of the main function. -- monads can be made to act rather like functions in normal imperative -- languages, in that statements should usually be written consecutivly function1 :: Int->Int->IO() function1 x y = do let z = x*y putStrLn (show z) -- you can use the where statement aswell function2 :: Int->Int->IO() function2 x y = do let z = x*p putStrLn (show z) where p = x+y -- you can call any normal function from within a monad using either let -- or where. You can call other monads. function3 :: Int->IO() function3 x = do function2 x 7 putStrLn "end" -- you can return things function4 :: Int->IO(Int) function4 x = do return (x*x+x) -- but you need to do something different to get the data back function5 :: IO() function5 = do p<-function4 6 function3 p