[Haskell-cafe] Parsing, infixes and on-the-fly precedence

Jeffrey Brown jeffbrown.the at gmail.com
Tue Sep 29 19:25:01 UTC 2015


Chris I thanked in private. Perhaps I should have done that publicly; it
looks like the Parsec.Expr library is exactly what I need.

Kim-Ee, yes, I believe that's exactly what I'm going for.

On Mon, Sep 28, 2015 at 8:07 PM, Kim-Ee Yeoh <ky3 at atamo.com> wrote:

>
> On Mon, Sep 28, 2015 at 2:28 PM, Jeffrey Brown <jeffbrown.the at gmail.com>
> wrote:
>
>> I imagine a parser that operates on (String,[String]) pairs, for which
>> the second element allows the user to define precedence on the fly.
>
>
> Let's use the Parser newtype
>
> newtype Parser a = Parser { parse :: String -> [(a,String)] }
>
> from
>
> http://dev.stephendiehl.com/fun/002_parsers.html
>
> as a basis for discussion.
>
> Now you want to "operate on (String,[String]) pairs", so the Parser
> newtype must now look like this:
>
> type MyInput = (String,[String])
>
> newtype MyParser a = MyParser { parse :: MyInput -> [(a,MyInput)] }
>
> Is this what you have in mind?
>
> -- Kim-Ee
>



-- 
Jeffrey Benjamin Brown
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150929/a98c73ff/attachment.html>


More information about the Haskell-Cafe mailing list