这是我试图在ghci中要做到:为什么Data.Text示例不适合我?
import Data.Text
strip " abc "
我收到此错误信息:
<interactive>:1:6:
Couldn't match expected type `Text' against inferred type `[Char]'
In the first argument of `strip', namely `" abc "'
In the expression: strip " abc "
In the definition of `it': it = strip " abc "
我期待这个工作,因为它是在许多网页包括这个答案给出:In Haskell, how do you trim whitespace from the beginning and end of a string?
我在做什么错?
重载字符串是最容易通过将编译到您的名为.hs文件的第一行来启用:'{ - #语言OverloadedStrings# - }' – 2011-06-16 21:09:31