什么=>意味着在一个类型签名? [英] What does => mean in a type signature?
本文介绍了什么=>意味着在一个类型签名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<$ c $ c> tell ::(Show a)=> [a] - >字符串
这是什么意思,特别是 =>
?我知道如果我用 - >
替换或者删除它,它就行不通了,但我不明白为什么。
>解决方案
它是对类型的约束,意味着 a
应该是类 Show
。
请参阅此处 a>
I just starting Learn you a Haskell, and I saw this used in an example without explanation:
tell :: (Show a) => [a] -> String
What does this mean, in particular the =>
? I know it won't work if I substitute ->
or delete it, but I don't really understand why.
解决方案
It's a constraint on the type, means a
should be an instance of class Show
.
see for example here
这篇关于什么=>意味着在一个类型签名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文