我試圖改寫:不能穿插「」和unwords被用作替換對方的替代品嗎?
return $ renderHtml $ mconcat $ intersperse " " $ catMaybes links
這工作得很好,分爲:
return $ renderHtml $ mconcat $ unwords $ catMaybes links
,但它返回:
Couldn't match type ‘Char’
with ‘blaze-markup-0.7.0.2:Text.Blaze.Internal.MarkupM()’
Expected type: H.Html
Actual type: Char
In the second argument of ‘($)’, namely
‘mconcat $ unwords $ catMaybes links’
In the second argument of ‘($)’, namely
‘renderHtml $ mconcat $ unwords $ catMaybes links’
In a stmt of a 'do' block:
return $ renderHtml $ mconcat $ unwords $ catMaybes links
我不是最大的哈斯克爾還,但我認爲intersperse " "
和unwords
哪裏只是在互相替換?
編輯:最後,我想找出一種方法來使用unwords
...弄清楚爲什麼它給我的錯誤,我怎麼能解決它是我們的目標! =)
它們是不同的類型。 'mconcat。散佈「」一起是「unwords」。 –
@ n.m。或者只是'concat。 Intersperse「」' – AJFarmar