Troubleshooting
Common issues:
-
translated
generates an error:Couldn't match expected type ‘Double’ with actual type ‘Int’ In the first argument of ‘translated’, namely ‘x’
The
translated
function needs decimals (Double
) for inputs. Solution: use(fromIntegral x)
to treat the int as a decimal. -
Need to convert an Int to a Double: use
fromIntegral
. -
Error about
No instance for (Integral Double)
: you rounded a double and now you have an integer. Put infromIntegral
to allow the integer to change back to a Double.