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.
some有什么many用Control.Applicative.Alternative?如果我写类似的东西some $ Just 42,它似乎会导致无限递归,这似乎不是很有用......
some
many
Control.Applicative.Alternative
some $ Just 42
当用作解析器组合器时,它们是有意义的。
some意味着解析器被尽可能多地应用,但至少一次。
many类似,但也不允许解析,在这种情况下returning[]而不是失败。
return
[]
在 的情况下Maybe,Just ...永远不会“失败”,因此您的解析器会some $ Just 42循环。
Maybe
Just ...