I have defined the following function addtofour:
addtofour :: Int -> Int
addtofour x = 4 + x
When I load this into ghci this works fine. However, when I try to concatenate it with a value returned by LogBase, it won't work.
I tried:
logbase 2 3 -- returns 1.58..
addtofour logBase 2 3 -- error, expected 1.58 + 4 = 5.58
addtofour (logBase 2 3) -- error, expected 1.58 + 4 = 5.58
I expect logBase 2 3 to return an Int, which I can then put into my addtofour function. But this somehow fails. I guess it has to do with the domain of my addtofour function. But why would I have to change that? f(x) = 4+x does Int -> Int
logbase 2 3 // returns 1.58..?addtofour :: Num a => a -> alets you add4to a value of any numeric type (since4itself has typeNum a => a).