Zulip Chat Archive

Stream: general

Topic: parser help


view this post on Zulip Scott Morrison (Feb 26 2020 at 04:21):

How do I write a parser for a using x y, where x and y should be names?

I know I'd write parse (tk "using" *> ident)? if I was just trying to parse using x, but I want to match exactly two identifiers after the using.

view this post on Zulip Mario Carneiro (Feb 26 2020 at 04:22):

parse (tk "using" *> (prod.mk <$> ident <*> ident))?

view this post on Zulip Mario Carneiro (Feb 26 2020 at 04:23):

that puts them in a pair


Last updated: May 10 2021 at 23:11 UTC