字符列表与 Idris 中的字符串不同吗?
Are character lists different than Strings in Idris?
在Haskell中,下面会打印"hello":putStrLn (['h', 'e', 'l', 'l', 'o'])
,然而,这会导致Idris中的编译错误:
48 | main = do
| ~~ ...
When checking right hand side of main with expected type
IO ()
When checking an application of function Prelude.Interactive.putStrLn:
Can't disambiguate since no name has a suitable type:
Prelude.List.::, Prelude.Stream.::
我怀疑这是因为 String
是 Idris 的内置函数,而不是 Haskell。仍然,可以在 Idris 中使用类型 class 将 List Char
视为 String
的实例(String
是类型 class 吗)?
在Haskell中,下面会打印"hello":putStrLn (['h', 'e', 'l', 'l', 'o'])
,然而,这会导致Idris中的编译错误:
48 | main = do
| ~~ ...
When checking right hand side of main with expected type
IO ()
When checking an application of function Prelude.Interactive.putStrLn:
Can't disambiguate since no name has a suitable type:
Prelude.List.::, Prelude.Stream.::
我怀疑这是因为 String
是 Idris 的内置函数,而不是 Haskell。仍然,可以在 Idris 中使用类型 class 将 List Char
视为 String
的实例(String
是类型 class 吗)?