我试图编写一个包含字符串的助手函数,如果该字符串有多个空格,它只会将其转换为一个字符串。以下是代码:
getSpaces :: String -> String
getSpaces index =
if (length index) == 1 then index
else
if isInfixOf " " index then index = " "
else index
当我试图将我的模块加载到GHCI中时,我会得到以下错误:
Prelude> :l Utilities
[1 of 1] Comp
请描述您的问题
标题:腾讯云新春采购节——多买多优惠,续费升级礼包领不停!
地址:https://cloud.tencent.com/act/season?utm_source=portal&utm_medium=rightbanner&utm_campaign=season&utm_term=0308
浏览器信息
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:58.0) Gecko/20100101 Firefox/58.0