<div dir="ltr"><span style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px">Dear Cafe,</span><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px"><br class="gmail-"></div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px">I'm still not fully clear about the confusion regarding megaparsec's behavior that I posted lately here. But now comes to my mind that it may have some problem rooted in the lacking of recoverability semantic with respect to parser combinators, some quoting from <a href="http://hackage.haskell.org/package/parser-combinators/docs/Control-Applicative-Combinators.html" class="gmail-">http://hackage.haskell.org/package/parser-combinators/docs/Control-Applicative-Combinators.html</a></div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px"><br class="gmail-"></div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px">The  *A note on backtracking* section</div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px"><br class="gmail-"></div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px">> <span class="gmail-" style="color:rgb(232,230,227);font-family:sans-serif;font-size:13px">Combinators in this module are defined in terms </span><code class="gmail-" style="margin:0px;padding:0px;line-height:16.12px;color:rgb(232,230,227);font-size:13px"><a href="http://hackage.haskell.org/package/base-4.12.0.0/docs/Control-Applicative.html#t:Applicative" title="Control.Applicative" class="gmail-" style="margin:0px;padding:0px;color:rgb(179,120,101);text-decoration-line:none">Applicative</a></code><span class="gmail-" style="color:rgb(232,230,227);font-family:sans-serif;font-size:13px"> and </span><code class="gmail-" style="margin:0px;padding:0px;line-height:16.12px;color:rgb(232,230,227);font-size:13px"><a href="http://hackage.haskell.org/package/base-4.12.0.0/docs/Control-Applicative.html#t:Alternative" title="Control.Applicative" class="gmail-" style="margin:0px;padding:0px;color:rgb(179,120,101);text-decoration-line:none">Alternative</a></code><span class="gmail-" style="color:rgb(232,230,227);font-family:sans-serif;font-size:13px"> operations.</span></div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px"><span class="gmail-" style="color:rgb(232,230,227);font-family:sans-serif;font-size:13px"><br class="gmail-"></span></div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px">And `empty`'s doc:</div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px"><br class="gmail-"></div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px">> <span class="gmail-" style="color:rgb(232,230,227);font-family:sans-serif;font-size:13px">This parser fails unconditionally without providing any information about the cause of the failure.</span></div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px"><br class="gmail-"></div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px">Clearly `empty` is used to express failure, but there is seemingly no device to explicitly express whether a failure is recoverable. Then I observed megaparsec's implicit rule as currently implemented is like:</div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px"><br class="gmail-"></div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px">*) a failure with no input consumed can be recovered by rest parsers</div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px">*) a failure with some input consumed can not be recovered by rest parsers</div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px"><br class="gmail-"></div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px">This works to great extent, but I would think the expressiveness can be further extended for a parser from the application, to tell the library that some input induces recoverable failure.</div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px"><br class="gmail-"></div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px">I have no expertise to suggest whether `MonadPlus` and/or `MonadFail` are suitable devices to be considered, but as megaparsec has implemented instances for them, I do feel some tweaks would be possible and meaningful.</div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px"><br class="gmail-"></div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px">Best regards,</div><div class="gmail-" style="color:rgb(255,255,255);font-family:Helvetica;font-size:12px">Compl</div><br class="gmail-Apple-interchange-newline"></div>