You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
420 B
Haskell

calcChange :: (Ord p, Num p) => p -> p -> p
calcChange owed given = if change > 0
then change
else 0
where change = given - owed
inc :: Num a => a -> a
inc x = x + 1
double :: Num a => a -> a
double x = x * 2
square :: Num a => a -> a
square x = x * x
evenOrOdd :: Integral a => a -> a
evenOrOdd n = if even n
then n - 2
else 3 * n + 1