以下是我在ghci中尝试的操作:
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 "
我本以为这个方法会有效,因为它在很多网页上都有提到,包括这篇答案:在Haskell中,如何从字符串的开头和结尾去除空格?
我哪里做错了吗?
{-# LANGUAGE OverloadedStrings #-}
。 - Thomas M. DuBuisson