This is simple code designed to take a decimal number and return a string representing the equivalent in binary.
b2d :: Int -> String
b2d 1 = "1"
b2d x = show (x `mod` 2) ++ b2d x/2
However, when I try to run this through hugs, it gives me an error:
:3 - Instance of fractional [Char] required for definition of b2d
I don't know what this means. Can anyone tell me how to fix it?
Cheers.