Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这样的东西
isLastPermutation (h:t)= catch (nextPermutation (h:t)) (\e-> return True) return False
在某些情况下nextPermutation会抛出异常,如果抛出异常,我希望我的函数isLastPermutation返回 true,nextPermutation否则返回 false。
nextPermutation
isLastPermutation
不要在纯 Haskell 中使用异常进行流控制。使用Maybe或Either。
Maybe
Either