0

I'm writing an anti-quoter in Haskell and I need a Parsec combinator that parses a valid Haskell variable identifier.

Is there one already implemented in the quasiquoting libraries or do I need to write my own?

I'm hoping I don't need to copy/paste the ident implementation found in http://www.haskell.org/haskellwiki/Quasiquotation.

1
  • I think copying it is probably the easiest way to go. We really need some support libraries for quasiquotation. Commented Jan 25, 2013 at 6:30

1 Answer 1

5

It's unlikely that anything in the implementation of Template Haskell itself contains a Parsec parser for anything, because GHC does not use Parsec for parsing--note that it's not in the list of packages tied to GHC in various ways.

However, the module Text.Parsec.Token gives a means of describing full token parsers for languages, and the Text.Parsec.Language module includes some predefined token parsers, including one for Haskell tokens.

Beyond that, you could also look at the haskell-src-exts package, which is a parser for Haskell source files.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.