我在 Real World Haskell 书中遇到了以下功能:
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
?我->
在函数类型签名中看到过,但这在这段代码中做了什么。