简体   繁体   中英

How to understand “(Num b) => length :: [a] -> b” in Haskell?

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 "?

你是对的:这本书中的错误应该按照你的建议阅读。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM