I've got three functions
boombangs xs = [if x < 10 then "BOOM" else "BANG" | x <- xs odd x]
length' xs = sum [1 | _ <- xs]
removeNonUppercase st = [x | x <- st, x `elem` ['A'..'Z']]
Here's what I get for the type(type signature?) of each function
*Main> :t boombangs
boombangs :: Integral a => [a] -> [[Char]]
*Main> :t length'
length' :: Num a => [t] -> a
*Main> :t removeNonUppercase
removeNonUppercase :: [Char] -> [Char]
Haskell should give me an error when I pass an array of ints to removeNonUppercase or a string to boombangs. It does too, but how does it know it's wrong when I haven't specified the type anywhere.
Also why are the types of boombangs and removeNonUppercase different even though they work on the same input.
I apologize if the question seems vague or downright ignorant. I've just started on Learn You a Haskell and I'm slowly wrapping my head around this paradigm coming from programming mainly in C and python.
Any resources for learning more about haskell and the type system would also be appreciated.