I'm beginning to learn Haskell and, while it's generally been great, some particularities of the type class system have led to a lot of frustration during numerically-focused projects. As a concrete example, if I open up ghci and check the type of addition, I get:
Prelude> :t (+)
(+) :: Num a => a -> a -> a
Addition is super-generic, Num
is the most generic type class, etc, so everything makes sense. But if I declare some function to be addition, and then check the type of that function, the type class gets reduced to Integer
!
Prelude> let add = (+)
Prelude> :t add
add :: Integer -> Integer -> Integer
So... what's going on?