I am reading Learn You a Haskell for Great Good!, and come across the following word:
For instance, the length function has a type declaration of length :: [a] -> Int instead of having a more general type of (Num b) => length :: [a] -> b.
How to understand "(Num b) => length :: [a] -> b
" here? Shouldn't it be "length :: (Num b) => [a] -> b
"?
You're right: it's an error in the book and should read as you suggest.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With