<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>Make the #uses expr #because expr #needs part act like an operator?</div><div><br></div><div>Doaitse</div><div><br>Op 19 aug. 2017 om 05:56 heeft Jeffrey Brown <<a href="mailto:jeffbrown.the@gmail.com">jeffbrown.the@gmail.com</a>> het volgende geschreven:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div>I want to write a parser that lets someone write "(a #uses b) #because (c #needs d)" and read it into a tree:</div><div><br></div><div> data Tree = Tree String Tree Tree | Leaf String</div><div> magic "(a #uses b) #because (c #needs d)"</div><div> = Tree "because" (Tree "uses" (Leaf "a") (Leaf "b"))</div><div> (Tree "needs" (Leaf "c") (Leaf "d"))</div><div><br></div><div>I thought I could use Text.Megaparsec.Expr for it, but now I realize it hadnles binary operations, and this is a ternary one.</div><div><br></div><div>Suggestions?</div><div><br></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Jeff Brown | Jeffrey Benjamin Brown</div><div dir="ltr"><a href="https://msu.edu/~brown202/" style="font-size:12.8px" target="_blank">Website</a> | <a href="https://www.facebook.com/mejeff.younotjeff" style="font-size:12.8px" target="_blank">Facebook</a> | <a href="https://www.linkedin.com/in/jeffreybenjaminbrown" style="font-size:12.8px" target="_blank">LinkedIn</a><span style="font-size:12.8px">(spammy, so I often miss messages here) </span><span style="font-size:12.8px">|</span><span style="font-size:12.8px"> </span><a href="https://github.com/jeffreybenjaminbrown" style="font-size:12.8px" target="_blank">Github</a><span style="font-size:12.8px"> </span></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Haskell-Cafe mailing list</span><br><span>To (un)subscribe, modify options or view archives go to:</span><br><span><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a></span><br><span>Only members subscribed via the mailman list are allowed to post.</span></div></blockquote></body></html>