2
我遇到下面的真實世界哈斯克爾書功能:意義(東西 - >做)
namesMatching pat
| not (isPattern pat) = do
exists <- doesNameExist pat
return (if exists then [pat] else [])
| otherwise = do
case splitFileName pat of
("", baseName) -> do
curDir <- getCurrentDirectory
listMatches curDir baseName
(dirName, baseName) -> do
-- do something
return (concat pathNames)
什麼以下行平均:("", baseName) -> do
?我在函數類型簽名中看到了->
,但是在這段代碼中它做了什麼?
http://www.haskell.org/haskellwiki/Keywords#-.3E –