<div dir="ltr">Hi Ruben,<div><br></div><div>I imagine, free applicative would allow you to easily insert whitespace/comment eaters afterwards. For instance, say you have Parser applicative for parsing. Then Ap Parser would represent the same parser, but with parsing combinators separated with Ap constructors. You would use Ap Parser when defining your grammar. Then you could "intersperse" whitespace eaters in between the combinators and "retract" the resulting Ap Parser into just Parser. That would probably be a cleaner approach compared to having every combinator wrapped in trimWhiteSpacesAndComments combinator.</div><div><br></div><div>Kind regards,</div><div>Nick</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, 18 Oct 2016 at 15:12 Ruben Astudillo <<a href="mailto:ruben.astud@gmail.com">ruben.astud@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all<br class="gmail_msg">
<br class="gmail_msg">
on [1] it is said the following<br class="gmail_msg">
<br class="gmail_msg">
    "Dealing with whitespace and comments is awkward in the parser; you<br class="gmail_msg">
    need to wrap everything in a token combinator. (If you decide to do<br class="gmail_msg">
    that, at least use a free applicative functor to ensure that you<br class="gmail_msg">
    don’t forget to consume that whitespace)."<br class="gmail_msg">
<br class="gmail_msg">
Reading on `free` the def of Ap, frankly I don't see how can the free<br class="gmail_msg">
applicative be used for this. Anybody could drop a hint? I would<br class="gmail_msg">
appreciate it.<br class="gmail_msg">
<br class="gmail_msg">
[1]: <a href="https://ro-che.info/articles/2015-01-02-lexical-analysis" rel="noreferrer" class="gmail_msg" target="_blank">https://ro-che.info/articles/2015-01-02-lexical-analysis</a><br class="gmail_msg">
-- Ruben<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
Haskell-Cafe mailing list<br class="gmail_msg">
To (un)subscribe, modify options or view archives go to:<br class="gmail_msg">
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" class="gmail_msg" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br class="gmail_msg">
Only members subscribed via the mailman list are allowed to post.</blockquote></div>