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パーサーが可能な限り何度も適用されることを意味しますが、少なくとも1回は適用されます。
manyは似ていますが、解析もできません。そのような場合、失敗する代わりにreturningします。[]
return
[]
の場合Maybe、Just ...「失敗」することはないため、パーサーはsome $ Just 42ループします。
Maybe
Just ...