这个功能有什么问题?
test :: Show s => s
test = "asdasd"
Run Code Online (Sandbox Code Playgroud)
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"
Run Code Online (Sandbox Code Playgroud) haskell ×1