Safe HaskellSafe

S01

Contents

Synopsis

Exercise 3

n :: Int Source #

The previous version was

N = a 'div' length xs
   where
       a = 10
     xs  = [1,2,3,4,5]

containing the following errors:

  1. N is not allowed as function name (since it is uppercase).
  2. the proper way of turning a function infix is `div` instead of 'div'
  3. the second item of the where-group has to be indented exactly like the first one

Exercise 4

last :: [a] -> a Source #

last' :: [a] -> a Source #

Exercise 5

init :: [a] -> [a] Source #

init' :: [a] -> [a] Source #

Exercise 6

gcd :: Int -> Int -> Int Source #