I am wondering why I'm getting this error. It's for an assignment where i'm to convert from an integer to a hex value. I call this helper conversion function when I mod the integer value by 16
. (concatenated with the integer value which I then divide by 16
in a recursive call)
Here is my code:
changeToHex :: Integer -> String
--main function
toHex :: Integer -> String
toHex x
|x == 0 = '0'
|x == 1 = '1'
|x == 2 = '2'
|x == 3 = '3'
|x == 4 = '4'
|x == 5 = '5'
|x == 6 = '6'
|x == 7 = '7'
|x == 8 = '8'
|x == 9 = '9'
|x == 10 = 'A'
|x == 11 = 'B'
|x == 12 = 'C'
|x == 13 = 'D'
|x == 14 = 'E'
|x == 15 = 'F'