<div dir="ltr"><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 28, 2015 at 2:28 PM, Jeffrey Brown <span dir="ltr"><<a href="mailto:jeffbrown.the@gmail.com" target="_blank">jeffbrown.the@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I imagine a parser that operates on (String,[String]) pairs, for which the second element allows the user to define precedence on the fly.</blockquote></div><br></div>Let's use the Parser newtype<br><br>newtype Parser a = Parser { parse :: String -> [(a,String)] }<br><br></div>from<br><div><br><a href="http://dev.stephendiehl.com/fun/002_parsers.html">http://dev.stephendiehl.com/fun/002_parsers.html</a><br><div class="gmail_signature"><br></div><div class="gmail_signature">as a basis for discussion.<br><br>Now you want to "operate on (String,[String]) pairs", so the Parser newtype must now look like this:<br><br></div><div class="gmail_signature">type MyInput = (String,[String])<br><br></div><div class="gmail_signature">newtype MyParser a = MyParser { parse :: MyInput -> [(a,MyInput)] }<br><br></div><div class="gmail_signature">Is this what you have in mind?<br><br>-- Kim-Ee</div><div class="gmail_extra">
</div></div></div>