【发布时间】:2019-04-21 14:00:33
【问题描述】:
这个函数有什么问题?
test :: Show s => s
test = "asdasd"
String 是Show 类的一个实例,所以看起来是正确的。
错误是
src\Main.hs:224:7:
Couldn't match expected type `s' against inferred type `[Char]'
`s' is a rigid type variable bound by
the type signature for `test' at src\Main.hs:223:13
In the expression: "asdasd"
In the definition of `test': test = "asdasd"
【问题讨论】:
标签: haskell