What are some and many in Control.Applicative.Alternative good for? If I write something like some $ Just 42, it seems to cause infinite recursion, which seems not very useful…
What are some and many in Control.Applicative.Alternative good for? If I write something like
Share
They make sense when used as parser combinators.
somemeans that the parser is applied as many times as possible, but at least once.manyis similar, but allows for no parse as well,returning[]in such case instead of failing.In case of
Maybe,Just ...never “fails”, thus your parsersome $ Just 42loops.