Haskell - What is Control.Applicative.Alternative good for?

后端 未结 2 339
慢半拍i
慢半拍i 2020-12-15 04:26

I was looking at the Applicative class within Haskell libraries and stumbled across Alternative.

What is this class good for? A google sear

2条回答
  •  温柔的废话
    2020-12-15 04:58

    It's commonly used with parser combinators. For example, if space is a parser combinator that matches a single whitespace character, many space would be one that would match consecutive whitespace.

    I can agree that it's slightly out of place in Control.Applicative, though.

提交回复
热议问题