我不明白这个——
Prelude> "hi"++"there"
"hithere"
Prelude> "hi":"there"
<interactive>:12:6:
Couldn't match expected type `[Char]' with actual type `Char'
Expected type: [[Char]]
Actual type: [Char]
In the second argument of `(:)', namely `"there"'
In the expression: "hi" : "there"
Prelude>
为什么它不返回“hithere”?
类型。在 GCHi 中试试这个:
Prelude> :t (:)
(:) :: a -> [a] -> [a]
Prelude. :t (++)
(++) :: [a] -> [a] -> [a]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)