length::[a] -> b"?-6ren"> length::[a] -> b"?-我正在阅读Learn You a Haskell for Great Good! ,并遇到以下单词: For instance, the length function has a type decl-6ren">
gpt4 book ai didi

haskell - 如何理解Haskell中的 "(Num b) => length::[a] -> b"?

转载 作者:行者123 更新时间:2023-12-02 19:41:16 25 4
gpt4 key购买 nike

我正在阅读Learn You a Haskell for Great Good! ,并遇到以下单词:

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.

这里如何理解“(Num b) => length::[a] -> b”?不应该是“length::(Num b) => [a] -> b”吗?

最佳答案

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

关于haskell - 如何理解Haskell中的 "(Num b) => length::[a] -> b"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34645718/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com