mrkkrp/megaparsec

Provide default many/some implementations via MonadPlus?

Closed this issue · 1 comments

I understand that according to #163, the implementations of some and many from Alternative are slower than the MonadPlus implementations.

But does anything prevent us from doing this?

instance (Ord e, Stream s) => Alternative (ParsecT e s m) where
  empty = mzero
  (<|>) = mplus
  some = Control.Monad.Combinators.some
  many = Control.Monad.Combinators.many

This way the user would always get the fastest some and many implementations regardless of whether they follow the advice to use Control.Monad.Combinators or not. Am I missing something?

As long as this compiles and passes the test suite I'm happy to merge it!