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 –