【发布时间】:2018-03-12 14:26:15
【问题描述】:
在我正在阅读的代码库中,我发现了这样的函数声明(缺少某些部分):
filepathNormalise :: BS.ByteString -> BS.ByteString
filepathNormalise xs
| isWindows, Just (a,xs) <- BS.uncons xs, sep a, Just (b,_) <- BS.uncons xs, sep b
= '/' `BS.cons` f xs
逗号在这里有什么作用?
(仅作为奖励,如果有人很容易知道这一点:Haskell Programming from first principle 中是否提到了这种语法,如果有,在哪里?因为我不记得读过它。)
【问题讨论】:
-
我猜它等同于逻辑和?但我可以想象,其他 haskell 初学者也会有同样的问题,因此我认为,在 stackoverflow 上提出这个问题可能会很好。
-
即使您知道答案,也最好发布这个问题(如果是这样的话,可能连同答案一起发布)。
-
更新the wiki。
标签: haskell syntax guard-clause pattern-guards