Zulip Chat Archive

Stream: general

Topic: parser help


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.

Mario Carneiro (Feb 26 2020 at 04:22):

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

Mario Carneiro (Feb 26 2020 at 04:23):

that puts them in a pair


Last updated: Dec 20 2023 at 11:08 UTC